Skip to content

Commit c558e69

Browse files
update master & update translation (docschina#380)
* update /content/loaders & /content/plugins * 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 (docschina#1581) Try to resolve the confusion from docschina#1556. Also update the options section to clean things up a bit both for readability and grammar. Resolves docschina#1556 * docs(guides): update "external limitations" example in author-libraries (docschina#1583) * docs(plugins): update commons-chunk-plugin.md (docschina#1560) Changed example to declare the plugin within `plugins` property. * docs(guides): rewrite shimming (docschina#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 docschina#1258 * docs(guides): fix small issues in shimming (docschina#1591) * docs(guides): fix entry path in typescript (docschina#1592) * docs(guides): fix typos in production (docschina#1584) * fix(sponsors): update to reflect opencollective change (docschina#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 (docschina#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 (docschina#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 (docschina#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 (docschina#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 (docschina#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 (docschina#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 (docschina#1601) * docs(config): update output.md (docschina#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 (docschina#1599) * docs(guides): update environment-variables (docschina#1549) Add documentation about setting environment variables in CLI with `--env`. Link to webpack _CLI Environment_ section. Add additional usage to `--env` CLI docs. * update /content/loaders & /content/plugins * Swap ordering of pre/post loaders (docschina#1602) `pre` loaders run at the beginning, `post` loaders run at the end. * docs(sponsors): update segment's donations (docschina#1603) * fix(fetch): fix some issues when parsing remote content (docschina#1604) The previous regex was a simpler approach to the lead in content issue in fetched plugin/loader readmes, however it wasn't targeted enough to correctly remove all lead in content. The new approach should be a bit more stable but honestly the real fix here would be so better standardize/enforce the readme template before including these packages in the documentation site. I also think we can simplify the template a bit to make the parsing of these readme easier. Resolves docschina#1600 * docs(guides): fix typo in code-splitting (docschina#1606) * docs(config): update `inline` recommendation in dev-server (docschina#1540) Update tip based on discussion in docschina#1540. * docs(config): update pfx description in dev-server (docschina#1595) Clarify the difference between using `pfx` via the command line and in a configuration. * docs(config): clarify stats option sort and default (docschina#1596) * docs(config): add before/after hook info to dev-server (docschina#1608) * docs(guides): fix typo in development (docschina#1609) * docs(guides): fix typo in production.md (docschina#1610) * docs(readme): fix typos (docschina#1615) * fix(markdown): fix issue with multiple pipes in a single cell (docschina#1611) Introduced better fix for pipes escaping in Markdown table cells. * docs(guides): update hot-module-replacement (docschina#1614) Second argument of `server.listen` is a hostname, in this context, `'localhost'`. The third argument of `server.listen` is the success callback... https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L552 * docs(guides): fix `onClick` instances in caching (docschina#1613) * docs(config): fix typo in module.md (docschina#1618) * docs(guides): fix grammar in getting-started.md (docschina#1619) * docs(config): add filename to index example (docschina#1620) * docs(guides): update wds options in hot-module-replacement (docschina#1617) Define the host property of the options object and set it to 'localhost'. The webpack-dev-server CLI defaults the host to 'localhost', but `addDevServerEntrypoints` from the webpack-dev-server Node.js API does not set a default and leaves it undefined, which will eventually throw "Uncaught SyntaxError: The URL 'http:/sockjs-node' is invalid" in the browser when following the code example. webpack/webpack-dev-server#1129 * fix(sponsors): opencollective api changed, add validation (docschina#1622) * docs(development): update how-to-write-a-loader.md (docschina#1621) Changes `_` to `.` to have correct code. * update /content/loaders & /content/plugins * update contributors * docs(plugins): add deepChildren to commons-chunk-plugin.md (docschina#1625) * feat(sponsors): highlight latest sponsors/backers (docschina#1628) * refactor: update information architecture This commit contains the following changes: - Merge support and development into a coherent "Contribute" section. - Flatten `/api/plugins` in preparation for flattened page `group`ing. - Sort "Contribute" section and rewrite index page using "Why Support?". - Simplify and organize antwar config as much as possible. - Move `title` / `description` fields to the actual components. BREAKING CHANGE: The route restructuring and content reorg breaks some routes. Before this is merged, we should make sure to add redirects for anything broken. * refactor(navigation): update routes and styling Simplify routing to reflect antwar and content changes and remove extraneous links. Simplify styling to first improve the design, but also to provide a lot more breathing room so less hacks are needed for smaller page sizes. With the updated design we should have room for "Voting" and "Analyze" links once those micro apps are in a better place. * fix: add link to starter kits "Support" is now included in the "Contribute" section and already has a link in the top navigation. The starter-kits page was previously hidden from users, so this exposes it a bit more. * refactor(navigation): update the navigation component Make minor styling change for consistent gutter. Extract link data into a separate JSON file. Update variable and parameter names for clarity. * feat: allow page grouping within sections via `group` field Add support for a new `group` field in each page's YAML frontmatter to group pages together in an intuitive way. The benefit of this approach vs directories is that changing a pages group within the same top-level section won't affect its route and thus will not break links to it. * style(page): align content better on larger screens * docs: remove empty pages * docs(contribute): add writers-guide and update release-process * docs: sort the base pages more intuitively * docs(api): update page names and grouping * fix(mobile): clean up mobile sidebar data * docs(api): clean up formatting and fix linting errors * docs(api): fix markdown listing issues * docs(contribute): fix markdown linting issues * docs(api): rewrite the index page * docs(api): minor formatting and cleanup * docs: add redirects for all broken routes The changes in docschina#1612 break a significant amount of pre-existing URLs, this commit adds redirects for everything I could see that would be broken. * style(page): fix small padding issue The padding here is useful for browsers that display a full on scrollbar instead of an overlay scrollbar. We can continue to think about how that space it utilized in future commits/prs. * docs(guides): update production.md (docschina#1629) Modify the doc accordingly to the following tweetstorm where Dan Abramov & Sean Larkin kindly explained this to me. https://twitter.com/TheLarkInn/status/917524723579338752 * fix(markdown): wrap inline code (docschina#1634) This change makes inline code blocks wrap so long lines will not be hidden outside paragraph. Resolves docschina#1633 * docs(guides): fix small typo excluding closing brace (docschina#1637) * docs(guides): fix typo in development.md (docschina#1638) * docs(guides): update hot-module-replacement.md (docschina#1639) Maintain consistent code from previous guide (development). * docs(guides): maintain consistent code in production.md (docschina#1640) * docs(guides): update typescript.md Configure TypeScript to compile modules to ES2015 module syntax, enabling webpack to resolve the `import` / `export` syntax on it's own. With this included, the only thing necessary to enable _tree shaking_ is the inclusion of the `UglifyJSPlugin` (which I'm not adding to this article as it is just centered on getting started with TypeScript). Resolves docschina#1627 * update /content/loaders & /content/plugins * fix LinkDropdown * 修复 npm 命令错误导致编译不成功的问题
1 parent de7777d commit c558e69

File tree

116 files changed

+1729
-1127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1729
-1127
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ they are going:
5656
- [Guides - Review and Simplify][1]
5757
- [Concepts - Review, Organize, Define Clear Goals][2]
5858

59-
We haven't created issues for the other sections yet but they will be coming soon. For
59+
We haven't created issues for the other sections yet, but they will be coming soon. For
6060
dev-related work please see [General - Current Longterm Plan][3], which will soon be
6161
replaced by a more dev-specific issue.
6262

@@ -68,7 +68,7 @@ If you hope to localize this documentation please jump to the [translate branch]
6868

6969
## Contributing
7070

71-
Read throug the [writer's guide][7] if you're interested in editing the conent on this
71+
Read through the [writer's guide][7] if you're interested in editing the content on this
7272
site. See the [contributors page][5] to learn how to set up and start working on the site
7373
locally.
7474

antwar.config.js

+75-109
Original file line numberDiff line numberDiff line change
@@ -13,155 +13,121 @@ module.exports = {
1313
layout: () => require('./src/components/Site/Site.jsx').default,
1414
paths: {
1515
'/': {
16-
title: "Home",
17-
content: () => require.context('./loaders/page-loader!./src/content', false, /^\.\/.*\.md$/),
18-
index: () => {
19-
const index = require('./src/components/Splash/Splash.jsx').default;
20-
index.title = 'webpack 中文文档';
21-
index.description = 'webpack 是一个模块打包器。它的主要目标是将 JavaScript 文件打包在一起,打包后的文件用于在浏览器中使用,但它也能够胜任转换(transform)、打包(bundle)或包裹(package)任何资源(resource or asset)。';
22-
23-
return index;
24-
},
16+
title: 'Home',
2517
layout: () => require('./src/components/Page/Page.jsx').default,
26-
},
27-
'get-started': {
18+
content: () => require.context('./loaders/page-loader!./src/content', false, /^\.\/.*\.md$/),
19+
index: () => require('./src/components/Splash/Splash.jsx').default,
2820
redirects: {
29-
'': '/guides/getting-started',
30-
'install-webpack': '/guides/installation',
31-
'why-webpack': '/guides/why-webpack',
21+
'support': '/contribute',
22+
'writers-guide': '/contribute/writers-guide'
3223
}
3324
},
34-
api: {
35-
title: "API",
36-
layout: () => require('./src/components/Page/Page.jsx').default,
25+
concepts: {
26+
title: '概念',
3727
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
38-
content: () => require.context('./loaders/page-loader!./src/content/api', false, /^\.\/.*\.md$/),
39-
transform: (pages) => {
40-
return _.sortBy(pages, (page) => page.file.sort)
41-
},
42-
redirects: {
43-
'passing-a-config': 'configuration-types'
44-
}
28+
layout: () => require('./src/components/Page/Page.jsx').default,
29+
content: () => require.context('./loaders/page-loader!./src/content/concepts', false, /^\.\/.*\.md$/)
4530
},
46-
'api/plugins': {
47-
title: "API 插件",
31+
configuration: {
32+
title: '配置',
33+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
4834
layout: () => require('./src/components/Page/Page.jsx').default,
35+
content: () => require.context('./loaders/page-loader!./src/content/configuration', false, /^\.\/.*\.md$/)
36+
},
37+
api: {
38+
title: 'API',
4939
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
50-
content: () => require.context('./loaders/page-loader!./src/content/api/plugins', false, /^\.\/.*\.md$/),
51-
transform: (pages) => {
52-
return _.sortBy(pages, (page) => page.file.sort)
53-
},
40+
layout: () => require('./src/components/Page/Page.jsx').default,
41+
content: () => require.context('./loaders/page-loader!./src/content/api', false, /^\.\/.*\.md$/),
5442
redirects: {
5543
'passing-a-config': 'configuration-types'
5644
}
5745
},
58-
pluginsapi: {
59-
title: 'API 插件',
60-
redirects: {
61-
'': '/api/plugins',
62-
'compiler': '/api/plugins/compiler',
63-
'template': '/api/plugins/template'
64-
},
65-
hideInSidebar: true
66-
},
67-
concepts: {
68-
title: "概念",
69-
layout: () => require('./src/components/Page/Page.jsx').default,
70-
content: () => require.context('./loaders/page-loader!./src/content/concepts', false, /^\.\/.*\.md$/),
46+
guides: {
47+
title: '指南',
7148
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
72-
transform: (pages) => {
73-
return _.sortBy(pages, (page) => page.file.sort)
74-
}
75-
},
76-
development: {
77-
title: "开发",
7849
layout: () => require('./src/components/Page/Page.jsx').default,
79-
content: () => require.context('./loaders/page-loader!./src/content/development', false, /^\.\/.*\.md$/),
80-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
81-
transform: (pages) => {
82-
return _.sortBy(pages, (page) => page.file.sort)
50+
content: () => require.context('./loaders/page-loader!./src/content/guides', false, /^\.\/.*\.md$/),
51+
redirects: {
52+
'code-splitting-import': '/guides/code-splitting',
53+
'code-splitting-require': '/guides/code-splitting',
54+
'code-splitting-async': '/guides/code-splitting',
55+
'code-splitting-css': '/guides/code-splitting',
56+
'code-splitting-libraries': '/guides/code-splitting',
57+
'why-webpack': '/comparison',
58+
'production-build': '/guides/production'
8359
}
8460
},
8561
plugins: {
86-
title: "插件",
62+
title: '插件',
63+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
64+
layout: () => require('./src/components/Page/Page.jsx').default,
8765
content: () => {
8866
return combineContexts(
8967
require.context('./loaders/page-loader!./src/content/plugins', false, /^\.\/.*\.md$/),
9068
require.context('./loaders/page-loader!./generated/plugins', false, /^\.\/.*\.md$/)
9169
);
92-
},
93-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
94-
transform: (pages) => {
95-
return _.sortBy(pages, (page) => page.file.sort)
96-
},
97-
layout: () => require('./src/components/Page/Page.jsx').default
70+
}
9871
},
9972
loaders: {
100-
title: "loaders",
73+
title: 'loaders',
10174
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
10275
layout: () => require('./src/components/Page/Page.jsx').default,
10376
content: () => {
10477
return combineContexts(
10578
require.context('./loaders/page-loader!./src/content/loaders', false, /^\.\/.*\.md$/),
10679
require.context('./loaders/page-loader!./generated/loaders', false, /^\.\/.*\.md$/)
10780
);
108-
},
81+
}
10982
},
110-
guides: {
111-
title: "指南",
112-
layout: () => require('./src/components/Page/Page.jsx').default,
83+
contribute: {
84+
title: '贡献',
11385
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
114-
content: () => require.context('./loaders/page-loader!./src/content/guides', false, /^\.\/.*\.md$/),
115-
transform: (pages) => {
116-
return _.sortBy(pages, (page) => page.file.sort)
117-
},
86+
layout: () => require('./src/components/Page/Page.jsx').default,
87+
content: () => require.context('./loaders/page-loader!./src/content/contribute', false, /^\.\/.*\.md$/),
88+
},
89+
vote: () => require('./src/components/Vote/Vote.jsx').default,
90+
organization: () => require('./src/components/Organization/Organization.jsx').default,
91+
'starter-kits': () => require('./src/components/StarterKits/StarterKits.jsx').default,
92+
93+
/*************************
94+
Redirects for Old Content
95+
*************************/
96+
'get-started': {
97+
hidden: true,
11898
redirects: {
119-
'code-splitting-import': '/guides/code-splitting',
120-
'code-splitting-require': '/guides/code-splitting',
121-
'code-splitting-async': '/guides/code-splitting',
122-
'code-splitting-css': '/guides/code-splitting',
123-
'code-splitting-libraries': '/guides/code-splitting',
124-
'why-webpack': '/comparison',
125-
'production-build': '/guides/production'
99+
'': '/guides/getting-started',
100+
'install-webpack': '/guides/installation',
101+
'why-webpack': '/guides/why-webpack',
126102
}
127103
},
128-
configuration: {
129-
title: "配置",
130-
layout: () => require('./src/components/Page/Page.jsx').default,
131-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
132-
content: () => require.context('./loaders/page-loader!./src/content/configuration', false, /^\.\/.*\.md$/),
133-
transform: (pages) => {
134-
return _.sortBy(pages, (page) => page.file.sort)
104+
pluginsapi: {
105+
hidden: true,
106+
redirects: {
107+
'': '/api/plugins',
108+
'compiler': '/api/compiler',
109+
'template': '/api/template'
135110
}
136111
},
137-
support: {
138-
title: "支持",
139-
layout: () => require('./src/components/Page/Page.jsx').default,
140-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
141-
content: () => require.context('./loaders/page-loader!./src/content/support', false, /^\.\/.*\.md$/),
142-
transform: (pages) => {
143-
return _.sortBy(pages, (page) => page.file.sort)
112+
'api/plugins': {
113+
redirects: {
114+
'compiler': '/api/compiler',
115+
'compilation': '/api/compilation',
116+
'module-factories': '/api/module-factories',
117+
'parser': '/api/parser',
118+
'tapable': '/api/tapable',
119+
'template': '/api/template',
120+
'resolver': '/api/resolver'
144121
}
145122
},
146-
vote: () => {
147-
const page = require('./src/components/Vote/List.jsx').default;
148-
page.title = '投票';
149-
150-
return page;
151-
},
152-
organization: () => {
153-
const page = require('./src/components/Organization/Organization.jsx').default;
154-
155-
page.title = '组织';
156-
157-
return page;
158-
},
159-
'guides/starter-kits': () => {
160-
const page = require('./src/components/StarterKits/StarterKits.jsx').default;
161-
162-
page.title = '配套工具';
163-
164-
return page;
123+
development: {
124+
redirects: {
125+
'': '/contribute',
126+
'plugin-patterns': '/contribute/plugin-patterns',
127+
'release-process': '/contribute/release-process',
128+
'how-to-write-a-loader': '/contribute/writing-a-loader',
129+
'how-to-write-a-plugin': '/contribute/writing-a-plugin'
130+
}
165131
}
166132
}
167133
};

loaders/page-loader.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = function (source) {
88
const result = frontmatter(source);
99

1010
result.attributes = result.attributes || {};
11+
result.attributes.group = result.attributes.group || '-';
1112
result.attributes.anchors = markdown().getAnchors(result.body);
1213
result.attributes.contributors = (result.attributes.contributors || []).sort();
1314
result.attributes.related = Array.isArray(result.attributes.related) ? result.attributes.related : [];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
.navigation__hrefs {
3+
margin-left: 40px;
4+
.dropdown__list {
5+
width: 130px;
6+
}
7+
}

src/components/Footer/Footer.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Footer = () => (
1212
<section className="footer__left">
1313
<Link className="footer__link" to="/guides/getting-started/">起步</Link>
1414
<Link className="footer__link" to="/organization/">组织</Link>
15-
<Link className="footer__link" to="/support/">支持</Link>
15+
<Link className="footer__link" to="/starter-kits/">配套工具</Link>
1616
<Link className="footer__link" to="/comparison/">比较</Link>
1717
</section>
1818

src/components/Navigation/Links.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[
2+
{
3+
"title": "Documentation",
4+
"url": "concepts",
5+
"children": [
6+
{ "title": "Concepts", "url": "concepts" },
7+
{ "title": "Configuration", "url": "configuration" },
8+
{ "title": "API", "url": "api" },
9+
{ "title": "Guides", "url": "guides" },
10+
{ "title": "Loaders", "url": "loaders" },
11+
{ "title": "Plugins", "url": "plugins" }
12+
]
13+
},
14+
{
15+
"title": "Contribute",
16+
"url": "contribute"
17+
},
18+
{
19+
"title": "Blog",
20+
"url": "//medium.com/webpack"
21+
}
22+
]

0 commit comments

Comments
 (0)