Skip to content

Commit

Permalink
Merge pull request #12 from umijs/webpack-contrib/master
Browse files Browse the repository at this point in the history
Webpack contrib/master
  • Loading branch information
sorrycc authored Mar 11, 2021
2 parents 66ea477 + b257267 commit dd047f8
Show file tree
Hide file tree
Showing 81 changed files with 19,670 additions and 6,129 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"presets": [
["@babel/preset-env", {
"targets": {"node": "6.14.4"}
"targets": {"node": "10.13.0"}
}]
],
"plugins": [
Expand Down
3 changes: 0 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ node_modules
lib
public

# Vendor code
client/vendor

# Test fixtures
test/bundles
test/stats
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: main
on:
push:
branches:
- master
pull_request:
jobs:
build-and-test:
strategy:
matrix:
node:
- '10'
- '12'
- '14'
runs-on: ubuntu-latest
name: Tests on Node.js v${{ matrix.node }}
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Download deps
uses: bahmutov/npm-install@v1

- name: Build sources
run: npm run build

- name: Run tests with xvfb available
uses: GabrielBB/xvfb-action@v1
with:
run: npm run test

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '14.x'

- name: Download deps
uses: bahmutov/npm-install@v1

- name: Run lint
run: npm run lint
14 changes: 11 additions & 3 deletions .npm-upgrade.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{
"ignore": {
"terser-webpack-plugin": {
"versions": ">= 2",
"reason": "v2 requires at least Node v8.9.0"
"mobx": {
"versions": ">=6",
"reason": "v6 drops decorators"
},
"mobx-react": {
"versions": ">=7",
"reason": "v7 requires MobX v6"
},
"webpack-cli": {
"versions": ">=4",
"reason": "Current version of Webpack Dev Server doesn't work with v4"
}
}
}
61 changes: 58 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,65 @@ _Note: Gaps between patch versions are faulty, broken or test releases._

## UNRELEASED

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

* **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)
* **Improvement**
* Keep treemap labels visible during zooming animations for better user experience ([#414](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/414) by [@
stanislawosinski](https://github.com/stanislawosinski))

* **Bug Fix**
* Don't show an empty tooltip when hovering over the FoamTree attribution group or between top-level groups ([#413](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/413) by [@
stanislawosinski](https://github.com/stanislawosinski))

* **Internal**
* Upgrade FoamTree to version 3.5.0, replace vendor dependency with an NPM package ([#412](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/412) by [@
stanislawosinski](https://github.com/stanislawosinski))

## 4.3.0

* **Improvement**
* Replace express with builtin node server, reducing number of dependencies ([#398](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/398) by [@TrySound](https://github.com/TrySound))
* Move `filesize` to dev dependencies, reducing number of dependencies ([#401](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/401) by [@realityking](https://github.com/realityking))

* **Internal**
* Replace Travis with GitHub actions ([#402](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/402) by [@valscion](https://github.com/valscion))

## 4.2.0

* **Improvement**
* A number of improvements to reduce the number of dependencies ([#391](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/391), [#396](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/396), [#397](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/397))

* **Bug Fix**
* Prevent crashes for bundles generated from webpack array configs. ([#394](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/394) by [@ctavan](https://github.com/ctavan))
* Fix `non-asset` assets causing analyze failure. ([#385](https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/385) by [@ZKHelloworld](https://github.com/ZKHelloworld))

## 4.1.0

* **Improvement**
* Significantly speed up generation of `stats.json` file (see `generateStatsFile` option).

## 4.0.0

* **Breaking change**
* Dropped support for Node.js 6 and 8. Minimal required version now is v10.13.0

* **Improvement**
* Support for Webpack 5

* **Bug Fix**
* Prevent crashes when `openAnalyzer` was set to true in environments where there's no program to handle opening. ([#382](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/382) by [@wbobeirne](https://github.com/wbobeirne))

* **Internal**
* Updated dependencies
* Added support for multiple Webpack versions in tests

## 3.9.0

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

* **Improvement**
* Added capability to parse bundles that have child assets generated ([#376](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/376) by [@masterkidan](https://github.com/masterkidan) and [#378](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/378) by [@https://github.com/dabbott](https://github.com/https://github.com/dabbott))

## 3.8.0

Expand Down
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,32 @@ It happens when `umi-webpack-bundle-analyzer` analyzes files that don't actually
Couldn't parse bundle asset "your_bundle_name.bundle.js".
Analyzer will use module sizes from stats file.
```
To get more information about it you can read [issue #147](https://github.com/webpack-contrib/umi-webpack-bundle-analyzer/issues/147).
To get more information about it you can read [issue #147](https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/147).

<h2 align="center">Other tools</h2>

- [Statoscope](https://github.com/smelukov/statoscope/blob/master/packages/ui-webpack/README.md) - Webpack bundle analyzing tool to find out why a certain module was bundled (and more features, including interactive treemap)

<h2 align="center">Maintainers</h2>

<table>
<tbody>
<tr>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/302213?v=4&s=150">
</br>
<a href="https://github.com/th0r">Yuriy Grunin</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://avatars3.githubusercontent.com/u/482561?v=4&s=150">
</br>
<a href="https://github.com/valscion">Vesa Laakso</a>
</td>
</tr>
<tbody>
</table>


[npm]: https://img.shields.io/npm/v/umi-webpack-bundle-analyzer.svg
Expand Down
3 changes: 3 additions & 0 deletions bin/install-test-webpack-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

for dir in "$(dirname "$0")"/../test/webpack-versions/*; do (cd "$dir" && npm i); done
3 changes: 2 additions & 1 deletion client/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"rules": {
"react/jsx-key": "off",
"react/jsx-no-bind": "off"
"react/jsx-no-bind": "off",
"react/react-in-jsx-scope": "off"
}
}
2 changes: 0 additions & 2 deletions client/components/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/** @jsx h */
import {h} from 'preact';
import cls from 'classnames';
import s from './Button.css';
import PureComponent from '../lib/PureComponent';
Expand Down
3 changes: 1 addition & 2 deletions client/components/Checkbox.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @jsx h */
import {h, Component} from 'preact';
import {Component} from 'preact';
import cls from 'classnames';

import s from './Checkbox.css';
Expand Down
3 changes: 0 additions & 3 deletions client/components/CheckboxList.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/** @jsx h */
import {h} from 'preact';

import CheckboxListItem from './CheckboxListItem';
import s from './CheckboxList.css';
import PureComponent from '../lib/PureComponent';
Expand Down
7 changes: 3 additions & 4 deletions client/components/CheckboxListItem.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @jsx h */
import {h, Component} from 'preact';
import {Component} from 'preact';

import Checkbox from './Checkbox';
import CheckboxList from './CheckboxList';
Expand All @@ -21,8 +20,8 @@ export default class CheckboxListItem extends Component {
renderLabel() {
const {children, item} = this.props;

if (children && children.length) {
return children[0](item);
if (children) {
return children(item);
}

return (item === CheckboxList.ALL_ITEM) ? 'All' : item.label;
Expand Down
2 changes: 0 additions & 2 deletions client/components/ContextMenu.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/** @jsx h */
import {h} from 'preact';
import cls from 'classnames';
import ContextMenuItem from './ContextMenuItem';
import PureComponent from '../lib/PureComponent';
Expand Down
2 changes: 0 additions & 2 deletions client/components/ContextMenuItem.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/** @jsx h */
import {h} from 'preact';
import cls from 'classnames';
import s from './ContextMenuItem.css';

Expand Down
9 changes: 5 additions & 4 deletions client/components/Icon.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/** @jsx h */
import {h} from 'preact';
import cls from 'classnames';
import s from './Icon.css';
import PureComponent from '../lib/PureComponent';

import iconArrowRight from '../assets/icon-arrow-right.svg';
import iconPin from '../assets/icon-pin.svg';

const ICONS = {
'arrow-right': {
src: require('../assets/icon-arrow-right.svg'),
src: iconArrowRight,
size: [7, 13]
},
'pin': {
src: require('../assets/icon-pin.svg'),
src: iconPin,
size: [12, 18]
}
};
Expand Down
2 changes: 0 additions & 2 deletions client/components/ModuleItem.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/** @jsx h */
import _ from 'lodash';
import {h} from 'preact';
import filesize from 'filesize';
import cls from 'classnames';

Expand Down
2 changes: 0 additions & 2 deletions client/components/ModulesList.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/** @jsx h */
import {h} from 'preact';
import cls from 'classnames';
import s from './ModulesList.css';
import ModuleItem from './ModuleItem';
Expand Down
5 changes: 2 additions & 3 deletions client/components/ModulesTreemap.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/** @jsx h */
import {h, Component} from 'preact';
import {Component} from 'preact';
import filesize from 'filesize';
import {computed} from 'mobx';
import {observer} from 'mobx-preact';
import {observer} from 'mobx-react';

import {isChunkParsed} from '../utils';
import localStorage from '../localStorage';
Expand Down
2 changes: 0 additions & 2 deletions client/components/Search.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/** @jsx h */
import {h} from 'preact';
import _ from 'lodash';

import s from './Search.css';
Expand Down
3 changes: 1 addition & 2 deletions client/components/Sidebar.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @jsx h */
import {h, Component} from 'preact';
import {Component} from 'preact';
import cls from 'classnames';

import s from './Sidebar.css';
Expand Down
3 changes: 0 additions & 3 deletions client/components/Switcher.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/** @jsx h */
import {h} from 'preact';

import SwitcherItem from './SwitcherItem';
import s from './Switcher.css';
import PureComponent from '../lib/PureComponent';
Expand Down
3 changes: 0 additions & 3 deletions client/components/SwitcherItem.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/** @jsx h */
import {h} from 'preact';

import Button from './Button';
import PureComponent from '../lib/PureComponent';

Expand Down
3 changes: 1 addition & 2 deletions client/components/Tooltip.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @jsx h */
import {h, Component} from 'preact';
import {Component} from 'preact';
import cls from 'classnames';

import s from './Tooltip.css';
Expand Down
13 changes: 8 additions & 5 deletions client/components/Treemap.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/** @jsx h */
import {h, Component} from 'preact';
import FoamTree from 'carrotsearch.foamtree';
import {Component} from 'preact';
import FoamTree from '@carrotsearch/foamtree';

export default class Treemap extends Component {

Expand Down Expand Up @@ -63,6 +62,7 @@ export default class Treemap extends Component {
maxGroupLevelsDrawn: Infinity,
maxGroupLabelLevelsDrawn: Infinity,
maxGroupLevelsAttached: Infinity,
wireframeLabelDrawing: 'always',
groupMinDiameter: 0,
groupLabelVerticalPadding: 0.2,
rolloutDuration: 0,
Expand Down Expand Up @@ -112,9 +112,12 @@ export default class Treemap extends Component {
},
onGroupDoubleClick: preventDefault,
onGroupHover(event) {
// Ignoring hovering on `FoamTree` branding group
if (event.group && event.group.attribution) {
// Ignoring hovering on `FoamTree` branding group and the root group
if (event.group && (event.group.attribution || event.group === this.get('dataObject'))) {
event.preventDefault();
if (props.onMouseLeave) {
props.onMouseLeave.call(component, event);
}
return;
}

Expand Down
3 changes: 1 addition & 2 deletions client/lib/PureComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @jsx h */
import {h, Component} from 'preact';
import {Component} from 'preact';

export default class PureComponent extends Component {
shouldComponentUpdate(nextProps, nextState) {
Expand Down
Loading

0 comments on commit dd047f8

Please sign in to comment.