rollup 2.20.0 → 2.21.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/dist/rollup.d.ts CHANGED
@@ -89,7 +89,7 @@ export interface SourceDescription {
89
89
  ast?: AcornNode;
90
90
  code: string;
91
91
  map?: SourceMapInput;
92
- moduleSideEffects?: boolean | null;
92
+ moduleSideEffects?: boolean | 'no-treeshake' | null;
93
93
  syntheticNamedExports?: boolean;
94
94
  }
95
95
 
@@ -98,7 +98,7 @@ export interface TransformModuleJSON {
98
98
  code: string;
99
99
  // note if plugins use new this.cache to opt-out auto transform cache
100
100
  customTransformCache: boolean;
101
- moduleSideEffects: boolean | null;
101
+ moduleSideEffects: boolean | 'no-treeshake' | null;
102
102
  originalCode: string;
103
103
  originalSourcemap: ExistingDecodedSourceMap | null;
104
104
  resolvedIds?: ResolvedIdMap;
@@ -154,7 +154,7 @@ export type EmitFile = (emittedFile: EmittedFile) => string;
154
154
  interface ModuleInfo {
155
155
  dynamicallyImportedIds: string[];
156
156
  dynamicImporters: string[];
157
- hasModuleSideEffects: boolean;
157
+ hasModuleSideEffects: boolean | 'no-treeshake';
158
158
  id: string;
159
159
  implicitlyLoadedAfterOneOf: string[];
160
160
  implicitlyLoadedBefore: string[];
@@ -206,7 +206,7 @@ export interface PluginContextMeta {
206
206
  export interface ResolvedId {
207
207
  external: boolean;
208
208
  id: string;
209
- moduleSideEffects: boolean;
209
+ moduleSideEffects: boolean | 'no-treeshake';
210
210
  syntheticNamedExports: boolean;
211
211
  }
212
212
 
@@ -217,7 +217,7 @@ export interface ResolvedIdMap {
217
217
  interface PartialResolvedId {
218
218
  external?: boolean;
219
219
  id: string;
220
- moduleSideEffects?: boolean | null;
220
+ moduleSideEffects?: boolean | 'no-treeshake' | null;
221
221
  syntheticNamedExports?: boolean;
222
222
  }
223
223
 
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.20.0
4
- Mon, 06 Jul 2020 19:11:47 GMT - commit 974492f50d5051e671998ca21cba7ac939823e34
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.20.0
4
- Mon, 06 Jul 2020 19:11:47 GMT - commit 974492f50d5051e671998ca21cba7ac939823e34
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.20.0
4
- Mon, 06 Jul 2020 19:11:47 GMT - commit 974492f50d5051e671998ca21cba7ac939823e34
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.20.0
4
- Mon, 06 Jul 2020 19:11:47 GMT - commit 974492f50d5051e671998ca21cba7ac939823e34
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.20.0
4
- Mon, 06 Jul 2020 19:11:47 GMT - commit 974492f50d5051e671998ca21cba7ac939823e34
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -28,7 +28,7 @@ var crypto = require('crypto');
28
28
  var fs = require('fs');
29
29
  var events = require('events');
30
30
 
31
- var version = "2.20.0";
31
+ var version = "2.21.0";
32
32
 
33
33
  function createCommonjsModule(fn, basedir, module) {
34
34
  return module = {
@@ -9666,7 +9666,7 @@ class Module {
9666
9666
  }
9667
9667
  relevantDependencies.add(variable.module);
9668
9668
  }
9669
- if (this.options.treeshake) {
9669
+ if (this.options.treeshake && this.moduleSideEffects !== 'no-treeshake') {
9670
9670
  for (const dependency of possibleDependencies) {
9671
9671
  if (!(dependency.moduleSideEffects || additionalSideEffectModules.has(dependency)) ||
9672
9672
  relevantDependencies.has(dependency)) {
@@ -9805,7 +9805,8 @@ class Module {
9805
9805
  return null;
9806
9806
  }
9807
9807
  hasEffects() {
9808
- return this.ast.included && this.ast.hasEffects(createHasEffectsContext());
9808
+ return (this.moduleSideEffects === 'no-treeshake' ||
9809
+ (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
9809
9810
  }
9810
9811
  include() {
9811
9812
  const context = createInclusionContext();
@@ -9886,10 +9887,10 @@ class Module {
9886
9887
  }
9887
9888
  this.transformDependencies = transformDependencies;
9888
9889
  this.customTransformCache = customTransformCache;
9889
- if (typeof moduleSideEffects === 'boolean') {
9890
+ if (moduleSideEffects != null) {
9890
9891
  this.moduleSideEffects = moduleSideEffects;
9891
9892
  }
9892
- if (typeof syntheticNamedExports === 'boolean') {
9893
+ if (syntheticNamedExports != null) {
9893
9894
  this.syntheticNamedExports = syntheticNamedExports;
9894
9895
  }
9895
9896
  timeStart('generate ast', 3);
@@ -17542,10 +17543,10 @@ function transform(source, module, pluginDriver, warn) {
17542
17543
  if (typeof result.map === 'string') {
17543
17544
  result.map = JSON.parse(result.map);
17544
17545
  }
17545
- if (typeof result.moduleSideEffects === 'boolean') {
17546
+ if (result.moduleSideEffects != null) {
17546
17547
  moduleSideEffects = result.moduleSideEffects;
17547
17548
  }
17548
- if (typeof result.syntheticNamedExports === 'boolean') {
17549
+ if (result.syntheticNamedExports != null) {
17549
17550
  syntheticNamedExports = result.syntheticNamedExports;
17550
17551
  }
17551
17552
  }
@@ -17767,10 +17768,10 @@ class ModuleLoader {
17767
17768
  module.setSource(cachedModule);
17768
17769
  }
17769
17770
  else {
17770
- if (typeof sourceDescription.moduleSideEffects === 'boolean') {
17771
+ if (sourceDescription.moduleSideEffects != null) {
17771
17772
  module.moduleSideEffects = sourceDescription.moduleSideEffects;
17772
17773
  }
17773
- if (typeof sourceDescription.syntheticNamedExports === 'boolean') {
17774
+ if (sourceDescription.syntheticNamedExports != null) {
17774
17775
  module.syntheticNamedExports = sourceDescription.syntheticNamedExports;
17775
17776
  }
17776
17777
  module.setSource(await transform(sourceDescription, module, this.pluginDriver, this.options.onwarn));
@@ -17905,10 +17906,10 @@ class ModuleLoader {
17905
17906
  if (resolveIdResult.external) {
17906
17907
  external = true;
17907
17908
  }
17908
- if (typeof resolveIdResult.moduleSideEffects === 'boolean') {
17909
+ if (resolveIdResult.moduleSideEffects != null) {
17909
17910
  moduleSideEffects = resolveIdResult.moduleSideEffects;
17910
17911
  }
17911
- if (typeof resolveIdResult.syntheticNamedExports === 'boolean') {
17912
+ if (resolveIdResult.syntheticNamedExports != null) {
17912
17913
  syntheticNamedExports = resolveIdResult.syntheticNamedExports;
17913
17914
  }
17914
17915
  }
@@ -17929,9 +17930,7 @@ class ModuleLoader {
17929
17930
  return {
17930
17931
  external,
17931
17932
  id,
17932
- moduleSideEffects: typeof moduleSideEffects === 'boolean'
17933
- ? moduleSideEffects
17934
- : this.hasModuleSideEffects(id, external),
17933
+ moduleSideEffects: moduleSideEffects !== null && moduleSideEffects !== void 0 ? moduleSideEffects : this.hasModuleSideEffects(id, external),
17935
17934
  syntheticNamedExports
17936
17935
  };
17937
17936
  }
@@ -18421,8 +18420,14 @@ class Graph {
18421
18420
  timeStart(`treeshaking pass ${treeshakingPass}`, 3);
18422
18421
  this.needsTreeshakingPass = false;
18423
18422
  for (const module of this.modules) {
18424
- if (module.isExecuted)
18425
- module.include();
18423
+ if (module.isExecuted) {
18424
+ if (module.moduleSideEffects === 'no-treeshake') {
18425
+ module.includeAllInBundle();
18426
+ }
18427
+ else {
18428
+ module.include();
18429
+ }
18430
+ }
18426
18431
  }
18427
18432
  timeEnd(`treeshaking pass ${treeshakingPass++}`, 3);
18428
18433
  } while (this.needsTreeshakingPass);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.20.0
4
- Mon, 06 Jul 2020 19:11:47 GMT - commit 974492f50d5051e671998ca21cba7ac939823e34
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.20.0
4
- Mon, 06 Jul 2020 19:11:47 GMT - commit 974492f50d5051e671998ca21cba7ac939823e34
3
+ Rollup.js v2.21.0
4
+ Tue, 07 Jul 2020 19:25:24 GMT - commit b1aaedc37f1bf83ed410f4b5c4ea950b12b14e7a
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.20.0",
3
+ "version": "2.21.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",