webpack-bundle-analyzer 4.10.0 → 4.10.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/lib/analyzer.js CHANGED
@@ -23,7 +23,7 @@ const {
23
23
  } = require('./utils');
24
24
 
25
25
  const FILENAME_QUERY_REGEXP = /\?.*$/u;
26
- const FILENAME_EXTENSIONS = /\.(js|mjs)$/iu;
26
+ const FILENAME_EXTENSIONS = /\.(js|mjs|cjs)$/iu;
27
27
  module.exports = {
28
28
  getViewerData,
29
29
  readStatsFromFile
@@ -57,7 +57,7 @@ function getViewerData(bundleStats, bundleDir, opts) {
57
57
  bundleStats.assets.push(asset);
58
58
  });
59
59
  });
60
- } // Picking only `*.js or *.mjs` assets from bundle that has non-empty `chunks` array
60
+ } // Picking only `*.js, *.cjs or *.mjs` assets from bundle that has non-empty `chunks` array
61
61
 
62
62
 
63
63
  bundleStats.assets = bundleStats.assets.filter(asset => {
package/lib/viewer.js CHANGED
@@ -10,10 +10,6 @@ const WebSocket = require('ws');
10
10
 
11
11
  const sirv = require('sirv');
12
12
 
13
- const {
14
- isPlainObject
15
- } = require('is-plain-object');
16
-
17
13
  const {
18
14
  bold
19
15
  } = require('picocolors');
@@ -203,9 +199,11 @@ function getChartData(analyzerOpts, ...args) {
203
199
  logger.error(`Could't analyze webpack bundle:\n${err}`);
204
200
  logger.debug(err.stack);
205
201
  chartData = null;
206
- }
202
+ } // chartData can either be an array (bundleInfo[]) or null. It can't be an plain object anyway
203
+
207
204
 
208
- if (isPlainObject(chartData) && Object.keys(chartData).length === 0) {
205
+ if ( // analyzer.getViewerData() doesn't failed in the previous step
206
+ chartData && !Array.isArray(chartData)) {
209
207
  logger.error("Could't find any javascript bundles in provided stats file");
210
208
  chartData = null;
211
209
  }
@@ -214,9 +212,9 @@ function getChartData(analyzerOpts, ...args) {
214
212
  }
215
213
 
216
214
  function getEntrypoints(bundleStats) {
217
- if (bundleStats === null || bundleStats === undefined) {
215
+ if (bundleStats === null || bundleStats === undefined || !bundleStats.entrypoints) {
218
216
  return [];
219
217
  }
220
218
 
221
- return Object.values(bundleStats.entrypoints || {}).map(entrypoint => entrypoint.name);
219
+ return Object.values(bundleStats.entrypoints).map(entrypoint => entrypoint.name);
222
220
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack-bundle-analyzer",
3
- "version": "4.10.0",
3
+ "version": "4.10.2",
4
4
  "description": "Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap",
5
5
  "author": "Yury Grunin <grunin.ya@ya.ru>",
6
6
  "license": "MIT",
@@ -41,7 +41,6 @@
41
41
  "escape-string-regexp": "^4.0.0",
42
42
  "gzip-size": "^6.0.0",
43
43
  "html-escaper": "^2.0.2",
44
- "is-plain-object": "^5.0.0",
45
44
  "opener": "^1.5.2",
46
45
  "picocolors": "^1.0.0",
47
46
  "sirv": "^2.0.3",