Skip to content

Commit 5f9fd20

Browse files
hello-lizhihuaaladdin-add
authored andcommitted
update master (#377)
* docs(api): minor fix in cli Make minor fix in the CLI documentation to reflect this comment: webpack#1577 (comment) * docs(plugins): clarify and simplify `SourceMapDevToolPlugin` docs (#1581) Try to resolve the confusion from #1556. Also update the options section to clean things up a bit both for readability and grammar. Resolves #1556 * docs(guides): update "external limitations" example in author-libraries (#1583) * docs(plugins): update commons-chunk-plugin.md (#1560) Changed example to declare the plugin within `plugins` property. * docs(guides): rewrite shimming (#1579) Rewrite the main sections of the guide to synchronize it with the other core guides. Briefly mention the other utilities that don't require full on examples (details can be found via links). Closes #1258 * docs(guides): fix small issues in shimming (#1591) * docs(guides): fix entry path in typescript (#1592) * docs(guides): fix typos in production (#1584) * fix(sponsors): update to reflect opencollective change (#1588) OpenCollective's structure changed a bit. This address that and makes a few other notable changes: - add additional sponsors - allow to merge additional sponsors to existing sponsors - limit width of logos to 3 x height to disallow very wide logos - format money values with commas * docs(config): update configuration-languages (#1590) Remove local type def from TypeScript snippet. The @types/node type definition module already declares `__dirname` type: https://git.io/v5Dr9 * docs(guides): update hot-module-replacement (#1539) Add an example to demonstrate using hot module replacement with `webpack-dev-server`'s Node.js API instead of within a normal configuration file. * docs(guides): update development.md (#1586) The article was missing references to `clean-webpack-plugin` in the `webpack.config.js` file and `package.json` files. * docs(guides): update tree-shaking.md (#1589) As a conclusion, I thought it would be a good idea to show case a high-level explanation of why it's called tree shaking. Once the user reads the guide and ends up with a high-level explanation the word tree shaking will stick to the user's head. * docs(guides): update code-splitting (#1585) Suggest solutions to the problem right away seems to be a better approach. Use similar text as was used here: https://webpack.js.org/api/module-methods/#import- * docs(plugins): update module-concatenation-plugin (#1565) Add more information about optimization bailouts. Attempt to transfer content from the blog post to the official docs. I want to follow up with a PR for better bailout reasons. The hope is that the reasons will match those listed in the table. * docs(api): fix type in compiler.md (#1601) * docs(config): update output.md (#1541) Clarify interactions between `libraryTarget` and `library`. The interactions between the two and how some of the sections were not well explained, in some cases were incorrect, misleading or missing information. * docs(api): add concurrent usage warning in node.md (#1599) * docs(guides): update environment-variables (#1549) Add documentation about setting environment variables in CLI with `--env`. Link to webpack _CLI Environment_ section. Add additional usage to `--env` CLI docs. * Swap ordering of pre/post loaders (#1602) `pre` loaders run at the beginning, `post` loaders run at the end. * docs(sponsors): update segment's donations (#1603) * update contributors
1 parent b7945b4 commit 5f9fd20

27 files changed

+780
-326
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ node_modules
22
npm-debug.log
33
build
44
generated
5-
support-backers.json
6-
support-sponsors.json
5+
support-*.json
76
starter-kits-data.json
87
.antwar
98
.idea

src/components/Splash/Splash.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ const Splash = () => (
2929
<p>通过你的贡献、捐款或者赞助,webpack 将获得繁荣发展。你的捐助直接用于支持我们付出工作、持续改进,最加重要的是有助于我们提供优秀的文档和资料!</p>
3030

3131
<h2>平台赞助</h2>
32-
<Support type="sponsors" rank="platinum" />
32+
<Support rank="platinum" />
3333

3434
<h2>金牌赞助</h2>
35-
<Support type="sponsors" rank="gold" />
35+
<Support rank="gold" />
3636

3737
<h2>银牌赞助</h2>
38-
<Support type="sponsors" rank="silver" />
38+
<Support rank="silver" />
3939

4040
<h2>铜牌赞助</h2>
41-
<Support type="sponsors" rank="bronze" />
41+
<Support rank="bronze" />
4242

4343
<h2>赞助者</h2>
44-
<Support type="backers" />
44+
<Support rank="backer" />
4545
</Container>
4646
</div>
4747
</div>

src/components/Support/Support.jsx

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
import React from 'react';
2-
import Additional from './support-additional.json';
2+
import GoldSponsors from './support-goldsponsors.json';
3+
import SilverSponsors from './support-silversponsors.json';
4+
import Sponsors from './support-sponsors.json';
5+
import Backers from './support-backers.json';
6+
import Additional from './support-additional.js';
37
import './Support.scss';
48

59
const ranks = {
10+
backer: {
11+
maximum: 200
12+
},
613
bronze: {
14+
minimum: 200,
715
maximum: 2000
816
},
917
silver: {
@@ -19,17 +27,37 @@ const ranks = {
1927
}
2028
};
2129

30+
function formatMoney(number) {
31+
let str = Math.round(number) + '';
32+
if (str.length > 3) {
33+
str = str.substr(0, str.length - 3) + ',' + str.substr(-3);
34+
}
35+
return str;
36+
}
37+
2238
export default class Support extends React.Component {
2339
render() {
24-
let { rank, type } = this.props;
25-
let supporters = require(`./support-${type}.json`);
40+
let { rank } = this.props;
41+
let supporters = [
42+
...GoldSponsors,
43+
...SilverSponsors,
44+
...Sponsors,
45+
...Backers,
46+
];
2647

27-
if (type === 'sponsors') {
28-
supporters = supporters.slice();
29-
supporters.push(...Additional);
30-
supporters.sort((a, b) => b.totalDonations - a.totalDonations);
48+
// merge or add additional backers/sponsors
49+
for(const additional of Additional) {
50+
const existing = supporters.find(supporter => supporter.username && supporter.username === additional.username);
51+
if (existing) {
52+
existing.totalDonations += additional.totalDonations;
53+
} else {
54+
supporters.push(additional);
55+
}
3156
}
3257

58+
// resort list
59+
supporters.sort((a, b) => b.totalDonations - a.totalDonations);
60+
3361
let minimum, maximum;
3462

3563
if (rank && ranks[rank]) {
@@ -48,14 +76,14 @@ export default class Support extends React.Component {
4876
return (
4977
<div className="support">
5078
<div className="support__description">
51-
{ type === 'sponsors' ? (
79+
{ rank === 'backer' ? (
5280
<p>
53-
<b className="support__rank">{ rank } sponsors</b>
54-
<span>are those who have pledged { minimum ? `$${minimum}` : 'up' } { maximum ? `to $${maximum}` : 'or more' } to webpack.</span>
81+
The following <b>Backers</b> are individuals who have contributed various amounts of money in order to help support webpack. Every little bit helps, and we appreciate even the smallest contributions.
5582
</p>
5683
) : (
5784
<p>
58-
The following <b>Backers</b> are individuals who have contributed various amounts of money in order to help support webpack. Every little bit helps, and we appreciate even the smallest contributions.
85+
<b className="support__rank">{ rank } sponsors</b>
86+
<span>are those who have pledged { minimum ? `$${formatMoney(minimum)}` : 'up' } { maximum ? `to $${formatMoney(maximum)}` : 'or more' } to webpack.</span>
5987
</p>
6088
)}
6189
</div>
@@ -64,22 +92,22 @@ export default class Support extends React.Component {
6492
supporters.map((supporter, index) => (
6593
<a key={ supporter.id || supporter.username || index }
6694
className="support__item"
67-
title={ `$${supporter.totalDonations / 100} by ${supporter.name || supporter.username}` }
95+
title={ `$${formatMoney(supporter.totalDonations / 100)} by ${supporter.name || supporter.username}` }
6896
target="_blank"
6997
href={ supporter.website || `https://opencollective.com/${supporter.username}` }>
7098
{ supporter.avatar ? <img
71-
className={ `support__${type}-avatar-${rank || 'normal'}` }
99+
className={ `support__${rank}-avatar` }
72100
src={ supporter.avatar }
73101
alt={ supporter.username ? `${supporter.username}'s avatar` : 'avatar' } /> :
74102
supporter.name }
75-
{ type === 'backers' ? <figure className="support__outline" /> : null }
103+
{ rank === 'backer' ? <figure className="support__outline" /> : null }
76104
</a>
77105
))
78106
}
79107

80108
<div className="support__bottom">
81109
<a className="support__button" href="https://opencollective.com/webpack#support">
82-
Become a { type.replace(/s$/, '') }
110+
Become a { rank === 'backer' ? 'backer' : 'sponsor' }
83111
</a>
84112
</div>
85113
</div>

src/components/Support/Support.scss

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,25 @@
2222
margin: 0 2px 2px 2px;
2323
}
2424

25-
&__sponsors-avatar {
26-
&-bronze, &-normal {
27-
height: 32px;
28-
}
29-
&-silver {
30-
height: 64px;
31-
}
32-
&-gold {
33-
height: 96px;
34-
}
35-
&-platinum {
36-
height: 128px;
37-
}
25+
&__bronze-avatar {
26+
height: 32px;
27+
max-width: 96px;
28+
}
29+
30+
&__silver-avatar {
31+
height: 64px;
32+
max-width: 192px;
33+
}
34+
35+
&__gold-avatar {
36+
height: 96px;
37+
}
38+
39+
&__platinum-avatar {
40+
height: 128px;
3841
}
3942

40-
&__backers-avatar-normal {
43+
&__backer-avatar {
4144
width: 31px;
4245
height: 31px;
4346
border-radius: 50%;
17.7 KB
Loading
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export default [
2+
{
3+
name: "MoonMail",
4+
avatar: "https://static.moonmail.io/moonmail-logo.svg",
5+
website: "https://moonmail.io/?utm_source=webpack.js.org",
6+
totalDonations: 11000,
7+
reason: "Paypal"
8+
},
9+
{
10+
name: "Google Angular",
11+
avatar: "https://res.cloudinary.com/opencollective/image/upload/v1485288529/angular_uxllte.png",
12+
website: "https://angular.io/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
13+
totalDonations: 250000,
14+
reason: "Paypal"
15+
},
16+
{
17+
name: "Architects.io",
18+
avatar: null,
19+
website: "http://architects.io/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
20+
totalDonations: 30000,
21+
reason: "Paypal"
22+
},
23+
{
24+
username: "peerigon",
25+
name: "Peerigon",
26+
avatar: "https://opencollective-production.s3-us-west-1.amazonaws.com/e8a1de10-99c8-11e6-8650-f92e594d5de8.png",
27+
website: "https://peerigon.com/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
28+
totalDonations: 144139,
29+
reason: "webpack meetup 2017-07"
30+
},
31+
{
32+
name: "Segment",
33+
avatar: require("./assets/segment-logo.png"),
34+
website: "https://segment.com/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
35+
totalDonations: 2400000,
36+
reason: "Sponsorship 2017-07 - 2017-09"
37+
}
38+
];
Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +0,0 @@
1-
[
2-
{
3-
"name": "MoonMail",
4-
"tier": "sponsor",
5-
"avatar": "https://static.moonmail.io/moonmail-logo.svg",
6-
"website": "https://moonmail.io/?utm_source=webpack.js.org",
7-
"totalDonations": 11000
8-
},
9-
{
10-
"name": "Google Angular",
11-
"tier": "sponsor",
12-
"avatar": "https://res.cloudinary.com/opencollective/image/upload/v1485288529/angular_uxllte.png",
13-
"website": "https://angular.io/",
14-
"totalDonations": 250000
15-
},
16-
{
17-
"name": "Architects.io",
18-
"tier": "sponsor",
19-
"avatar": null,
20-
"website": "http://architects.io/",
21-
"totalDonations": 30000
22-
}
23-
]

src/content/about.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: 参与翻译的全体成员
33
contributors:
44
- akira-cn
55
- Aladdin-ADD
6+
- AlenQi
67
- beiciye
78
- billie66
89
- biqing
@@ -26,14 +27,17 @@ contributors:
2627
- lgh06
2728
- lizhonghui
2829
- lmymoonsky
30+
- lukastong
2931
- mc-zone
3032
- neal1991
3133
- nick-nick
3234
- panlinying
35+
- QC-L
3336
- rqzheng2015
3437
- scq000
3538
- ShiHaoLin
3639
- shisaq
40+
- SimonLeeee
3741
- starkwang
3842
- superpig
3943
- tao1991123

src/content/api/cli.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,17 @@ webpack --env.platform=web # 设置 env.platform == "web"
130130

131131
`--env` 参数具有多种语法 accepts various syntaxes:
132132

133-
Invocation | Resulting environment
134-
------------------------------- | ---------------------------
135-
`webpack --env prod` | `"prod"`
136-
`webpack --env.prod` | `{ prod: true }`
137-
`webpack --env.prod=1` | `{ prod: 1 }`
138-
`webpack --env.prod=foo` | `{ prod: "foo" }`
139-
`webpack --env.prod --env.min` | `{ prod: true, min: true }`
140-
`webpack --env.prod --env min` | `[{ prod: true }, "min"]`
133+
Invocation | Resulting environment
134+
---------------------------------------- | ---------------------------
135+
`webpack --env prod` | `"prod"`
136+
`webpack --env.prod` | `{ prod: true }`
137+
`webpack --env.prod=1` | `{ prod: 1 }`
138+
`webpack --env.prod=foo` | `{ prod: "foo" }`
139+
`webpack --env.prod --env.min` | `{ prod: true, min: true }`
140+
`webpack --env.prod --env min` | `[{ prod: true }, "min"]`
141+
`webpack --env.prod=foo --env.prod=bar` | `{prod: [ "foo", "bar" ]}`
142+
143+
T> See the [environment variables](/guides/environment-variables) guide for more information on its usage.
141144

142145
### 输出配置
143146

@@ -292,7 +295,7 @@ webpack.js index=./src/index.js index2=./src/index2.js --output-path='./dist' --
292295

293296
简写 | 含义
294297
---------|----------------------------
295-
-d | `--debug --devtool cheap-module-source-map --output-pathinfo`
298+
-d | `--debug --devtool cheap-module-eval-source-map --output-pathinfo`
296299
-p | `--optimize-minimize --define process.env.NODE_ENV="production"`, see [building for production](/guides/production)
297300

298301

src/content/api/node.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ T> webpack **不**会并行执行多个配置。每个配置只会在前一个
7070
* `.run(callback)`
7171
* `.watch(watchOptions, handler)`
7272

73+
W> The API only supports a single concurrent compilation at a time. When using `run`, wait for it to finish before calling `run` or `watch` again. When using `watch`, call `close` and wait for it to finish before calling `run` or `watch` again. Concurrent compilations will corrupt the output files.
74+
7375

7476
## 执行(Run)
7577

0 commit comments

Comments
 (0)