mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-29 23:02:42 +00:00
update tapable plugins
This commit is contained in:
parent
8563c0f05f
commit
1417dae99b
@ -18,7 +18,7 @@ export default class ModuleContainer extends Tapable {
|
|||||||
|
|
||||||
async _ready () {
|
async _ready () {
|
||||||
await sequence(this.options.modules, this.addModule.bind(this))
|
await sequence(this.options.modules, this.addModule.bind(this))
|
||||||
await this.nuxt.applyPluginsAsync('module', this)
|
await this.applyPluginsAsync('ready', this)
|
||||||
}
|
}
|
||||||
|
|
||||||
addVendor (vendor) {
|
addVendor (vendor) {
|
||||||
|
@ -74,7 +74,7 @@ export default class Nuxt extends Tapable {
|
|||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
|
|
||||||
resolve()
|
resolve(this.applyPluginsAsync('listen', { server, port, host }))
|
||||||
})
|
})
|
||||||
|
|
||||||
// Add server.destroy(cb) method
|
// Add server.destroy(cb) method
|
||||||
|
@ -46,14 +46,12 @@ export default class Renderer extends Tapable {
|
|||||||
spaTemplate: null,
|
spaTemplate: null,
|
||||||
errorTemplate: parseTemplate('<pre>{{ stack }}</pre>') // Will be loaded on ready
|
errorTemplate: parseTemplate('<pre>{{ stack }}</pre>') // Will be loaded on ready
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind middleware to this context
|
|
||||||
this.nuxtMiddleware = this.nuxtMiddleware.bind(this)
|
|
||||||
this.errorMiddleware = this.errorMiddleware.bind(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async _ready () {
|
async _ready () {
|
||||||
// Setup all middleWare
|
await this.nuxt.applyPluginsAsync('renderer', this)
|
||||||
|
|
||||||
|
// Setup nuxt middleware
|
||||||
await this.setupMiddleware()
|
await this.setupMiddleware()
|
||||||
|
|
||||||
// Load error template
|
// Load error template
|
||||||
@ -67,7 +65,8 @@ export default class Renderer extends Tapable {
|
|||||||
await this.loadResources()
|
await this.loadResources()
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.nuxt.applyPluginsAsync('renderer', this)
|
// Call ready plugin
|
||||||
|
await this.applyPluginsAsync('ready', this)
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadResources (_fs = fs) {
|
async loadResources (_fs = fs) {
|
||||||
@ -211,10 +210,10 @@ export default class Renderer extends Tapable {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Finally use nuxtMiddleware
|
// Finally use nuxtMiddleware
|
||||||
this.useMiddleware(this.nuxtMiddleware)
|
this.useMiddleware(this.nuxtMiddleware.bind(this))
|
||||||
|
|
||||||
// Error middleware for errors that occurred in middleware that declared above
|
// Error middleware for errors that occurred in middleware that declared above
|
||||||
this.useMiddleware(this.errorMiddleware)
|
this.useMiddleware(this.errorMiddleware.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
async nuxtMiddleware (req, res, next) {
|
async nuxtMiddleware (req, res, next) {
|
||||||
|
Loading…
Reference in New Issue
Block a user