webpack-bundle-analyzer 4.5.0 → 4.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 +6 -0
- package/README.md +1 -0
- package/lib/BundleAnalyzerPlugin.js +3 -1
- package/lib/utils.js +8 -0
- package/lib/viewer.js +7 -2
- package/package.json +1 -1
- package/public/viewer.js +1 -1
- package/public/viewer.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,12 @@ _Note: Gaps between patch versions are faulty, broken or test releases._
|
|
|
12
12
|
|
|
13
13
|
## UNRELEASED
|
|
14
14
|
|
|
15
|
+
## 4.6.0
|
|
16
|
+
|
|
17
|
+
* **New Feature**
|
|
18
|
+
* Support outputting different URL in server mode ([#520](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/520) by [@southorange1228](https://github.com/southorange1228))
|
|
19
|
+
* Use deterministic chunk colors (#[501](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/501) by [@CreativeTechGuy](https://github.com/CreativeTechGuy))
|
|
20
|
+
|
|
15
21
|
## 4.5.0
|
|
16
22
|
|
|
17
23
|
* **Improvement**
|
package/README.md
CHANGED
|
@@ -59,6 +59,7 @@ new BundleAnalyzerPlugin(options?: object)
|
|
|
59
59
|
|**`analyzerMode`**|One of: `server`, `static`, `json`, `disabled`|Default: `server`. In `server` mode analyzer will start HTTP server to show bundle report. In `static` mode single HTML file with bundle report will be generated. In `json` mode single JSON file with bundle report will be generated. In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`. |
|
|
60
60
|
|**`analyzerHost`**|`{String}`|Default: `127.0.0.1`. Host that will be used in `server` mode to start HTTP server.|
|
|
61
61
|
|**`analyzerPort`**|`{Number}` or `auto`|Default: `8888`. Port that will be used in `server` mode to start HTTP server.|
|
|
62
|
+
|**`analyzerUrl`**|`{Function}` called with `{ listenHost: string, listenHost: string, boundAddress: server.address}`. [server.address comes from Node.js](https://nodejs.org/api/net.html#serveraddress)| Default: `http://${listenHost}:${boundAddress.port}`. The URL printed to console with server mode.|
|
|
62
63
|
|**`reportFilename`**|`{String}`|Default: `report.html`. Path to bundle report file that will be generated in `static` mode. It can be either an absolute path or a path relative to a bundle output directory (which is output.path in webpack config).|
|
|
63
64
|
|**`reportTitle`**|`{String\|function}`|Default: function that returns pretty printed current date and time. Content of the HTML `title` element; or a function of the form `() => string` that provides the content.|
|
|
64
65
|
|**`defaultSizes`**|One of: `stat`, `parsed`, `gzip`|Default: `parsed`. Module sizes to show in report by default. [Size definitions](#size-definitions) section describes what these values mean.|
|
|
@@ -34,6 +34,7 @@ class BundleAnalyzerPlugin {
|
|
|
34
34
|
logLevel: 'info',
|
|
35
35
|
// deprecated
|
|
36
36
|
startAnalyzer: true,
|
|
37
|
+
analyzerUrl: utils.defaultAnalyzerUrl,
|
|
37
38
|
...opts,
|
|
38
39
|
analyzerPort: 'analyzerPort' in opts ? opts.analyzerPort === 'auto' ? 0 : opts.analyzerPort : 8888
|
|
39
40
|
};
|
|
@@ -114,7 +115,8 @@ class BundleAnalyzerPlugin {
|
|
|
114
115
|
bundleDir: this.getBundleDirFromCompiler(),
|
|
115
116
|
logger: this.logger,
|
|
116
117
|
defaultSizes: this.opts.defaultSizes,
|
|
117
|
-
excludeAssets: this.opts.excludeAssets
|
|
118
|
+
excludeAssets: this.opts.excludeAssets,
|
|
119
|
+
analyzerUrl: this.opts.analyzerUrl
|
|
118
120
|
});
|
|
119
121
|
}
|
|
120
122
|
}
|
package/lib/utils.js
CHANGED
|
@@ -53,6 +53,14 @@ exports.defaultTitle = function () {
|
|
|
53
53
|
const currentTime = `${day} ${month} ${year} at ${hour}:${minute}`;
|
|
54
54
|
return `${process.env.npm_package_name || 'Webpack Bundle Analyzer'} [${currentTime}]`;
|
|
55
55
|
};
|
|
56
|
+
|
|
57
|
+
exports.defaultAnalyzerUrl = function (options) {
|
|
58
|
+
const {
|
|
59
|
+
listenHost,
|
|
60
|
+
boundAddress
|
|
61
|
+
} = options;
|
|
62
|
+
return `http://${listenHost}:${boundAddress.port}`;
|
|
63
|
+
};
|
|
56
64
|
/**
|
|
57
65
|
* Calls opener on a URI, but silently try / catches it.
|
|
58
66
|
*/
|
package/lib/viewer.js
CHANGED
|
@@ -55,7 +55,8 @@ async function startServer(bundleStats, opts) {
|
|
|
55
55
|
logger = new Logger(),
|
|
56
56
|
defaultSizes = 'parsed',
|
|
57
57
|
excludeAssets = null,
|
|
58
|
-
reportTitle
|
|
58
|
+
reportTitle,
|
|
59
|
+
analyzerUrl
|
|
59
60
|
} = opts || {};
|
|
60
61
|
const analyzerOpts = {
|
|
61
62
|
logger,
|
|
@@ -87,7 +88,11 @@ async function startServer(bundleStats, opts) {
|
|
|
87
88
|
await new Promise(resolve => {
|
|
88
89
|
server.listen(port, host, () => {
|
|
89
90
|
resolve();
|
|
90
|
-
const url =
|
|
91
|
+
const url = analyzerUrl({
|
|
92
|
+
listenPort: port,
|
|
93
|
+
listenHost: host,
|
|
94
|
+
boundAddress: server.address()
|
|
95
|
+
});
|
|
91
96
|
logger.info(`${bold('Webpack Bundle Analyzer')} is started at ${bold(url)}\n` + `Use ${bold('Ctrl+C')} to close it`);
|
|
92
97
|
|
|
93
98
|
if (openBrowser) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack-bundle-analyzer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.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",
|