Socket
Socket
Sign inDemoInstall

webpack-bundle-analyzer

Package Overview
Dependencies
Maintainers
4
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-bundle-analyzer - npm Package Compare versions

Comparing version 4.7.0 to 4.8.0

9

CHANGELOG.md

@@ -15,2 +15,11 @@ # Changelog

## 4.8.0
* **Improvement**
* Support reading large (>500MB) stats.json files ([#423](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/423) by [@henry-alakazhang](https://github.com/henry-alakazhang))
* Improve search UX by graying out non-matches ([#554](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/554) by [@starpit](https://github.com/starpit))
* **Internal**
* Add Node.js v16.x to CI and update GitHub actions ([#539](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/539) by [@amareshsm](https://github.com/amareshsm))
## 4.7.0

@@ -17,0 +26,0 @@

8

lib/analyzer.js

@@ -11,2 +11,6 @@ "use strict";

const {
parseChunked
} = require('@discoveryjs/json-ext');
const Logger = require('./Logger');

@@ -180,3 +184,5 @@

function readStatsFromFile(filename) {
return JSON.parse(fs.readFileSync(filename, 'utf8'));
return parseChunked(fs.createReadStream(filename, {
encoding: 'utf8'
}));
}

@@ -183,0 +189,0 @@

76

lib/bin/analyzer.js

@@ -67,41 +67,43 @@ #! /usr/bin/env node

if (!bundleDir) bundleDir = dirname(bundleStatsFile);
let bundleStats;
parseAndAnalyse(bundleStatsFile);
try {
bundleStats = analyzer.readStatsFromFile(bundleStatsFile);
} catch (err) {
logger.error(`Couldn't read webpack bundle stats from "${bundleStatsFile}":\n${err}`);
logger.debug(err.stack);
process.exit(1);
}
async function parseAndAnalyse(bundleStatsFile) {
try {
const bundleStats = await analyzer.readStatsFromFile(bundleStatsFile);
if (mode === 'server') {
viewer.startServer(bundleStats, {
openBrowser,
port,
host,
defaultSizes,
reportTitle,
bundleDir,
excludeAssets,
logger: new Logger(logLevel),
analyzerUrl: utils.defaultAnalyzerUrl
});
} else if (mode === 'static') {
viewer.generateReport(bundleStats, {
openBrowser,
reportFilename: resolve(reportFilename || 'report.html'),
reportTitle,
defaultSizes,
bundleDir,
excludeAssets,
logger: new Logger(logLevel)
});
} else if (mode === 'json') {
viewer.generateJSONReport(bundleStats, {
reportFilename: resolve(reportFilename || 'report.json'),
bundleDir,
excludeAssets,
logger: new Logger(logLevel)
});
if (mode === 'server') {
viewer.startServer(bundleStats, {
openBrowser,
port,
host,
defaultSizes,
reportTitle,
bundleDir,
excludeAssets,
logger: new Logger(logLevel),
analyzerUrl: utils.defaultAnalyzerUrl
});
} else if (mode === 'static') {
viewer.generateReport(bundleStats, {
openBrowser,
reportFilename: resolve(reportFilename || 'report.html'),
reportTitle,
defaultSizes,
bundleDir,
excludeAssets,
logger: new Logger(logLevel)
});
} else if (mode === 'json') {
viewer.generateJSONReport(bundleStats, {
reportFilename: resolve(reportFilename || 'report.json'),
bundleDir,
excludeAssets,
logger: new Logger(logLevel)
});
}
} catch (err) {
logger.error(`Couldn't read webpack bundle stats from "${bundleStatsFile}":\n${err}`);
logger.debug(err.stack);
process.exit(1);
}
}

@@ -108,0 +110,0 @@

{
"name": "webpack-bundle-analyzer",
"version": "4.7.0",
"version": "4.8.0",
"description": "Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap",

@@ -35,2 +35,3 @@ "author": "Yury Grunin <grunin.ya@ya.ru>",

"dependencies": {
"@discoveryjs/json-ext": "0.5.7",
"acorn": "^8.0.4",

@@ -88,3 +89,3 @@ "acorn-walk": "^8.0.0",

"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.2"
"webpack-dev-server": "3.11.3"
},

@@ -91,0 +92,0 @@ "keywords": [

@@ -60,3 +60,3 @@ [![npm][npm]][npm-url]

|**`analyzerHost`**|`{String}`|Default: `127.0.0.1`. Host that will be used in `server` mode to start HTTP server.|
|**`analyzerPort`**|`{Number}` or `auto`|Default: `8888`. Port that will be used in `server` mode to start HTTP server.|
|**`analyzerPort`**|`{Number}` or `auto`|Default: `8888`. Port that will be used in `server` mode to start HTTP server. If `analyzerPort` is `auto`, the operating system will assign an arbitrary unused port |
|**`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.|

@@ -63,0 +63,0 @@ |**`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).|

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc