Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update master #377

Merged
merged 26 commits into from
Oct 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3f5c3fb
docs(api): minor fix in cli
skipjack Sep 8, 2017
9cd50d5
docs(plugins): clarify and simplify `SourceMapDevToolPlugin` docs (#1…
skipjack Sep 8, 2017
a26cc70
docs(guides): update "external limitations" example in author-librari…
pfmmfp Sep 10, 2017
287e0e1
docs(plugins): update commons-chunk-plugin.md (#1560)
liorgreenb Sep 10, 2017
e8dc2f3
docs(guides): rewrite shimming (#1579)
skipjack Sep 12, 2017
2caa06a
docs(guides): fix small issues in shimming (#1591)
jeremenichelli Sep 13, 2017
ddaf684
docs(guides): fix entry path in typescript (#1592)
ltaloc Sep 13, 2017
28ac2fd
docs(guides): fix typos in production (#1584)
elliotwaite Sep 13, 2017
2ff84b9
fix(sponsors): update to reflect opencollective change (#1588)
sokra Sep 13, 2017
cb9a035
docs(config): update configuration-languages (#1590)
peterblazejewicz Sep 14, 2017
bee0f3e
docs(guides): update hot-module-replacement (#1539)
bdwain Sep 14, 2017
2af6968
docs(guides): update development.md (#1586)
marcusmolchany Sep 14, 2017
5f6a75e
docs(guides): update tree-shaking.md (#1589)
Sep 14, 2017
3dc7e74
docs(guides): update code-splitting (#1585)
diegofaria Sep 14, 2017
5003179
docs(plugins): update module-concatenation-plugin (#1565)
pspeter3 Sep 15, 2017
60f2679
docs(api): fix type in compiler.md (#1601)
Sep 18, 2017
eecdc8d
docs(config): update output.md (#1541)
metatoaster Sep 18, 2017
b3cd5ac
docs(api): add concurrent usage warning in node.md (#1599)
sokra Sep 18, 2017
cdf2c87
docs(guides): update environment-variables (#1549)
grisanu Sep 18, 2017
9cfbbe7
Merge remote-tracking branch 'upstream/master'
dear-lizhihua Sep 19, 2017
51a9aad
Swap ordering of pre/post loaders (#1602)
DrewML Sep 21, 2017
2af9244
docs(sponsors): update segment's donations (#1603)
sokra Sep 22, 2017
7f47223
Merge remote-tracking branch 'upstream/master'
dear-lizhihua Sep 24, 2017
25a3d6d
Merge branch 'master' into cn
dear-lizhihua Oct 10, 2017
debfddd
Merge remote-tracking branch 'upstream/cn' into cn
dear-lizhihua Oct 10, 2017
57fb4d4
update contributors
dear-lizhihua Oct 10, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ node_modules
npm-debug.log
build
generated
support-backers.json
support-sponsors.json
support-*.json
starter-kits-data.json
.antwar
.idea
10 changes: 5 additions & 5 deletions src/components/Splash/Splash.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ const Splash = () => (
<p>通过你的贡献、捐款或者赞助,webpack 将获得繁荣发展。你的捐助直接用于支持我们付出工作、持续改进,最加重要的是有助于我们提供优秀的文档和资料!</p>

<h2>平台赞助</h2>
<Support type="sponsors" rank="platinum" />
<Support rank="platinum" />

<h2>金牌赞助</h2>
<Support type="sponsors" rank="gold" />
<Support rank="gold" />

<h2>银牌赞助</h2>
<Support type="sponsors" rank="silver" />
<Support rank="silver" />

<h2>铜牌赞助</h2>
<Support type="sponsors" rank="bronze" />
<Support rank="bronze" />

<h2>赞助者</h2>
<Support type="backers" />
<Support rank="backer" />
</Container>
</div>
</div>
Expand Down
58 changes: 43 additions & 15 deletions src/components/Support/Support.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import React from 'react';
import Additional from './support-additional.json';
import GoldSponsors from './support-goldsponsors.json';
import SilverSponsors from './support-silversponsors.json';
import Sponsors from './support-sponsors.json';
import Backers from './support-backers.json';
import Additional from './support-additional.js';
import './Support.scss';

const ranks = {
backer: {
maximum: 200
},
bronze: {
minimum: 200,
maximum: 2000
},
silver: {
Expand All @@ -19,17 +27,37 @@ const ranks = {
}
};

function formatMoney(number) {
let str = Math.round(number) + '';
if (str.length > 3) {
str = str.substr(0, str.length - 3) + ',' + str.substr(-3);
}
return str;
}

export default class Support extends React.Component {
render() {
let { rank, type } = this.props;
let supporters = require(`./support-${type}.json`);
let { rank } = this.props;
let supporters = [
...GoldSponsors,
...SilverSponsors,
...Sponsors,
...Backers,
];

if (type === 'sponsors') {
supporters = supporters.slice();
supporters.push(...Additional);
supporters.sort((a, b) => b.totalDonations - a.totalDonations);
// merge or add additional backers/sponsors
for(const additional of Additional) {
const existing = supporters.find(supporter => supporter.username && supporter.username === additional.username);
if (existing) {
existing.totalDonations += additional.totalDonations;
} else {
supporters.push(additional);
}
}

// resort list
supporters.sort((a, b) => b.totalDonations - a.totalDonations);

let minimum, maximum;

if (rank && ranks[rank]) {
Expand All @@ -48,14 +76,14 @@ export default class Support extends React.Component {
return (
<div className="support">
<div className="support__description">
{ type === 'sponsors' ? (
{ rank === 'backer' ? (
<p>
<b className="support__rank">{ rank } sponsors</b>
<span>are those who have pledged { minimum ? `$${minimum}` : 'up' } { maximum ? `to $${maximum}` : 'or more' } to webpack.</span>
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.
</p>
) : (
<p>
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.
<b className="support__rank">{ rank } sponsors</b>
<span>are those who have pledged { minimum ? `$${formatMoney(minimum)}` : 'up' } { maximum ? `to $${formatMoney(maximum)}` : 'or more' } to webpack.</span>
</p>
)}
</div>
Expand All @@ -64,22 +92,22 @@ export default class Support extends React.Component {
supporters.map((supporter, index) => (
<a key={ supporter.id || supporter.username || index }
className="support__item"
title={ `$${supporter.totalDonations / 100} by ${supporter.name || supporter.username}` }
title={ `$${formatMoney(supporter.totalDonations / 100)} by ${supporter.name || supporter.username}` }
target="_blank"
href={ supporter.website || `https://opencollective.com/${supporter.username}` }>
{ supporter.avatar ? <img
className={ `support__${type}-avatar-${rank || 'normal'}` }
className={ `support__${rank}-avatar` }
src={ supporter.avatar }
alt={ supporter.username ? `${supporter.username}'s avatar` : 'avatar' } /> :
supporter.name }
{ type === 'backers' ? <figure className="support__outline" /> : null }
{ rank === 'backer' ? <figure className="support__outline" /> : null }
</a>
))
}

<div className="support__bottom">
<a className="support__button" href="https://opencollective.com/webpack#support">
Become a { type.replace(/s$/, '') }
Become a { rank === 'backer' ? 'backer' : 'sponsor' }
</a>
</div>
</div>
Expand Down
31 changes: 17 additions & 14 deletions src/components/Support/Support.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,25 @@
margin: 0 2px 2px 2px;
}

&__sponsors-avatar {
&-bronze, &-normal {
height: 32px;
}
&-silver {
height: 64px;
}
&-gold {
height: 96px;
}
&-platinum {
height: 128px;
}
&__bronze-avatar {
height: 32px;
max-width: 96px;
}

&__silver-avatar {
height: 64px;
max-width: 192px;
}

&__gold-avatar {
height: 96px;
}

&__platinum-avatar {
height: 128px;
}

&__backers-avatar-normal {
&__backer-avatar {
width: 31px;
height: 31px;
border-radius: 50%;
Expand Down
Binary file added src/components/Support/assets/segment-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions src/components/Support/support-additional.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export default [
{
name: "MoonMail",
avatar: "https://static.moonmail.io/moonmail-logo.svg",
website: "https://moonmail.io/?utm_source=webpack.js.org",
totalDonations: 11000,
reason: "Paypal"
},
{
name: "Google Angular",
avatar: "https://res.cloudinary.com/opencollective/image/upload/v1485288529/angular_uxllte.png",
website: "https://angular.io/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
totalDonations: 250000,
reason: "Paypal"
},
{
name: "Architects.io",
avatar: null,
website: "http://architects.io/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
totalDonations: 30000,
reason: "Paypal"
},
{
username: "peerigon",
name: "Peerigon",
avatar: "https://opencollective-production.s3-us-west-1.amazonaws.com/e8a1de10-99c8-11e6-8650-f92e594d5de8.png",
website: "https://peerigon.com/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
totalDonations: 144139,
reason: "webpack meetup 2017-07"
},
{
name: "Segment",
avatar: require("./assets/segment-logo.png"),
website: "https://segment.com/?utm_source=webpack&utm_medium=documentation&utm_campaign=sponsorship",
totalDonations: 2400000,
reason: "Sponsorship 2017-07 - 2017-09"
}
];
23 changes: 0 additions & 23 deletions src/components/Support/support-additional.json
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@
[
{
"name": "MoonMail",
"tier": "sponsor",
"avatar": "https://static.moonmail.io/moonmail-logo.svg",
"website": "https://moonmail.io/?utm_source=webpack.js.org",
"totalDonations": 11000
},
{
"name": "Google Angular",
"tier": "sponsor",
"avatar": "https://res.cloudinary.com/opencollective/image/upload/v1485288529/angular_uxllte.png",
"website": "https://angular.io/",
"totalDonations": 250000
},
{
"name": "Architects.io",
"tier": "sponsor",
"avatar": null,
"website": "http://architects.io/",
"totalDonations": 30000
}
]
4 changes: 4 additions & 0 deletions src/content/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: 参与翻译的全体成员
contributors:
- akira-cn
- Aladdin-ADD
- AlenQi
- beiciye
- billie66
- biqing
Expand All @@ -26,14 +27,17 @@ contributors:
- lgh06
- lizhonghui
- lmymoonsky
- lukastong
- mc-zone
- neal1991
- nick-nick
- panlinying
- QC-L
- rqzheng2015
- scq000
- ShiHaoLin
- shisaq
- SimonLeeee
- starkwang
- superpig
- tao1991123
Expand Down
21 changes: 12 additions & 9 deletions src/content/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,17 @@ webpack --env.platform=web # 设置 env.platform == "web"

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

Invocation | Resulting environment
------------------------------- | ---------------------------
`webpack --env prod` | `"prod"`
`webpack --env.prod` | `{ prod: true }`
`webpack --env.prod=1` | `{ prod: 1 }`
`webpack --env.prod=foo` | `{ prod: "foo" }`
`webpack --env.prod --env.min` | `{ prod: true, min: true }`
`webpack --env.prod --env min` | `[{ prod: true }, "min"]`
Invocation | Resulting environment
---------------------------------------- | ---------------------------
`webpack --env prod` | `"prod"`
`webpack --env.prod` | `{ prod: true }`
`webpack --env.prod=1` | `{ prod: 1 }`
`webpack --env.prod=foo` | `{ prod: "foo" }`
`webpack --env.prod --env.min` | `{ prod: true, min: true }`
`webpack --env.prod --env min` | `[{ prod: true }, "min"]`
`webpack --env.prod=foo --env.prod=bar` | `{prod: [ "foo", "bar" ]}`

T> See the [environment variables](/guides/environment-variables) guide for more information on its usage.

### 输出配置

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

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


Expand Down
2 changes: 2 additions & 0 deletions src/content/api/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ T> webpack **不**会并行执行多个配置。每个配置只会在前一个
* `.run(callback)`
* `.watch(watchOptions, handler)`

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.


## 执行(Run)

Expand Down
2 changes: 1 addition & 1 deletion src/content/api/plugins/compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ compiler.options = {...};
class LogPlugin {
apply (compiler) {
compiler.plugin('should-emit', compilation => {
console.log('should i emit?');
console.log('should I emit?');
return true;
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/content/configuration/configuration-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ contributors:
- skipjack
- tarang9211
- simon04
- peterblazejewicz
---

webpack 接受以多种编程和数据语言编写的配置文件。支持的文件扩展名列表,可以在 [node-interpret](https://github.com/js-cli/js-interpret) 包中找到。使用 [node-interpret](https://github.com/js-cli/js-interpret),webpack 可以处理许多不同类型的配置文件。
Expand All @@ -26,7 +27,6 @@ __webpack.config.ts__
```typescript
import * as webpack from 'webpack';
import * as path from 'path';
declare var __dirname;

const config: webpack.Configuration = {
entry: './foo.js',
Expand Down
2 changes: 1 addition & 1 deletion src/content/configuration/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ W> 小心!resource 是文件的_解析_路径,这意味着符号链接的资

还有一个额外的种类"行内 loader",loader 被应用在 import/require 行内。

所有 loader 通过 `后置, 行内, 普通, 前置` 排序,并按此顺序使用。
所有 loader 通过 `前置, 行内, 普通, 后置` 排序,并按此顺序使用。

所有普通 loader 可以通过在请求中加上 `!` 前缀来忽略(覆盖)。

Expand Down
Loading