Skip to content

Commit e2a6479

Browse files
authored
Reduce installation size (#609)
* Replace `chalk` with `picocolors` * Replace `lodash` with individual modules * Fix Node.js 10 compatability * Replace `lodash.escaperegexp` with `escape-string-regexp` * Add missing comment back * Update Changelog
1 parent e120231 commit e2a6479

File tree

13 files changed

+232
-62
lines changed

13 files changed

+232
-62
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ _Note: Gaps between patch versions are faulty, broken or test releases._
1414

1515
* **Internal**
1616
* 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).
17+
* Make module much slimmer ([#609](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/609)) by [@sukkaw](https://github.com/sukkaw).
1718

1819
## 4.9.0
1920

client/components/ModuleItem.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import _ from 'lodash';
1+
import escapeRegExp from 'escape-string-regexp';
2+
import escape from 'lodash.escape';
23
import filesize from 'filesize';
34
import cls from 'classnames';
45

@@ -47,7 +48,7 @@ export default class ModuleItem extends PureComponent {
4748
if (term) {
4849
const regexp = (term instanceof RegExp) ?
4950
new RegExp(term.source, 'igu') :
50-
new RegExp(`(?:${_.escapeRegExp(term)})+`, 'iu');
51+
new RegExp(`(?:${escapeRegExp(term)})+`, 'iu');
5152
let match;
5253
let lastMatch;
5354

@@ -58,15 +59,15 @@ export default class ModuleItem extends PureComponent {
5859

5960
if (lastMatch) {
6061
html = (
61-
_.escape(title.slice(0, lastMatch.index)) +
62-
`<strong>${_.escape(lastMatch[0])}</strong>` +
63-
_.escape(title.slice(lastMatch.index + lastMatch[0].length))
62+
escape(title.slice(0, lastMatch.index)) +
63+
`<strong>${escape(lastMatch[0])}</strong>` +
64+
escape(title.slice(lastMatch.index + lastMatch[0].length))
6465
);
6566
}
6667
}
6768

6869
if (!html) {
69-
html = _.escape(title);
70+
html = escape(title);
7071
}
7172

7273
return html;

client/components/Search.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import _ from 'lodash';
1+
import debounce from 'lodash.debounce';
22

33
import s from './Search.css';
44
import Button from './Button';
@@ -39,7 +39,7 @@ export default class Search extends PureComponent {
3939
);
4040
}
4141

42-
handleValueChange = _.debounce((event) => {
42+
handleValueChange = debounce((event) => {
4343
this.informChange(event.target.value);
4444
}, 400)
4545

0 commit comments

Comments
 (0)