webpack-bundle-analyzer 3.4.1 → 3.6.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/CHANGELOG.md CHANGED
@@ -14,10 +14,29 @@ _Note: Gaps between patch versions are faulty, broken or test releases._
14
14
 
15
15
  <!-- Add changelog entries for new changes under this section -->
16
16
 
17
+ * **Improvement**
18
+ * Support webpack builds where `output.globalObject` is set to `'self'` ([#323](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/323) by [@lemonmade](https://github.com/lemonmade))
19
+ * Improve readability of tooltips ([#320](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/320) by [@lorenzos](https://github.com/lorenzos))
20
+
21
+ ## 3.5.2
22
+
23
+ * **Bug Fix**
24
+ * Fix sidebar not showing visibility status of chunks hidden via popup menu (issue [#316](https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/316) by [@gaokun](https://github.com/gaokun), fixed in [#317](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/317) by [@bregenspan](https://github.com/bregenspan))
25
+
26
+ ## 3.5.1
27
+
28
+ * **Bug Fix**
29
+ * Fix regression in support of webpack dev server and `webpack --watch` (issue [#312](https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/312), fixed in [#313](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/313) by [@gaokun](https://github.com/gaokun))
30
+
31
+ ## 3.5.0
32
+
33
+ * **Improvements**
34
+ * Improved report title and added favicon ([#310](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/310), [@gaokun](https://github.com/gaokun))
35
+
17
36
  ## 3.4.1
18
37
 
19
- * **Bug Fix**
20
- * Fix regression of requiring an object to be passed to `new BundleAnalyzerPlugin()` (issue [#300](https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/300), fixed in [#302](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/302) by [@jerryOnlyZRJ](https://github.com/jerryOnlyZRJ))
38
+ * **Bug Fix**
39
+ * Fix regression of requiring an object to be passed to `new BundleAnalyzerPlugin()` (issue [#300](https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/300), fixed in [#302](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/302) by [@jerryOnlyZRJ](https://github.com/jerryOnlyZRJ))
21
40
 
22
41
  ## 3.4.0
23
42
 
package/lib/parseUtils.js CHANGED
@@ -129,7 +129,8 @@ function isAsyncChunkPushExpression(node) {
129
129
  callee,
130
130
  arguments: args
131
131
  } = node;
132
- return callee.type === 'MemberExpression' && callee.property.name === 'push' && callee.object.type === 'AssignmentExpression' && callee.object.left.object && (callee.object.left.object.name === 'window' || // Webpack 4 uses `this` instead of `window`
132
+ return callee.type === 'MemberExpression' && callee.property.name === 'push' && callee.object.type === 'AssignmentExpression' && callee.object.left.object && (callee.object.left.object.name === 'window' || // `self` is a common output.globalObject value used to support both workers and browsers
133
+ callee.object.left.object.name === 'self' || // Webpack 4 uses `this` instead of `window`
133
134
  callee.object.left.object.type === 'ThisExpression') && args.length === 1 && args[0].type === 'ArrayExpression' && mayBeAsyncChunkArguments(args[0].elements) && isModulesList(args[0].elements[1]);
134
135
  }
135
136
 
package/lib/utils.js CHANGED
@@ -6,6 +6,7 @@ const {
6
6
 
7
7
  const _ = require('lodash');
8
8
 
9
+ const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
9
10
  exports.createAssetsFilter = createAssetsFilter;
10
11
 
11
12
  function createAssetsFilter(excludePatterns) {
@@ -32,4 +33,19 @@ function createAssetsFilter(excludePatterns) {
32
33
  } else {
33
34
  return () => true;
34
35
  }
35
- }
36
+ }
37
+ /**
38
+ * @desc get string of current time
39
+ * format: dd/MMM HH:mm
40
+ * */
41
+
42
+
43
+ exports.getCurrentTime = function () {
44
+ const time = new Date();
45
+ const year = time.getFullYear();
46
+ const month = MONTHS[time.getMonth()];
47
+ const day = time.getDate();
48
+ const hour = time.getHours();
49
+ const minute = time.getMinutes();
50
+ return `${day} ${month} ${year} at ${hour}:${minute}`;
51
+ };
package/lib/viewer.js CHANGED
@@ -26,6 +26,8 @@ const {
26
26
  bold
27
27
  } = require('chalk');
28
28
 
29
+ const utils = require('./utils');
30
+
29
31
  const Logger = require('./Logger');
30
32
 
31
33
  const analyzer = require('./analyzer');
@@ -38,6 +40,7 @@ module.exports = {
38
40
  // deprecated
39
41
  start: startServer
40
42
  };
43
+ const title = `${process.env.npm_package_name || 'Webpack Bundle Analyzer'} [${utils.getCurrentTime()}]`;
41
44
 
42
45
  function startServer(_x, _x2) {
43
46
  return _startServer.apply(this, arguments);
@@ -70,6 +73,7 @@ function _startServer() {
70
73
  app.use('/', (req, res) => {
71
74
  res.render('viewer', {
72
75
  mode: 'server',
76
+ title,
73
77
 
74
78
  get chartData() {
75
79
  return chartData;
@@ -148,6 +152,7 @@ function _generateReport() {
148
152
  yield new Promise((resolve, reject) => {
149
153
  ejs.renderFile(`${projectRoot}/views/viewer.ejs`, {
150
154
  mode: 'static',
155
+ title,
151
156
  chartData,
152
157
  defaultSizes,
153
158
  enableWebSocket: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack-bundle-analyzer",
3
- "version": "3.4.1",
3
+ "version": "3.6.0",
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",