Skip to content

Commit 2632008

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents cd22d32 + dcfe3d4 commit 2632008

24 files changed

+300
-187
lines changed

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ branches:
44
- develop
55
language: node_js
66
node_js:
7-
- "6"
7+
- "8"
88
script:
99
- bash ./src/scripts/deploy.sh
1010
sudo: required

Diff for: antwar.bootstrap.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ process.env.BABEL_ENV = environment;
77

88
antwar[environment]({
99
environment,
10-
configurationPaths: {
11-
antwar: require.resolve("./antwar.config.js"),
12-
webpack: require.resolve("./webpack.config.js"),
13-
},
10+
configurationPaths: {
11+
antwar: require.resolve("./antwar.config.js"),
12+
webpack: require.resolve("./webpack.config.js"),
13+
},
1414
}).then(() => {
15-
if (environment !== "build") {
16-
console.log("Surf to localhost:3000");
17-
}
15+
if (environment !== "build") {
16+
console.log("Surf to localhost:3000");
17+
}
1818
}).catch((err) => {
1919
console.error(err);
2020

Diff for: antwar.config.js

+61-71
Original file line numberDiff line numberDiff line change
@@ -15,78 +15,68 @@ module.exports = () => ({
1515
title: 'Home',
1616
layout: () => require('./src/components/Page/Page.jsx').default,
1717
content: () => require.context('./loaders/page-loader!./src/content', false, /^\.\/.*\.md$/),
18-
index: () => require('./src/components/Splash/Splash.jsx').default,
19-
redirects: {
20-
'support': '/contribute',
21-
'writers-guide': '/contribute/writers-guide'
18+
index: () => require('./src/components/Splash/Splash.jsx').default
19+
},
20+
concepts: {
21+
title: 'Concepts',
22+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
23+
layout: () => require('./src/components/Page/Page.jsx').default,
24+
content: () => require.context('./loaders/page-loader!./src/content/concepts', false, /^\.\/.*\.md$/)
25+
},
26+
configuration: {
27+
title: 'Configuration',
28+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
29+
layout: () => require('./src/components/Page/Page.jsx').default,
30+
content: () => require.context('./loaders/page-loader!./src/content/configuration', false, /^\.\/.*\.md$/)
31+
},
32+
api: {
33+
title: 'API',
34+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
35+
layout: () => require('./src/components/Page/Page.jsx').default,
36+
content: () => require.context('./loaders/page-loader!./src/content/api', false, /^\.\/.*\.md$/)
37+
},
38+
guides: {
39+
title: 'Guides',
40+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
41+
layout: () => require('./src/components/Page/Page.jsx').default,
42+
content: () => require.context('./loaders/page-loader!./src/content/guides', false, /^\.\/.*\.md$/)
43+
},
44+
plugins: {
45+
title: 'Plugins',
46+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
47+
layout: () => require('./src/components/Page/Page.jsx').default,
48+
content: () => {
49+
return combineContexts(
50+
require.context('./loaders/page-loader!./src/content/plugins', false, /^\.\/.*\.md$/),
51+
require.context('./loaders/page-loader!./generated/plugins', false, /^\.\/.*\.md$/)
52+
);
53+
}
54+
},
55+
loaders: {
56+
title: 'Loaders',
57+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
58+
layout: () => require('./src/components/Page/Page.jsx').default,
59+
content: () => {
60+
return combineContexts(
61+
require.context('./loaders/page-loader!./src/content/loaders', false, /^\.\/.*\.md$/),
62+
require.context('./loaders/page-loader!./generated/loaders', false, /^\.\/.*\.md$/)
63+
);
2264
}
2365
},
24-
concepts: {
25-
title: 'Concepts',
26-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
27-
layout: () => require('./src/components/Page/Page.jsx').default,
28-
content: () => require.context('./loaders/page-loader!./src/content/concepts', false, /^\.\/.*\.md$/)
29-
},
30-
configuration: {
31-
title: 'Configuration',
32-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
33-
layout: () => require('./src/components/Page/Page.jsx').default,
34-
content: () => require.context('./loaders/page-loader!./src/content/configuration', false, /^\.\/.*\.md$/)
35-
},
36-
api: {
37-
title: 'API',
38-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
39-
layout: () => require('./src/components/Page/Page.jsx').default,
40-
content: () => require.context('./loaders/page-loader!./src/content/api', false, /^\.\/.*\.md$/),
41-
redirects: {
42-
'passing-a-config': 'configuration-types'
43-
}
44-
},
45-
guides: {
46-
title: 'Guides',
47-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
48-
layout: () => require('./src/components/Page/Page.jsx').default,
49-
content: () => require.context('./loaders/page-loader!./src/content/guides', false, /^\.\/.*\.md$/),
50-
redirects: {
51-
'code-splitting-import': '/guides/code-splitting',
52-
'code-splitting-require': '/guides/code-splitting',
53-
'code-splitting-async': '/guides/code-splitting',
54-
'code-splitting-css': '/guides/code-splitting',
55-
'code-splitting-libraries': '/guides/code-splitting',
56-
'why-webpack': '/comparison',
57-
'production-build': '/guides/production'
58-
}
59-
},
60-
plugins: {
61-
title: 'Plugins',
62-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
63-
layout: () => require('./src/components/Page/Page.jsx').default,
64-
content: () => {
65-
return combineContexts(
66-
require.context('./loaders/page-loader!./src/content/plugins', false, /^\.\/.*\.md$/),
67-
require.context('./loaders/page-loader!./generated/plugins', false, /^\.\/.*\.md$/)
68-
);
69-
}
70-
},
71-
loaders: {
72-
title: 'Loaders',
73-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
74-
layout: () => require('./src/components/Page/Page.jsx').default,
75-
content: () => {
76-
return combineContexts(
77-
require.context('./loaders/page-loader!./src/content/loaders', false, /^\.\/.*\.md$/),
78-
require.context('./loaders/page-loader!./generated/loaders', false, /^\.\/.*\.md$/)
79-
);
80-
}
81-
},
82-
contribute: {
83-
title: 'Contribute',
84-
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
85-
layout: () => require('./src/components/Page/Page.jsx').default,
86-
content: () => require.context('./loaders/page-loader!./src/content/contribute', false, /^\.\/.*\.md$/),
87-
},
88-
vote: () => require('./src/components/Vote/Vote.jsx').default,
89-
organization: () => require('./src/components/Organization/Organization.jsx').default,
90-
'starter-kits': () => require('./src/components/StarterKits/StarterKits.jsx').default,
66+
contribute: {
67+
title: 'Contribute',
68+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
69+
layout: () => require('./src/components/Page/Page.jsx').default,
70+
content: () => require.context('./loaders/page-loader!./src/content/contribute', false, /^\.\/.*\.md$/)
71+
},
72+
migrate: {
73+
title: 'Migrate',
74+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
75+
layout: () => require('./src/components/Page/Page.jsx').default,
76+
content: () => require.context('./loaders/page-loader!./src/content/migrate', false, /^\.\/.*\.md$/)
77+
},
78+
vote: () => require('./src/components/Vote/Vote.jsx').default,
79+
organization: () => require('./src/components/Organization/Organization.jsx').default,
80+
'starter-kits': () => require('./src/components/StarterKits/StarterKits.jsx').default
9181
}
9282
});

Diff for: src/components/Navigation/Links.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
{ "title": "API", "url": "api" },
99
{ "title": "Guides", "url": "guides" },
1010
{ "title": "Loaders", "url": "loaders" },
11-
{ "title": "Plugins", "url": "plugins" }
11+
{ "title": "Plugins", "url": "plugins" },
12+
{ "title": "Migrate", "url": "migrate" }
1213
]
1314
},
1415
{

Diff for: src/components/Navigation/Navigation.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default class Navigation extends React.Component {
6969
className="navigation__languages"
7070
items={[
7171
{ title: 'English', url: 'https://webpack.js.org/' },
72-
{ title: '中文', url: 'https://doc.webpack-china.org/' }
72+
{ title: '中文', url: 'https://webpack.docschina.org/' }
7373
]} />
7474
</Container>
7575

Diff for: src/components/Support/Support.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default class Support extends React.Component {
104104
{<img
105105
className={ `support__${rank}-avatar` }
106106
src={ supporter.avatar || SmallIcon }
107-
alt={ supporter.name || supporter.slug ? `${supporter.name || supporter.slug}'s avatar` : 'avatar' }
107+
alt={ supporter.name || supporter.slug ? `${supporter.name || supporter.slug}'s avatar` : 'avatar' }
108108
onError={ this._handleImgError } />}
109109
{ rank === 'backer' ? <figure className="support__outline" /> : null }
110110
</a>
@@ -119,7 +119,7 @@ export default class Support extends React.Component {
119119
</div>
120120
);
121121
}
122-
122+
123123
/**
124124
* Handle images that aren't found
125125
*

Diff for: src/content/api/module-methods.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,21 @@ W> This feature relies on [`Promise`](https://developer.mozilla.org/en-US/docs/W
7373
The spec for `import` doesn't allow control over the chunk's name or other properties as "chunks" are only a concept within webpack. Luckily webpack allows some special parameters via comments so as to not break the spec:
7474

7575
``` js
76+
// single target
7677
import(
7778
/* webpackChunkName: "my-chunk-name" */
7879
/* webpackMode: "lazy" */
7980
'module'
8081
);
82+
83+
// multiple possible targets
84+
import(
85+
/* webpackInclude: /\.json$/ */
86+
/* webpackExclude: /\.noimport\.json$/ */
87+
/* webpackChunkName: "my-chunk-name" */
88+
/* webpackMode: "lazy" */
89+
`./locale/${language}`
90+
);
8191
```
8292

8393
`webpackChunkName`: A name for the new chunk. Since webpack 2.6.0, the placeholders `[index]` and `[request]` are supported within the given string to an incremented number or the actual resolved filename respectively.
@@ -91,9 +101,15 @@ import(
91101

92102
T> Note that both options can be combined like so `/* webpackMode: "lazy-once", webpackChunkName: "all-i18n-data" */`. This is parsed as a JSON5 object without curly brackets.
93103

104+
`webpackInclude`: A regular expression that will be matched against during import resolution and only modules that matches __will be bundled__.
105+
106+
`webpackExclude`: A regular expression that will be matched against during import resolution and any module that matches __will not be bundled__.
107+
108+
T> Note that `webpackInclude` and `webpackExclude` options do not interfere with the prefix. eg: `./locale`.
109+
94110
W> Fully dynamic statements, such as `import(foo)`, __will fail__ because webpack requires at least some file location information. This is because `foo` could potentially be any path to any file in your system or project. The `import()` must contain at least some information about where the module is located, so bundling can be limited to a specific directory or set of files.
95111

96-
W> Every module that could potentially be requested on an `import()` call is included. For example, ``import(`./locale/${language}.json`)`` will cause every `.json` file in the `./locale` directory to be bundled into the new chunk. At run time, when the variable `language` has been computed, any file like `english.json` or `german.json` will be available for consumption.
112+
W> Every module that could potentially be requested on an `import()` call is included. For example, ``import(`./locale/${language}.json`)`` will cause every `.json` file in the `./locale` directory to be bundled into the new chunk. At run time, when the variable `language` has been computed, any file like `english.json` or `german.json` will be available for consumption. Using the `webpackInclude` and `webpackExclude` options allows us to add regex patterns that reduce the files that webpack will bundle for this import.
97113

98114
W> The use of `System.import` in webpack [did not fit the proposed spec](https://github.com/webpack/webpack/issues/2163), so it was deprecated in webpack [2.1.0-beta.28](https://github.com/webpack/webpack/releases/tag/v2.1.0-beta.28) in favor of `import()`.
99115

0 commit comments

Comments
 (0)