webpack-bundle-analyzer 4.2.0 → 4.4.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 CHANGED
@@ -12,7 +12,40 @@ _Note: Gaps between patch versions are faulty, broken or test releases._
12
12
 
13
13
  ## UNRELEASED
14
14
 
15
- <!-- Add changelog entries for new changes under this section -->
15
+ ## 4.4.2
16
+
17
+ * **Bug Fix**
18
+ * Fix failure with `compiler.outputFileSystem.constructor` being `undefined` ([#447](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/447) by [@kedarv](https://github.com/kedarv) and [@alexander-akait](https://github.com/alexander-akait))
19
+ * **NOTE:** This fix doesn't have added test coverage so the fix might break in future versions unless test coverage is added later.
20
+
21
+ ## 4.4.1
22
+
23
+ * **Bug Fix**
24
+ * Fix missing module chunks ([#433](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/433) by [@deanshub](https://github.com/deanshub))
25
+
26
+ * **Internal**
27
+ * Fix tests timing out in CI ([#435](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/435) by [@deanshub](https://github.com/deanshub))
28
+ * Fix command in issue template ([#428](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/428) by [@cncolder](https://github.com/cncolder))
29
+
30
+ ## 4.4.0
31
+
32
+ * **Improvement**
33
+ * Keep treemap labels visible during zooming animations for better user experience ([#414](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/414) by [@stanislawosinski](https://github.com/stanislawosinski))
34
+
35
+ * **Bug Fix**
36
+ * Don't show an empty tooltip when hovering over the FoamTree attribution group or between top-level groups ([#413](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/413) by [@stanislawosinski](https://github.com/stanislawosinski))
37
+
38
+ * **Internal**
39
+ * Upgrade FoamTree to version 3.5.0, replace vendor dependency with an NPM package ([#412](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/412) by [@stanislawosinski](https://github.com/stanislawosinski))
40
+
41
+ ## 4.3.0
42
+
43
+ * **Improvement**
44
+ * Replace express with builtin node server, reducing number of dependencies ([#398](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/398) by [@TrySound](https://github.com/TrySound))
45
+ * Move `filesize` to dev dependencies, reducing number of dependencies ([#401](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/401) by [@realityking](https://github.com/realityking))
46
+
47
+ * **Internal**
48
+ * Replace Travis with GitHub actions ([#402](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/402) by [@valscion](https://github.com/valscion))
16
49
 
17
50
  ## 4.2.0
18
51
 
package/README.md CHANGED
@@ -178,6 +178,9 @@ Analyzer will use module sizes from stats file.
178
178
  ```
179
179
  To get more information about it you can read [issue #147](https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/147).
180
180
 
181
+ <h2 align="center">Other tools</h2>
182
+
183
+ - [Statoscope](https://github.com/smelukov/statoscope/blob/master/packages/ui-webpack/README.md) - Webpack bundle analyzing tool to find out why a certain module was bundled (and more features, including interactive treemap)
181
184
 
182
185
  <h2 align="center">Maintainers</h2>
183
186
 
@@ -141,6 +141,10 @@ class BundleAnalyzerPlugin {
141
141
  }
142
142
 
143
143
  getBundleDirFromCompiler() {
144
+ if (typeof this.compiler.outputFileSystem.constructor === 'undefined') {
145
+ return this.compiler.outputPath;
146
+ }
147
+
144
148
  switch (this.compiler.outputFileSystem.constructor.name) {
145
149
  case 'MemoryFileSystem':
146
150
  return null;
package/lib/analyzer.js CHANGED
@@ -184,7 +184,7 @@ function getBundleModules(bundleStats) {
184
184
 
185
185
  function assetHasModule(statAsset, statModule) {
186
186
  // Checking if this module is the part of asset chunks
187
- return statModule.chunks.some(moduleChunk => statAsset.chunks.includes(moduleChunk));
187
+ return (statModule.chunks || []).some(moduleChunk => statAsset.chunks.includes(moduleChunk));
188
188
  }
189
189
 
190
190
  function isEntryModule(statModule) {
package/lib/viewer.js CHANGED
@@ -8,9 +8,9 @@ const http = require('http');
8
8
 
9
9
  const WebSocket = require('ws');
10
10
 
11
- const _ = require('lodash');
11
+ const sirv = require('sirv');
12
12
 
13
- const express = require('express');
13
+ const _ = require('lodash');
14
14
 
15
15
  const {
16
16
  bold
@@ -63,22 +63,27 @@ async function startServer(bundleStats, opts) {
63
63
  };
64
64
  let chartData = getChartData(analyzerOpts, bundleStats, bundleDir);
65
65
  if (!chartData) return;
66
- const app = express();
67
- app.use(express.static(`${projectRoot}/public`));
68
- app.get('/', (req, res) => {
69
- res.writeHead(200, {
70
- 'Content-Type': 'text/html'
71
- });
72
- const html = renderViewer({
73
- mode: 'server',
74
- title: resolveTitle(reportTitle),
75
- chartData,
76
- defaultSizes,
77
- enableWebSocket: true
78
- });
79
- return res.end(html);
66
+ const sirvMiddleware = sirv(`${projectRoot}/public`, {
67
+ // disables caching and traverse the file system on every request
68
+ dev: true
69
+ });
70
+ const server = http.createServer((req, res) => {
71
+ if (req.method === 'GET' && req.url === '/') {
72
+ const html = renderViewer({
73
+ mode: 'server',
74
+ title: resolveTitle(reportTitle),
75
+ chartData,
76
+ defaultSizes,
77
+ enableWebSocket: true
78
+ });
79
+ res.writeHead(200, {
80
+ 'Content-Type': 'text/html'
81
+ });
82
+ res.end(html);
83
+ } else {
84
+ sirvMiddleware(req, res);
85
+ }
80
86
  });
81
- const server = http.createServer(app);
82
87
  await new Promise(resolve => {
83
88
  server.listen(port, host, () => {
84
89
  resolve();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack-bundle-analyzer",
3
- "version": "4.2.0",
3
+ "version": "4.4.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",
@@ -37,11 +37,10 @@
37
37
  "acorn-walk": "^8.0.0",
38
38
  "chalk": "^4.1.0",
39
39
  "commander": "^6.2.0",
40
- "express": "^4.17.1",
41
- "filesize": "^6.1.0",
42
40
  "gzip-size": "^6.0.0",
43
41
  "lodash": "^4.17.20",
44
42
  "opener": "^1.5.2",
43
+ "sirv": "^1.0.7",
45
44
  "ws": "^7.3.1"
46
45
  },
47
46
  "devDependencies": {
@@ -53,6 +52,7 @@
53
52
  "@babel/preset-react": "7.12.5",
54
53
  "@babel/register": "7.12.1",
55
54
  "@babel/runtime": "7.12.5",
55
+ "@carrotsearch/foamtree": "3.5.0",
56
56
  "autoprefixer": "10.0.1",
57
57
  "babel-eslint": "10.1.0",
58
58
  "babel-loader": "8.1.0",
@@ -69,6 +69,7 @@
69
69
  "eslint-config-th0r-react": "2.0.1",
70
70
  "eslint-plugin-react": "7.21.5",
71
71
  "exports-loader": "1.1.1",
72
+ "filesize": "^6.1.0",
72
73
  "globby": "11.0.1",
73
74
  "gulp": "4.0.2",
74
75
  "gulp-babel": "8.0.0",
@@ -76,7 +77,7 @@
76
77
  "mobx-react": "6.3.1",
77
78
  "mocha": "8.2.1",
78
79
  "nightmare": "3.0.2",
79
- "postcss": "8.1.6",
80
+ "postcss": "8.2.10",
80
81
  "postcss-icss-values": "2.0.2",
81
82
  "postcss-loader": "4.0.4",
82
83
  "preact": "10.5.5",