Merge branch 'dev' of github.com:Atinux/nuxt.js into dev

Conflicts:
	lib/build.js
	lib/module.js
	lib/server.js
This commit is contained in:
Sébastien Chopin 2017-05-21 19:23:31 +02:00
commit 0183ac4b86
9 changed files with 124 additions and 80 deletions

148
README.md
View File

@ -3,7 +3,7 @@
<a href="https://travis-ci.org/nuxt/nuxt.js"><img src="https://img.shields.io/travis/nuxt/nuxt.js/master.svg" alt="Build Status"></a>
<a href="https://ci.appveyor.com/project/Atinux/nuxt-js"><img src="https://ci.appveyor.com/api/projects/status/gwab06obc6srx9g4?svg=true" alt="Windows Build Status"></a>
 <a href="https://codecov.io/gh/nuxt/nuxt.js"><img src="https://img.shields.io/codecov/c/github/nuxt/nuxt.js/master.svg" alt="Coverage Status"></a>
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/dt/nuxt.svg" alt="Downloads"></a>
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/dm/nuxt.svg" alt="Downloads"></a>
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/v/nuxt.svg" alt="Version"></a>
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/l/nuxt.svg" alt="License"></a>
<a href="https://gitter.im/nuxt/nuxt.js"><img src="https://img.shields.io/badge/GITTER-join%20chat-green.svg" alt="Gitter"></a>
@ -19,6 +19,80 @@
## 🚧 Under active development, [1.0](https://github.com/nuxt/nuxt.js/projects/1) will be released soon :fire:
## Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/nuxtjs#sponsor)]
<p>
<a href="https://opencollective.com/nuxtjs/sponsor/0/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/1/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/2/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/3/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/4/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/5/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/6/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/7/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/8/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/9/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/10/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/11/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/12/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/13/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/14/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/15/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/16/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/17/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/18/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/19/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/20/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/21/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/22/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/23/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/24/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/25/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/26/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/27/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/28/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/29/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/sponsor/29/avatar.svg"></a>
</p>
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/nuxtjs#backer)]
<p>
<a href="https://opencollective.com/nuxtjs/backer/0/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/1/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/2/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/3/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/4/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/5/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/6/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/7/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/8/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/9/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/10/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/11/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/12/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/13/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/14/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/15/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/16/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/17/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/18/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/19/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/20/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/21/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/22/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/23/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/24/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/25/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/26/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/27/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/28/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/29/website" target="_blank" rel="noopener noreferrer"><img src="https://opencollective.com/nuxtjs/backer/29/avatar.svg"></a>
</p>
## Links
- 📘 Documentation: [https://nuxtjs.org](https://nuxtjs.org)
@ -172,75 +246,3 @@ Note: we recommend putting `.nuxt` in `.npmignore` or `.gitignore`.
## Roadmap
https://github.com/nuxt/nuxt.js/projects/1
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/nuxtjs#backer)]
<a href="https://opencollective.com/nuxtjs/backer/0/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/1/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/2/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/3/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/4/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/5/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/6/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/7/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/8/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/9/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/10/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/11/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/12/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/13/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/14/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/15/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/16/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/17/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/18/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/19/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/20/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/21/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/22/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/23/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/24/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/25/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/26/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/27/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/28/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/backer/29/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/29/avatar.svg"></a>
## Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/nuxtjs#sponsor)]
<a href="https://opencollective.com/nuxtjs/sponsor/0/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/1/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/2/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/3/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/4/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/5/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/6/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/7/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/8/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/9/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/10/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/11/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/12/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/13/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/14/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/15/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/16/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/17/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/18/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/19/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/20/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/21/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/22/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/23/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/24/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/25/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/26/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/27/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/28/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/nuxtjs/sponsor/29/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/29/avatar.svg"></a>

View File

@ -223,7 +223,10 @@ async function generateRoutesAndFiles () {
const files = await glob('pages/**/*.vue', {cwd: this.srcDir})
templateVars.router.routes = createRoutes(files, this.srcDir)
} else {
<<<<<<< HEAD
this.createRoutes = this.createRoutes.bind(this)
=======
>>>>>>> ac42ae599ec5878f0596305d4a4c9c195ff1e72c
templateVars.router.routes = this.createRoutes(this.srcDir)
}
// router.extendRoutes method

View File

@ -74,6 +74,7 @@ class Module {
if (this.modules.indexOf(moduleOpts) !== -1 || this.modules.indexOf(moduleOpts.src) !== -1) {
return false
}
this.modules.push(moduleOpts.src || moduleOpts)
return this.addModule(moduleOpts)
}
@ -102,16 +103,15 @@ class Module {
console.error('[nuxt] Unable to resolve module', src)
// eslint-disable-next-line no-console
console.error(e)
return
process.exit(0)
}
// Validate module
/* istanbul ignore if */
if (!(module instanceof Function)) {
// eslint-disable-next-line no-console
return console.error(`[nuxt] Module [${originalSrc}] should export a function`)
console.error(`[nuxt] Module [${originalSrc}] should export a function`)
process.exit(1)
}
// Add module to this.modules
this.modules.push(module)
// Call module with `this` context and pass options
return new Promise((resolve, reject) => {
const result = module.call(this, options, err => {

View File

@ -54,13 +54,14 @@ export async function render (req, res) {
res.statusCode = 404
return res.end()
}
const { html, error, redirected } = await this.renderRoute(req.url, context)
const { html, error, redirected, resourceHints } = await this.renderRoute(req.url, context)
if (redirected) {
return html
}
if (error) {
res.statusCode = context.nuxt.error.statusCode || 500
}
// ETag header
if (!error && this.options.render.etag) {
const etag = generateETag(html, this.options.render.etag)
if (fresh(req.headers, { etag })) {
@ -72,6 +73,18 @@ export async function render (req, res) {
}
res.setHeader('Content-Type', 'text/html; charset=utf-8')
res.setHeader('Content-Length', Buffer.byteLength(html))
// Parse resourceHints to extract HTTP.2 prefetch/push headers
// https://w3c.github.io/preload/#server-push-http-2
const regex = /link rel="([^"]*)" href="([^"]*)" as="([^"]*)"/g
const pushAssets = []
let m
while (m = regex.exec(resourceHints)) { // eslint-disable-line no-cond-assign
const [_, rel, href, as] = m // eslint-disable-line no-unused-vars
if (rel === 'preload') {
pushAssets.push(`<${href}>; rel=${rel}; as=${as}`)
}
}
res.setHeader('Link', pushAssets)
res.end(html, 'utf8')
return html
} catch (err) {
@ -106,7 +119,8 @@ export async function renderRoute (url, context = {}) {
if (this._routerBaseSpecified) {
HEAD += `<base href="${this.options.router.base}">`
}
HEAD += context.renderResourceHints() + context.renderStyles()
const resourceHints = context.renderResourceHints()
HEAD += resourceHints + context.renderStyles()
APP += `<script type="text/javascript">window.__NUXT__=${serialize(context.nuxt, { isJSON: true })}</script>`
APP += context.renderScripts()
const html = this.appTemplate({
@ -117,6 +131,7 @@ export async function renderRoute (url, context = {}) {
})
return {
html,
resourceHints,
error: context.nuxt.error,
redirected: context.redirected
}

View File

@ -144,6 +144,15 @@ test('/redirect2 status code', async t => {
t.true(output.stderr[0].includes('Error: NOPE!'))
})
test('ETag Header', async t => {
const {headers: {etag}} = await rp(url('/stateless'), {resolveWithFullResponse: true})
// Validate etag
t.regex(etag, /W\/".*"$/)
// Verify functionality
const error = await t.throws(rp(url('/stateless'), {headers: {'If-None-Match': etag}}))
t.is(error.statusCode, 304)
})
// Close server and ask nuxt to stop listening to file changes
test.after('Closing server and nuxt.js', t => {
server.close()

View File

@ -22,5 +22,9 @@ module.exports = function basicModule (options, resolve) {
// Do nothing!
})
// Require same module twice
this.requireModule('~/modules/empty/index.js')
this.requireModule('~/modules/empty/index.js')
resolve()
}

4
test/fixtures/module/modules/empty/index.js vendored Executable file
View File

@ -0,0 +1,4 @@
module.exports = function middlewareModule (options) {
// Empty module
}

View File

@ -8,6 +8,8 @@ module.exports = function middlewareModule (options) {
res.end('It works!')
}
})
// Add local middleware js
this.addServerMiddleware('~/modules/middleware/log.js')
// Add plain middleware
this.addServerMiddleware((req, res, next) => {
res.setHeader('x-nuxt', 'hello')

View File

@ -0,0 +1,5 @@
module.exports = function (req, res, next) {
// eslint-disable-next-line no-console
console.log(req.url)
next()
}