@rollup-extras/plugin-size 0.3.1 → 0.3.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.
Files changed (2) hide show
  1. package/index.js +9 -7
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -207,16 +207,14 @@ export default function (options) {
207
207
  let buildInputs = new WeakSet();
208
208
  let reportComplete = false;
209
209
 
210
- const instance = multiConfigPluginBase(false, pluginName, reportAndSave, onEachOutput);
210
+ const instance = multiConfigPluginBase(false, pluginName, reportAndSave, onEachOutput, resetStats);
211
211
 
212
212
  if (outputPlugin) {
213
213
  const addInstance = instance.api.addInstance;
214
214
  instance.api.addInstance = () => trackBuild(addInstance());
215
215
  trackBuild(instance);
216
216
  } else {
217
- instance.buildStart = () => {
218
- currentStats = {};
219
- };
217
+ instance.buildStart = resetStats;
220
218
  }
221
219
 
222
220
  return instance;
@@ -226,9 +224,7 @@ export default function (options) {
226
224
  plugin.renderStart = function (outputOptions, inputOptions) {
227
225
 
228
226
  if (reportComplete && !buildInputs.has(inputOptions)) {
229
- currentStats = {};
230
- buildInputs = new WeakSet();
231
- reportComplete = false;
227
+ resetStats();
232
228
  }
233
229
  buildInputs.add(inputOptions);
234
230
  return renderStart.call(this, outputOptions, inputOptions);
@@ -236,6 +232,12 @@ export default function (options) {
236
232
  return plugin;
237
233
  }
238
234
 
235
+ function resetStats() {
236
+ currentStats = {};
237
+ buildInputs = new WeakSet();
238
+ reportComplete = false;
239
+ }
240
+
239
241
  async function onEachOutput(outputOptions, bundle) {
240
242
  await collectStats(currentStats, outputOptions, bundle, flags, minifyFn);
241
243
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.1",
2
+ "version": "0.3.2",
3
3
  "license": "MIT",
4
4
  "name": "@rollup-extras/plugin-size",
5
5
  "author": "Konstantin Shutkin",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@niceties/ansi": "^1.1.2",
39
39
  "@niceties/logger": "^2.1.0",
40
- "@rollup-extras/utils": "^2.0.0"
40
+ "@rollup-extras/utils": "^2.0.2"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "rollup": "^4.0.0"