Skip to content

Commit

Permalink
Merge pull request #11 from umijs/merge/webpack-contrib-master
Browse files Browse the repository at this point in the history
Merge/webpack contrib master
  • Loading branch information
RaoHai authored Jul 14, 2020
2 parents 800a730 + 9b28cb7 commit 66ea477
Show file tree
Hide file tree
Showing 28 changed files with 5,148 additions and 4,516 deletions.
16 changes: 11 additions & 5 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
...

#### Technical info
* Webpack Bundle Analyzer version:
* Webpack version:
* Node.js version:
* npm/yarn version:
* OS:

<!--
Please include the output of running the command below:
npx envinfo --system --binaries --npmPackages=*webpack* --npmGlobalPackages=webpack-bundle-analyzer
-->

<pre>
REPLACE THIS TEXT WITH THE OUTPUT FROM THE COMMAND ABOVE
</pre>

#### Debug info
How do you use this module? As CLI utility or as plugin?
Expand Down
8 changes: 8 additions & 0 deletions .npm-upgrade.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ignore": {
"terser-webpack-plugin": {
"versions": ">= 2",
"reason": "v2 requires at least Node v8.9.0"
}
}
}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ branches:
node_js:
- "8"
- "10"
- "12"
- "node"
addons:
apt:
Expand Down
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,47 @@ _Note: Gaps between patch versions are faulty, broken or test releases._

<!-- Add changelog entries for new changes under this section -->

* **New Feature**
* Adds option reportTitle to set title in HTML reports; default remains date of report generation ([#354](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/354)) by [@eoingroat](https://github.com/eoingroat)

## 3.8.0

* **Improvement**
* Added support for exports.modules when webpack target = node ([#345](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/345) by [@Spikef](https://github.com/Spikef))

* **New Feature**
* Support [WebWorkerChunkTemplatePlugin](https://github.com/webpack/webpack/blob/c9d4ff7b054fc581c96ce0e53432d44f9dd8ca72/lib/webworker/WebWorkerChunkTemplatePlugin.js) ([#353](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/353) by [@Gongreg](https://github.com/Gongreg))

* **Bug Fix**
* Support any custom `globalObject` option in Webpack Config. ([#352](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/352) by [@Gongreg](https://github.com/Gongreg))

## 3.7.0

* **New Feature**
* Added JSON output option (`analyzerMode: "json"` in plugin, `--mode json` in CLI) ([#341](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/341) by [@Gongreg](https://github.com/Gongreg))

* **Improvement**
* Persist "Show content of concatenated modules" option ([#322](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/322) by [@lorenzos](https://github.com/lorenzos))

## 3.6.1

* **Bug Fix**
* Add leading zero to hour & minute on `<title />` when needed ([#314](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/314) by [@mhxbe](https://github.com/mhxbe))

* **Internal**
* Update some dependencies to get rid of vulnerability warnings ([#339](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/339))

## 3.6.0

* **Improvement**
* 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))
* Improve readability of tooltips ([#320](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/320) by [@lorenzos](https://github.com/lorenzos))

## 3.5.2

* **Bug Fix**
* 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))

## 3.5.1

* **Bug Fix**
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ new BundleAnalyzerPlugin(options?: object)

|Name|Type|Description|
|:--:|:--:|:----------|
|**`analyzerMode`**|One of: `server`, `static`, `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 `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`. |
|**`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`. |
|**`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.|
|**`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).|
|**`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.|
|**`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.|
|**`openAnalyzer`**|`{Boolean}`|Default: `true`. Automatically open report in default browser.|
|**`generateStatsFile`**|`{Boolean}`|Default: `false`. If `true`, webpack stats JSON file will be generated in bundle output directory|
Expand Down Expand Up @@ -114,12 +115,14 @@ Directory containing all generated bundles.

```
-V, --version output the version number
-m, --mode <mode> Analyzer mode. Should be `server` or `static`.
-m, --mode <mode> Analyzer mode. Should be `server`, `static` or `json`.
In `server` mode analyzer will start HTTP server to show bundle report.
In `static` mode single HTML file with bundle report will be generated. (default: server)
In `static` mode single HTML file with bundle report will be generated.
In `json` mode single JSON file with bundle report will be generated. (default: server)
-h, --host <host> Host that will be used in `server` mode to start HTTP server. (default: 127.0.0.1)
-p, --port <n> Port that will be used in `server` mode to start HTTP server. Should be a number or `auto` (default: 8888)
-r, --report <file> Path to bundle report file that will be generated in `static` mode. (default: report.html)
-t, --title <title> String to use in title element of html report. (default: pretty printed current date)
-s, --default-sizes <type> Module sizes to show in treemap by default.
Possible values: stat, parsed, gzip (default: parsed)
-O, --no-open Don't open report in default browser automatically.
Expand Down
2 changes: 2 additions & 0 deletions client/components/CheckboxList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default class CheckboxList extends PureComponent {
this.setState({checkedItems});
this.informAboutChange(checkedItems);
}
} else if (newProps.checkedItems !== this.props.checkedItems) {
this.setState({checkedItems: newProps.checkedItems});
}
}

Expand Down
6 changes: 6 additions & 0 deletions client/components/ModulesTreemap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {computed} from 'mobx';
import {observer} from 'mobx-preact';

import {isChunkParsed} from '../utils';
import localStorage from '../localStorage';
import Treemap from './Treemap';
import Tooltip from './Tooltip';
import Switcher from './Switcher';
Expand Down Expand Up @@ -208,6 +209,11 @@ export default class ModulesTreemap extends Component {

handleConcatenatedModulesContentToggle = flag => {
store.showConcatenatedModulesContent = flag;
if (flag) {
localStorage.setItem('showConcatenatedModulesContent', true);
} else {
localStorage.removeItem('showConcatenatedModulesContent');
}
}

handleChunkContextMenuHide = () => {
Expand Down
2 changes: 1 addition & 1 deletion client/components/Tooltip.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
border-radius: 4px;
background: #fff;
border: 1px solid #aaa;
opacity: 0.7;
opacity: 0.9;
white-space: nowrap;
visibility: visible;
transition: opacity .2s ease, visibility .2s ease;
Expand Down
25 changes: 25 additions & 0 deletions client/localStorage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const KEY_PREFIX = 'wba';

export default {

getItem(key) {
try {
return JSON.parse(window.localStorage.getItem(`${KEY_PREFIX}.${key}`));
} catch (err) {
return null;
}
},

setItem(key, value) {
try {
window.localStorage.setItem(`${KEY_PREFIX}.${key}`, JSON.stringify(value));
} catch (err) { /* ignored */ }
},

removeItem(key) {
try {
window.localStorage.removeItem(`${KEY_PREFIX}.${key}`);
} catch (err) { /* ignored */ }
}

};
3 changes: 2 additions & 1 deletion client/store.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {observable, computed} from 'mobx';
import {isChunkParsed, walkModules} from './utils';
import localStorage from './localStorage';

export class Store {
cid = 0;
Expand All @@ -10,7 +11,7 @@ export class Store {
@observable searchQuery = '';
@observable defaultSize;
@observable selectedSize;
@observable showConcatenatedModulesContent = false;
@observable showConcatenatedModulesContent = (localStorage.getItem('showConcatenatedModulesContent') === true);

setModules(modules) {
walkModules(modules, module => {
Expand Down
2 changes: 1 addition & 1 deletion client/viewer.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root {
--main-font: normal 11px Verdana;
--main-font: normal 11px Verdana, sans-serif;
}

:global html,
Expand Down
Loading

0 comments on commit 66ea477

Please sign in to comment.