mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-13 09:33:54 +00:00
Merge branch 'tapable' of github.com:nuxt/nuxt.js into tapable
This commit is contained in:
commit
2d34d81d9c
@ -324,6 +324,7 @@ export default class Builder extends Tapable {
|
|||||||
} else {
|
} else {
|
||||||
// --- Production Build ---
|
// --- Production Build ---
|
||||||
compiler.run((err, stats) => {
|
compiler.run((err, stats) => {
|
||||||
|
/* istanbul ignore if */
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err)
|
return reject(err)
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ export default class Nuxt extends Tapable {
|
|||||||
listen (port = 3000, host = 'localhost') {
|
listen (port = 3000, host = 'localhost') {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const server = this.renderer.app.listen({ port, host, exclusive: false }, err => {
|
const server = this.renderer.app.listen({ port, host, exclusive: false }, err => {
|
||||||
|
/* istanbul ignore if */
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err)
|
return reject(err)
|
||||||
}
|
}
|
||||||
@ -61,6 +62,7 @@ export default class Nuxt extends Tapable {
|
|||||||
// Destroy server by forcing every connection to be closed
|
// Destroy server by forcing every connection to be closed
|
||||||
server.destroy(err => {
|
server.destroy(err => {
|
||||||
debug('server closed')
|
debug('server closed')
|
||||||
|
/* istanbul ignore if */
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err)
|
return reject(err)
|
||||||
}
|
}
|
||||||
@ -93,6 +95,7 @@ export default class Nuxt extends Tapable {
|
|||||||
async close (callback) {
|
async close (callback) {
|
||||||
await this.applyPluginsAsync('close')
|
await this.applyPluginsAsync('close')
|
||||||
|
|
||||||
|
/* istanbul ignore if */
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
await callback()
|
await callback()
|
||||||
}
|
}
|
||||||
|
@ -132,6 +132,7 @@ export default class Renderer extends Tapable {
|
|||||||
basedir: this.options.rootDir
|
basedir: this.options.rootDir
|
||||||
}, this.options.render.ssr, this.options.build.ssr))
|
}, this.options.render.ssr, this.options.build.ssr))
|
||||||
|
|
||||||
|
/* istanbul ignore if */
|
||||||
if (this.options.build.ssr) {
|
if (this.options.build.ssr) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.warn('[nuxt] `build.ssr` is deprecated and will be removed in 1.0 release, please use `renderer.ssr` instead!')
|
console.warn('[nuxt] `build.ssr` is deprecated and will be removed in 1.0 release, please use `renderer.ssr` instead!')
|
||||||
@ -174,7 +175,8 @@ export default class Renderer extends Tapable {
|
|||||||
if (this.options.router.base !== '/' && req.url.indexOf(this.options.router.base) === 0) {
|
if (this.options.router.base !== '/' && req.url.indexOf(this.options.router.base) === 0) {
|
||||||
req.url = req.url.replace(this.options.router.base, '/')
|
req.url = req.url.replace(this.options.router.base, '/')
|
||||||
}
|
}
|
||||||
// Prevent access to SSR resources
|
// Prevent access to SSR resources (TODO: write tests)
|
||||||
|
/* istanbul ignore if */
|
||||||
if (ssrResourceRegex.test(req.url)) {
|
if (ssrResourceRegex.test(req.url)) {
|
||||||
res.statusCode = 404
|
res.statusCode = 404
|
||||||
return res.end()
|
return res.end()
|
||||||
|
Loading…
Reference in New Issue
Block a user