webpack-bundle-analyzer
Advanced tools
Comparing version 4.9.0 to 4.9.1
@@ -15,2 +15,11 @@ # Changelog | ||
## 4.9.1 | ||
* **Internal** | ||
* Replace some lodash usages with JavaScript native API ([#505](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/505)) by [@sukkaw](https://github.com/sukkaw). | ||
* Make module much slimmer ([#609](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/609)) by [@sukkaw](https://github.com/sukkaw). | ||
* **Bug Fix** | ||
* fix `analyzerMode: 'server'` on certain machines ([#611](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/611) by [@panbenson](https://github.com/panbenson)) | ||
## 4.9.0 | ||
@@ -17,0 +26,0 @@ |
@@ -7,4 +7,10 @@ "use strict"; | ||
const _ = require('lodash'); | ||
const pullAll = require('lodash.pullall'); | ||
const invokeMap = require('lodash.invokemap'); | ||
const uniqBy = require('lodash.uniqby'); | ||
const flatten = require('lodash.flatten'); | ||
const gzipSize = require('gzip-size'); | ||
@@ -42,3 +48,3 @@ | ||
if (_.isEmpty(bundleStats.assets) && !_.isEmpty(bundleStats.children)) { | ||
if ((bundleStats.assets == null || bundleStats.assets.length === 0) && bundleStats.children && bundleStats.children.length > 0) { | ||
const { | ||
@@ -56,3 +62,3 @@ children | ||
} | ||
} else if (!_.isEmpty(bundleStats.children)) { | ||
} else if (bundleStats.children && bundleStats.children.length > 0) { | ||
// Sometimes if there are additional child chunks produced add them as child assets | ||
@@ -77,3 +83,3 @@ bundleStats.children.forEach(child => { | ||
asset.name = asset.name.replace(FILENAME_QUERY_REGEXP, ''); | ||
return FILENAME_EXTENSIONS.test(asset.name) && !_.isEmpty(asset.chunks) && isAssetIncluded(asset.name); | ||
return FILENAME_EXTENSIONS.test(asset.name) && asset.chunks.length > 0 && isAssetIncluded(asset.name); | ||
}); // Trying to parse bundle assets and get real module sizes if `bundleDir` is provided | ||
@@ -100,7 +106,10 @@ | ||
bundlesSources[statAsset.name] = _.pick(bundleInfo, 'src', 'runtimeSrc'); | ||
bundlesSources[statAsset.name] = { | ||
src: bundleInfo.src, | ||
runtimeSrc: bundleInfo.runtimeSrc | ||
}; | ||
Object.assign(parsedModules, bundleInfo.modules); | ||
} | ||
if (_.isEmpty(bundlesSources)) { | ||
if (Object.keys(bundlesSources).length === 0) { | ||
bundlesSources = null; | ||
@@ -116,7 +125,7 @@ parsedModules = null; | ||
const modules = assetBundles ? getBundleModules(assetBundles) : []; | ||
const asset = result[statAsset.name] = { | ||
size: statAsset.size | ||
}; | ||
const assetSources = bundlesSources && Object.prototype.hasOwnProperty.call(bundlesSources, statAsset.name) ? bundlesSources[statAsset.name] : null; | ||
const asset = result[statAsset.name] = _.pick(statAsset, 'size'); | ||
const assetSources = bundlesSources && _.has(bundlesSources, statAsset.name) ? bundlesSources[statAsset.name] : null; | ||
if (assetSources) { | ||
@@ -151,4 +160,3 @@ asset.parsedSize = Buffer.byteLength(assetSources.src); | ||
// If there are multiple entry points we move all of them under synthetic concatenated module. | ||
_.pullAll(assetModules, unparsedEntryModules); | ||
pullAll(assetModules, unparsedEntryModules); | ||
assetModules.unshift({ | ||
@@ -183,3 +191,3 @@ identifier: './entry modules', | ||
gzipSize: asset.gzipSize, | ||
groups: _.invokeMap(asset.tree.children, 'toChartData'), | ||
groups: invokeMap(asset.tree.children, 'toChartData'), | ||
isInitialByEntrypoint: (_chunkToInitialByEntr = chunkToInitialByEntrypoint[filename]) !== null && _chunkToInitialByEntr !== void 0 ? _chunkToInitialByEntr : {} | ||
@@ -197,8 +205,10 @@ }; | ||
function getChildAssetBundles(bundleStats, assetName) { | ||
return (bundleStats.children || []).find(c => _(c.assetsByChunkName).values().flatten().includes(assetName)); | ||
return flatten((bundleStats.children || []).find(c => Object.values(c.assetsByChunkName))).includes(assetName); | ||
} | ||
function getBundleModules(bundleStats) { | ||
return _(bundleStats.chunks).map('modules').concat(bundleStats.modules).compact().flatten().uniqBy('id') // Filtering out Webpack's runtime modules as they don't have ids and can't be parsed (introduced in Webpack 5) | ||
.reject(isRuntimeModule).value(); | ||
var _bundleStats$chunks; | ||
return uniqBy(flatten((((_bundleStats$chunks = bundleStats.chunks) === null || _bundleStats$chunks === void 0 ? void 0 : _bundleStats$chunks.map(chunk => chunk.modules)) || []).concat(bundleStats.modules).filter(Boolean)), 'id' // Filtering out Webpack's runtime modules as they don't have ids and can't be parsed (introduced in Webpack 5) | ||
).filter(m => !isRuntimeModule(m)); | ||
} | ||
@@ -205,0 +215,0 @@ |
@@ -13,3 +13,3 @@ #! /usr/bin/env node | ||
magenta | ||
} = require('chalk'); | ||
} = require('picocolors'); | ||
@@ -16,0 +16,0 @@ const analyzer = require('../analyzer'); |
@@ -9,3 +9,3 @@ "use strict"; | ||
bold | ||
} = require('chalk'); | ||
} = require('picocolors'); | ||
@@ -12,0 +12,0 @@ const Logger = require('./Logger'); |
@@ -5,4 +5,2 @@ "use strict"; | ||
const _ = require('lodash'); | ||
const acorn = require('acorn'); | ||
@@ -120,8 +118,8 @@ | ||
}); | ||
let modules; | ||
const modules = {}; | ||
if (walkState.locations) { | ||
modules = _.mapValues(walkState.locations, loc => content.slice(loc.start, loc.end)); | ||
} else { | ||
modules = {}; | ||
Object.entries(walkState.locations).forEach(([id, loc]) => { | ||
modules[id] = content.slice(loc.start, loc.end); | ||
}); | ||
} | ||
@@ -128,0 +126,0 @@ |
@@ -8,3 +8,3 @@ "use strict"; | ||
const _ = require('lodash'); | ||
const escape = require('lodash.escape'); | ||
@@ -38,6 +38,6 @@ const projectRoot = path.resolve(__dirname, '..'); | ||
if (mode === 'static') { | ||
return `<!-- ${_.escape(filename)} --> | ||
return `<!-- ${escape(filename)} --> | ||
<script>${getAssetContent(filename)}</script>`; | ||
} else { | ||
return `<script src="${_.escape(filename)}"></script>`; | ||
return `<script src="${escape(filename)}"></script>`; | ||
} | ||
@@ -59,3 +59,3 @@ } | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<title>${_.escape(title)}</title> | ||
<title>${escape(title)}</title> | ||
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX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TnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" /> | ||
@@ -62,0 +62,0 @@ |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _lodash = _interopRequireDefault(require("lodash")); | ||
var _lodash = _interopRequireDefault(require("lodash.invokemap")); | ||
@@ -22,3 +22,3 @@ var _Node = _interopRequireDefault(require("./Node")); | ||
get src() { | ||
if (!_lodash.default.has(this, '_src')) { | ||
if (!Object.prototype.hasOwnProperty.call(this, '_src')) { | ||
this._src = this.walk((node, src) => src += node.src || '', '', false); | ||
@@ -31,3 +31,3 @@ } | ||
get size() { | ||
if (!_lodash.default.has(this, '_size')) { | ||
if (!Object.prototype.hasOwnProperty.call(this, '_size')) { | ||
this._size = this.walk((node, size) => size + node.size, 0, false); | ||
@@ -123,3 +123,3 @@ } | ||
statSize: this.size, | ||
groups: _lodash.default.invokeMap(this.children, 'toChartData') | ||
groups: (0, _lodash.default)(this.children, 'toChartData') | ||
}; | ||
@@ -126,0 +126,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _lodash = _interopRequireDefault(require("lodash")); | ||
var _lodash = _interopRequireDefault(require("lodash.invokemap")); | ||
@@ -60,3 +60,3 @@ var _Module = _interopRequireDefault(require("./Module")); | ||
const [folders, fileName] = [pathParts.slice(0, -1), _lodash.default.last(pathParts)]; | ||
const [folders, fileName] = [pathParts.slice(0, -1), pathParts[pathParts.length - 1]]; | ||
let currentFolder = this; | ||
@@ -93,3 +93,3 @@ folders.forEach(folderName => { | ||
mergeNestedFolders() { | ||
_lodash.default.invokeMap(this.children, 'mergeNestedFolders'); | ||
(0, _lodash.default)(this.children, 'mergeNestedFolders'); | ||
} | ||
@@ -100,3 +100,3 @@ | ||
concatenated: true, | ||
groups: _lodash.default.invokeMap(this.children, 'toChartData') | ||
groups: (0, _lodash.default)(this.children, 'toChartData') | ||
}; | ||
@@ -103,0 +103,0 @@ } |
@@ -8,4 +8,2 @@ "use strict"; | ||
var _lodash = _interopRequireDefault(require("lodash")); | ||
var _gzipSize = _interopRequireDefault(require("gzip-size")); | ||
@@ -29,3 +27,3 @@ | ||
get gzipSize() { | ||
if (!_lodash.default.has(this, '_gzipSize')) { | ||
if (!Object.prototype.hasOwnProperty.call(this, '_gzipSize')) { | ||
this._gzipSize = this.src ? _gzipSize.default.sync(this.src) : 0; | ||
@@ -44,3 +42,3 @@ } | ||
const [folders, fileName] = [pathParts.slice(0, -1), _lodash.default.last(pathParts)]; | ||
const [folders, fileName] = [pathParts.slice(0, -1), pathParts[pathParts.length - 1]]; | ||
let currentFolder = this; | ||
@@ -47,0 +45,0 @@ folders.forEach(folderName => { |
@@ -8,4 +8,2 @@ "use strict"; | ||
var _lodash = _interopRequireDefault(require("lodash")); | ||
var _gzipSize = _interopRequireDefault(require("gzip-size")); | ||
@@ -53,3 +51,3 @@ | ||
getGzipSize() { | ||
if (!_lodash.default.has(this, '_gzipSize')) { | ||
if (!('_gzipSize' in this)) { | ||
this._gzipSize = this.src ? _gzipSize.default.sync(this.src) : undefined; | ||
@@ -56,0 +54,0 @@ } |
@@ -7,7 +7,2 @@ "use strict"; | ||
exports.getModulePathParts = getModulePathParts; | ||
var _lodash = _interopRequireDefault(require("lodash")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const MULTI_MODULE_REGEXP = /^multi /u; | ||
@@ -20,9 +15,9 @@ | ||
const parsedPath = _lodash.default // Removing loaders from module path: they're joined by `!` and the last part is a raw module path | ||
.last(moduleData.name.split('!')) // Splitting module path into parts | ||
const loaders = moduleData.name.split('!'); // Removing loaders from module path: they're joined by `!` and the last part is a raw module path | ||
const parsedPath = loaders[loaders.length - 1] // Splitting module path into parts | ||
.split('/') // Removing first `.` | ||
.slice(1) // Replacing `~` with `node_modules` | ||
.map(part => part === '~' ? 'node_modules' : part); | ||
return parsedPath.length ? parsedPath : null; | ||
} |
@@ -8,4 +8,2 @@ "use strict"; | ||
const _ = require('lodash'); | ||
const opener = require('opener'); | ||
@@ -17,3 +15,3 @@ | ||
function createAssetsFilter(excludePatterns) { | ||
const excludeFunctions = _(excludePatterns).castArray().compact().map(pattern => { | ||
const excludeFunctions = (Array.isArray(excludePatterns) ? excludePatterns : [excludePatterns]).filter(Boolean).map(pattern => { | ||
if (typeof pattern === 'string') { | ||
@@ -34,3 +32,3 @@ pattern = new RegExp(pattern, 'u'); | ||
return pattern; | ||
}).value(); | ||
}); | ||
@@ -37,0 +35,0 @@ if (excludeFunctions.length) { |
@@ -13,7 +13,9 @@ "use strict"; | ||
const _ = require('lodash'); | ||
const { | ||
isPlainObject | ||
} = require('is-plain-object'); | ||
const { | ||
bold | ||
} = require('chalk'); | ||
} = require('picocolors'); | ||
@@ -207,3 +209,3 @@ const Logger = require('./Logger'); | ||
if (_.isPlainObject(chartData) && _.isEmpty(chartData)) { | ||
if (isPlainObject(chartData) && Object.keys(chartData).length === 0) { | ||
logger.error("Could't find any javascript bundles in provided stats file"); | ||
@@ -210,0 +212,0 @@ chartData = null; |
{ | ||
"name": "webpack-bundle-analyzer", | ||
"version": "4.9.0", | ||
"version": "4.9.1", | ||
"description": "Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap", | ||
@@ -38,8 +38,15 @@ "author": "Yury Grunin <grunin.ya@ya.ru>", | ||
"acorn-walk": "^8.0.0", | ||
"chalk": "^4.1.0", | ||
"commander": "^7.2.0", | ||
"escape-string-regexp": "^4.0.0", | ||
"gzip-size": "^6.0.0", | ||
"lodash": "^4.17.20", | ||
"is-plain-object": "^5.0.0", | ||
"lodash.debounce": "^4.0.8", | ||
"lodash.escape": "^4.0.1", | ||
"lodash.flatten": "^4.4.0", | ||
"lodash.invokemap": "^4.6.0", | ||
"lodash.pullall": "^4.2.0", | ||
"lodash.uniqby": "^4.7.0", | ||
"opener": "^1.5.2", | ||
"sirv": "^1.0.7", | ||
"picocolors": "^1.0.0", | ||
"sirv": "^2.0.3", | ||
"ws": "^7.3.1" | ||
@@ -76,2 +83,5 @@ }, | ||
"jest": "27.2.2", | ||
"lodash.memoize": "^4.1.2", | ||
"lodash.merge": "^4.6.2", | ||
"lodash.partial": "^4.2.1", | ||
"mobx": "5.15.7", | ||
@@ -78,0 +88,0 @@ "mobx-react": "6.3.1", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2563
1270247
17
45
+ Addedescape-string-regexp@^4.0.0
+ Addedis-plain-object@^5.0.0
+ Addedlodash.debounce@^4.0.8
+ Addedlodash.escape@^4.0.1
+ Addedlodash.flatten@^4.4.0
+ Addedlodash.invokemap@^4.6.0
+ Addedlodash.pullall@^4.2.0
+ Addedlodash.uniqby@^4.7.0
+ Addedpicocolors@^1.0.0
+ Addedescape-string-regexp@4.0.0(transitive)
+ Addedis-plain-object@5.0.0(transitive)
+ Addedlodash.debounce@4.0.8(transitive)
+ Addedlodash.escape@4.0.1(transitive)
+ Addedlodash.flatten@4.4.0(transitive)
+ Addedlodash.invokemap@4.6.0(transitive)
+ Addedlodash.pullall@4.2.0(transitive)
+ Addedlodash.uniqby@4.7.0(transitive)
+ Addedmrmime@2.0.0(transitive)
+ Addedpicocolors@1.1.0(transitive)
+ Addedsirv@2.0.4(transitive)
+ Addedtotalist@3.0.1(transitive)
- Removedchalk@^4.1.0
- Removedlodash@^4.17.20
- Removedansi-styles@4.3.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedmrmime@1.0.1(transitive)
- Removedsirv@1.0.19(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedtotalist@1.1.0(transitive)
Updatedsirv@^2.0.3