webpack-bundle-analyzer 4.9.1 → 4.10.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 +8 -0
- package/lib/analyzer.js +50 -14
- package/lib/template.js +3 -1
- package/lib/tree/BaseFolder.js +1 -3
- package/lib/tree/ConcatenatedModule.js +6 -4
- package/package.json +4 -7
- package/public/viewer.js +2 -20
- package/public/viewer.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,14 @@ _Note: Gaps between patch versions are faulty, broken or test releases._
|
|
|
12
12
|
|
|
13
13
|
## UNRELEASED
|
|
14
14
|
|
|
15
|
+
## 4.10.0
|
|
16
|
+
|
|
17
|
+
* **Improvement**
|
|
18
|
+
* Allows filtering the list of entrypoints ([#624](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/624) by [@chriskrogh](https://github.com/chriskrogh))
|
|
19
|
+
|
|
20
|
+
* **Internal**
|
|
21
|
+
* Make module much slimmer by replacing all `lodash.*` packages ([#612](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/612)) by [@sukkaw](https://github.com/sukkaw).
|
|
22
|
+
|
|
15
23
|
## 4.9.1
|
|
16
24
|
|
|
17
25
|
* **Internal**
|
package/lib/analyzer.js
CHANGED
|
@@ -4,14 +4,6 @@ const fs = require('fs');
|
|
|
4
4
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
|
-
const pullAll = require('lodash.pullall');
|
|
8
|
-
|
|
9
|
-
const invokeMap = require('lodash.invokemap');
|
|
10
|
-
|
|
11
|
-
const uniqBy = require('lodash.uniqby');
|
|
12
|
-
|
|
13
|
-
const flatten = require('lodash.flatten');
|
|
14
|
-
|
|
15
7
|
const gzipSize = require('gzip-size');
|
|
16
8
|
|
|
17
9
|
const {
|
|
@@ -128,7 +120,7 @@ function getViewerData(bundleStats, bundleDir, opts) {
|
|
|
128
120
|
} // Picking modules from current bundle script
|
|
129
121
|
|
|
130
122
|
|
|
131
|
-
|
|
123
|
+
let assetModules = modules.filter(statModule => assetHasModule(statAsset, statModule)); // Adding parsed sources
|
|
132
124
|
|
|
133
125
|
if (parsedModules) {
|
|
134
126
|
const unparsedEntryModules = [];
|
|
@@ -151,7 +143,7 @@ function getViewerData(bundleStats, bundleDir, opts) {
|
|
|
151
143
|
unparsedEntryModules[0].parsedSrc = assetSources.runtimeSrc;
|
|
152
144
|
} else {
|
|
153
145
|
// If there are multiple entry points we move all of them under synthetic concatenated module.
|
|
154
|
-
|
|
146
|
+
assetModules = assetModules.filter(mod => !unparsedEntryModules.includes(mod));
|
|
155
147
|
assetModules.unshift({
|
|
156
148
|
identifier: './entry modules',
|
|
157
149
|
name: './entry modules',
|
|
@@ -181,7 +173,7 @@ function getViewerData(bundleStats, bundleDir, opts) {
|
|
|
181
173
|
statSize: asset.tree.size || asset.size,
|
|
182
174
|
parsedSize: asset.parsedSize,
|
|
183
175
|
gzipSize: asset.gzipSize,
|
|
184
|
-
groups:
|
|
176
|
+
groups: Object.values(asset.tree.children).map(i => i.toChartData()),
|
|
185
177
|
isInitialByEntrypoint: (_chunkToInitialByEntr = chunkToInitialByEntrypoint[filename]) !== null && _chunkToInitialByEntr !== void 0 ? _chunkToInitialByEntr : {}
|
|
186
178
|
};
|
|
187
179
|
});
|
|
@@ -200,8 +192,20 @@ function getChildAssetBundles(bundleStats, assetName) {
|
|
|
200
192
|
function getBundleModules(bundleStats) {
|
|
201
193
|
var _bundleStats$chunks;
|
|
202
194
|
|
|
203
|
-
|
|
204
|
-
).
|
|
195
|
+
const seenIds = new Set();
|
|
196
|
+
return flatten((((_bundleStats$chunks = bundleStats.chunks) === null || _bundleStats$chunks === void 0 ? void 0 : _bundleStats$chunks.map(chunk => chunk.modules)) || []).concat(bundleStats.modules).filter(Boolean)).filter(mod => {
|
|
197
|
+
// Filtering out Webpack's runtime modules as they don't have ids and can't be parsed (introduced in Webpack 5)
|
|
198
|
+
if (isRuntimeModule(mod)) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (seenIds.has(mod.id)) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
seenIds.add(mod.id);
|
|
207
|
+
return true;
|
|
208
|
+
});
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
function assetHasModule(statAsset, statModule) {
|
|
@@ -241,4 +245,36 @@ function getChunkToInitialByEntrypoint(bundleStats) {
|
|
|
241
245
|
return chunkToEntrypointInititalMap;
|
|
242
246
|
}
|
|
243
247
|
|
|
244
|
-
;
|
|
248
|
+
;
|
|
249
|
+
/**
|
|
250
|
+
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
|
|
251
|
+
*
|
|
252
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
253
|
+
* Released under the MIT License.
|
|
254
|
+
*
|
|
255
|
+
* Modified by Sukka <https://skk.moe>
|
|
256
|
+
*
|
|
257
|
+
* Replace recursively flatten with one-level deep flatten to match lodash.flatten
|
|
258
|
+
*
|
|
259
|
+
* TODO: replace with Array.prototype.flat once Node.js 10 support is dropped
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
function flatten(arr) {
|
|
263
|
+
if (!arr) return [];
|
|
264
|
+
const len = arr.length;
|
|
265
|
+
if (!len) return [];
|
|
266
|
+
let cur;
|
|
267
|
+
const res = [];
|
|
268
|
+
|
|
269
|
+
for (let i = 0; i < len; i++) {
|
|
270
|
+
cur = arr[i];
|
|
271
|
+
|
|
272
|
+
if (Array.isArray(cur)) {
|
|
273
|
+
res.push(...cur);
|
|
274
|
+
} else {
|
|
275
|
+
res.push(cur);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return res;
|
|
280
|
+
}
|
package/lib/template.js
CHANGED
|
@@ -5,7 +5,9 @@ const path = require('path');
|
|
|
5
5
|
|
|
6
6
|
const fs = require('fs');
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const {
|
|
9
|
+
escape
|
|
10
|
+
} = require('html-escaper');
|
|
9
11
|
|
|
10
12
|
const projectRoot = path.resolve(__dirname, '..');
|
|
11
13
|
const assetsRoot = path.join(projectRoot, 'public');
|
package/lib/tree/BaseFolder.js
CHANGED
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _lodash = _interopRequireDefault(require("lodash.invokemap"));
|
|
9
|
-
|
|
10
8
|
var _Node = _interopRequireDefault(require("./Node"));
|
|
11
9
|
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -117,7 +115,7 @@ class BaseFolder extends _Node.default {
|
|
|
117
115
|
label: this.name,
|
|
118
116
|
path: this.path,
|
|
119
117
|
statSize: this.size,
|
|
120
|
-
groups:
|
|
118
|
+
groups: Object.values(this.children).map(child => child.toChartData())
|
|
121
119
|
};
|
|
122
120
|
}
|
|
123
121
|
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _lodash = _interopRequireDefault(require("lodash.invokemap"));
|
|
9
|
-
|
|
10
8
|
var _Module = _interopRequireDefault(require("./Module"));
|
|
11
9
|
|
|
12
10
|
var _ContentModule = _interopRequireDefault(require("./ContentModule"));
|
|
@@ -88,13 +86,17 @@ class ConcatenatedModule extends _Module.default {
|
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
mergeNestedFolders() {
|
|
91
|
-
|
|
89
|
+
Object.values(this.children).forEach(child => {
|
|
90
|
+
if (child.mergeNestedFolders) {
|
|
91
|
+
child.mergeNestedFolders();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
toChartData() {
|
|
95
97
|
return { ...super.toChartData(),
|
|
96
98
|
concatenated: true,
|
|
97
|
-
groups:
|
|
99
|
+
groups: Object.values(this.children).map(child => child.toChartData())
|
|
98
100
|
};
|
|
99
101
|
}
|
|
100
102
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack-bundle-analyzer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.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",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">= 10.13.0"
|
|
20
20
|
},
|
|
21
|
+
"packageManager": "npm@6.14.8",
|
|
21
22
|
"scripts": {
|
|
22
23
|
"start": "gulp watch",
|
|
23
24
|
"build": "gulp build",
|
|
@@ -36,15 +37,11 @@
|
|
|
36
37
|
"acorn": "^8.0.4",
|
|
37
38
|
"acorn-walk": "^8.0.0",
|
|
38
39
|
"commander": "^7.2.0",
|
|
40
|
+
"debounce": "^1.2.1",
|
|
39
41
|
"escape-string-regexp": "^4.0.0",
|
|
40
42
|
"gzip-size": "^6.0.0",
|
|
43
|
+
"html-escaper": "^2.0.2",
|
|
41
44
|
"is-plain-object": "^5.0.0",
|
|
42
|
-
"lodash.debounce": "^4.0.8",
|
|
43
|
-
"lodash.escape": "^4.0.1",
|
|
44
|
-
"lodash.flatten": "^4.4.0",
|
|
45
|
-
"lodash.invokemap": "^4.6.0",
|
|
46
|
-
"lodash.pullall": "^4.2.0",
|
|
47
|
-
"lodash.uniqby": "^4.7.0",
|
|
48
45
|
"opener": "^1.5.2",
|
|
49
46
|
"picocolors": "^1.0.0",
|
|
50
47
|
"sirv": "^2.0.3",
|