1- var _ = require ( 'lodash' ) ;
2- var path = require ( 'path' ) ;
3- var prevnextPlugin = require ( 'antwar-prevnext-plugin' ) ;
4- var markdown = require ( './utilities/markdown' ) ;
5- var highlight = require ( './utilities/highlight' ) ;
1+ const path = require ( 'path' ) ;
2+ const _ = require ( 'lodash' ) ;
3+ const prevnextPlugin = require ( 'antwar-prevnext-plugin' ) ;
64
75module . exports = {
6+ maximumWorkers : process . env . TRAVIS && 1 , // Faster on Travis
87 template : {
98 title : 'webpack' ,
109 description : 'webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.' ,
@@ -13,6 +12,8 @@ module.exports = {
1312 output : 'build' ,
1413 title : 'webpack' ,
1514 keywords : [ 'webpack' , 'javascript' , 'web development' , 'programming' ] ,
15+
16+ // XXXXX: restore
1617 pageTitle : function ( config , pageTitle ) {
1718 var siteName = config . name ;
1819
@@ -29,238 +30,97 @@ module.exports = {
2930 return require ( './components/site/site.jsx' ) . default
3031 } ,
3132 paths : {
32- '/' : root (
33- function ( ) {
34- return require . context (
35- 'json-loader!yaml-frontmatter-loader!./content' ,
36- false ,
37- / ^ \. \/ .* \. m d $ /
38- ) ;
39- }
40- ) ,
41-
42- 'get-started' : {
43- redirects : {
44- '' : '/guides/get-started' ,
45- 'install-webpack' : '/guides/installation' ,
46- 'why-webpack' : '/guides/why-webpack' ,
47- }
48- } ,
49-
50- concepts : section (
51- 'Concepts' ,
52- function ( ) {
53- return require . context (
54- 'json-loader!yaml-frontmatter-loader!./content/concepts' ,
55- false ,
56- / ^ \. \/ .* \. m d $ /
57- ) ;
58- }
59- ) ,
60-
61- guides : section (
62- 'Guides' ,
63- function ( ) {
64- return require . context (
65- 'json-loader!yaml-frontmatter-loader!./content/guides' ,
66- true ,
67- / ^ \. \/ .* \. m d $ /
68- ) ;
69- } , {
70- 'code-splitting-import' : '/guides/code-splitting-async' ,
71- 'code-splitting-require' : '/guides/code-splitting-async/#require-ensure-' ,
72- 'why-webpack' : '/guides/comparison'
73- }
74- ) ,
75-
76- development : section (
77- 'Development' ,
78- function ( ) {
79- return require . context (
80- 'json-loader!yaml-frontmatter-loader!./content/development' ,
33+ '/' : {
34+ content : ( ) => (
35+ require . context (
36+ './loaders/page-loader!./content' ,
8137 true ,
8238 / ^ \. \/ .* \. m d $ /
83- ) ;
84- }
85- ) ,
86-
87- configuration : section (
88- 'Configuration' ,
89- function ( ) {
90- return require . context (
91- 'json-loader!yaml-frontmatter-loader!./content/configuration' ,
92- false ,
93- / ^ \. \/ .* \. m d $ /
94- ) ;
95- } , {
96- 'external-configs' : 'javascript-alternatives'
97- }
98- ) ,
99-
100- api : section (
101- 'API' ,
102- function ( ) {
103- return require . context (
104- 'json-loader!yaml-frontmatter-loader!./content/api' ,
105- false ,
106- / ^ \. \/ .* \. m d $ /
107- ) ;
108- } , {
109- 'passing-a-config' : 'configuration-types'
110- }
111- ) ,
112-
113- 'api/plugins' : section (
114- 'API' ,
115- function ( ) {
116- return require . context (
117- 'json-loader!yaml-frontmatter-loader!./content/api/plugins' ,
118- false ,
119- / ^ \. \/ .* \. m d $ /
120- ) ;
121- }
122- ) ,
123-
124- pluginsapi : {
125- redirects : {
126- '' : '/api/plugins' ,
127- 'compiler' : '/api/plugins/compiler' ,
128- 'template' : '/api/plugins/template'
39+ )
40+ ) ,
41+ index : ( ) => require ( './components/splash/splash.jsx' ) . default ,
42+ layout : ( ) => require ( './components/page/page.jsx' ) . default ,
43+ paths : {
44+ 'get-started' : {
45+ redirects : {
46+ '' : '/guides/get-started' ,
47+ 'install-webpack' : '/guides/installation' ,
48+ 'why-webpack' : '/guides/why-webpack' ,
49+ }
50+ } ,
51+ guides : {
52+ redirects : {
53+ 'code-splitting-import' : '/guides/code-splitting-async' ,
54+ 'code-splitting-require' : '/guides/code-splitting-async/#require-ensure-' ,
55+ 'why-webpack' : '/guides/comparison'
56+ }
57+ } ,
58+ configuration : {
59+ redirects : {
60+ 'external-configs' : 'javascript-alternatives'
61+ }
62+ } ,
63+ api : {
64+ redirects : {
65+ 'passing-a-config' : 'configuration-types'
66+ }
67+ } ,
68+ pluginsapi : {
69+ redirects : {
70+ '' : '/api/plugins' ,
71+ 'compiler' : '/api/plugins/compiler' ,
72+ 'template' : '/api/plugins/template'
73+ }
74+ } ,
75+ loaders : {
76+ content : ( ) => {
77+ const content = require . context (
78+ './loaders/page-loader!./content/loaders' ,
79+ false ,
80+ / ^ \. \/ .* \. m d $ /
81+ ) ;
82+ const generated = require . context (
83+ './loaders/page-loader!./generated/loaders' ,
84+ false ,
85+ / ^ \. \/ .* \. m d $ /
86+ ) ;
87+
88+ return combineContexts ( content , generated ) ;
89+ }
90+ } ,
91+ loaders : {
92+ content : ( ) => {
93+ const content = require . context (
94+ './loaders/page-loader!./content/plugins' ,
95+ false ,
96+ / ^ \. \/ .* \. m d $ /
97+ ) ;
98+ const generated = require . context (
99+ './loaders/page-loader!./generated/plugins' ,
100+ false ,
101+ / ^ \. \/ .* \. m d $ /
102+ ) ;
103+
104+ return combineContexts ( content , generated ) ;
105+ }
106+ }
129107 }
130108 } ,
131-
132- loaders : section (
133- 'Loaders' ,
134- function ( ) {
135- const content = require . context (
136- 'json-loader!yaml-frontmatter-loader!./content/loaders' ,
137- false ,
138- / ^ \. \/ .* \. m d $ /
139- ) ;
140- const generated = require . context (
141- 'json-loader!yaml-frontmatter-loader!./generated/loaders' ,
142- false ,
143- / ^ \. \/ .* \. m d $ /
144- ) ;
145- return combineContexts ( content , generated ) ;
146- }
147- ) ,
148-
149- plugins : section (
150- 'Plugins' ,
151- function ( ) {
152- const content = require . context (
153- 'json-loader!yaml-frontmatter-loader!./content/plugins' ,
154- false ,
155- / ^ \. \/ .* \. m d $ /
156- ) ;
157- const generated = require . context (
158- 'json-loader!yaml-frontmatter-loader!./generated/plugins' ,
159- false ,
160- / ^ \. \/ .* \. m d $ /
161- ) ;
162- return combineContexts ( content , generated ) ;
163- }
164- ) ,
165-
166- support : section (
167- 'Support' ,
168- function ( ) {
169- return require . context (
170- 'json-loader!yaml-frontmatter-loader!./content/support' ,
171- false ,
172- / ^ \. \/ .* \. m d $ /
173- ) ;
174- }
175- ) ,
176-
177109 vote : {
178- path ( ) {
179- return require ( './components/vote/list.jsx' ) . default
180- }
110+ index : ( ) => require ( './components/vote/list.jsx' ) . default
181111 } ,
182-
183112 'vote/feedback' : {
184- path ( ) {
185- return require ( './components/vote/list.jsx' ) . default
186- }
113+ index : ( ) => require ( './components/vote/list.jsx' ) . default
187114 } ,
188-
189115 'vote/moneyDistribution' : {
190- path ( ) {
191- return require ( './components/vote/list.jsx' ) . default
192- }
116+ index : ( ) => require ( './components/vote/list.jsx' ) . default
193117 } ,
194-
195118 organization : {
196- path ( ) {
197- return require ( './components/organization/organization.jsx' ) . default
198- }
119+ index : ( ) => require ( './components/organization/organization.jsx' ) . default
199120 }
200121 }
201122} ;
202123
203- function root ( contentCb ) {
204- return {
205- title : 'webpack' ,
206- path : function ( ) { // Load path content
207- return contentCb ( ) ;
208- } ,
209- processPage : processPage ( ) , // Process individual page (url, content)
210- layouts : { // Layouts (page/section)
211- index : function ( ) {
212- return require ( './components/splash/splash.jsx' ) . default
213- } ,
214- page : function ( ) {
215- return require ( './components/page/page.jsx' ) . default
216- }
217- } ,
218- redirects : { } // Redirects <from>: <to>
219- } ;
220- }
221-
222- function section ( title , contentCb , redirects = { } ) {
223- return {
224- title : title ,
225- path : function ( ) {
226- return contentCb ( ) ;
227- } ,
228- sort ( pages ) {
229- return _ . sortBy ( pages , ( page ) => page . file . sort )
230- } ,
231- processPage : processPage ( ) ,
232- layouts : {
233- index : function ( ) {
234- return require ( './components/page/page.jsx' ) . default
235- } ,
236- page : function ( ) {
237- return require ( './components/page/page.jsx' ) . default
238- }
239- } ,
240- redirects : redirects // <from>: <to>
241- } ;
242- }
243-
244- function processPage ( ) {
245- return {
246- url : function ( o ) {
247- return o . sectionName + '/' + o . fileName . split ( '.' ) [ 0 ]
248- } ,
249- content : function ( o ) {
250- return markdown ( ) . process ( o . file . __content , highlight ) ;
251- } ,
252- anchors : function ( o ) {
253- return markdown ( ) . getAnchors ( o . file . __content ) ;
254- } ,
255- contributors : function ( o ) {
256- return Array . isArray ( o . file . contributors ) && o . file . contributors . length && o . file . contributors . slice ( ) . sort ( ) ;
257- } ,
258- related : function ( o ) {
259- return Array . isArray ( o . file . related ) ? o . file . related : [ ]
260- }
261- } ;
262- }
263-
264124function combineContexts ( context1 , context2 ) {
265125 function webpackContext ( req ) {
266126 try {
0 commit comments