mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
ESLint
This commit is contained in:
parent
c5ca8c64f1
commit
79b97093d0
@ -9,14 +9,14 @@ import {chainFn, sequence} from './utils'
|
|||||||
const debug = require('debug')('nuxt:module')
|
const debug = require('debug')('nuxt:module')
|
||||||
|
|
||||||
class Module {
|
class Module {
|
||||||
constructor(nuxt) {
|
constructor (nuxt) {
|
||||||
this.nuxt = nuxt
|
this.nuxt = nuxt
|
||||||
this.options = nuxt.options
|
this.options = nuxt.options
|
||||||
this.modules = []
|
this.modules = []
|
||||||
this.initialized = false
|
this.initialized = false
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init () {
|
||||||
if (this.initialized) {
|
if (this.initialized) {
|
||||||
debug('[nuxt] Modules are already initialized')
|
debug('[nuxt] Modules are already initialized')
|
||||||
return
|
return
|
||||||
@ -27,7 +27,7 @@ class Module {
|
|||||||
this.initialized = true
|
this.initialized = true
|
||||||
}
|
}
|
||||||
|
|
||||||
addVendor(vendor) {
|
addVendor (vendor) {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (!vendor) {
|
if (!vendor) {
|
||||||
return
|
return
|
||||||
@ -35,7 +35,7 @@ class Module {
|
|||||||
this.options.build.vendor = uniq(this.options.build.vendor.concat(vendor))
|
this.options.build.vendor = uniq(this.options.build.vendor.concat(vendor))
|
||||||
}
|
}
|
||||||
|
|
||||||
addTemplate(template) {
|
addTemplate (template) {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (!template) {
|
if (!template) {
|
||||||
return
|
return
|
||||||
@ -61,7 +61,7 @@ class Module {
|
|||||||
return templateObj
|
return templateObj
|
||||||
}
|
}
|
||||||
|
|
||||||
addPlugin(template) {
|
addPlugin (template) {
|
||||||
const {dst} = this.addTemplate(template)
|
const {dst} = this.addTemplate(template)
|
||||||
// Add to nuxt plugins
|
// Add to nuxt plugins
|
||||||
this.options.plugins.push({
|
this.options.plugins.push({
|
||||||
@ -70,19 +70,19 @@ class Module {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
addServerMiddleware(middleware) {
|
addServerMiddleware (middleware) {
|
||||||
this.options.serverMiddleware.push(middleware)
|
this.options.serverMiddleware.push(middleware)
|
||||||
}
|
}
|
||||||
|
|
||||||
extendBuild(fn) {
|
extendBuild (fn) {
|
||||||
this.options.build.extend = chainFn(this.options.build.extend, fn)
|
this.options.build.extend = chainFn(this.options.build.extend, fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
extendRoutes(fn) {
|
extendRoutes (fn) {
|
||||||
this.options.router.extendRoutes = chainFn(this.options.router.extendRoutes, fn)
|
this.options.router.extendRoutes = chainFn(this.options.router.extendRoutes, fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
requireModule(moduleOpts) {
|
requireModule (moduleOpts) {
|
||||||
if (this.modules.indexOf(moduleOpts) !== -1 || this.modules.indexOf(moduleOpts.src) !== -1) {
|
if (this.modules.indexOf(moduleOpts) !== -1 || this.modules.indexOf(moduleOpts.src) !== -1) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ class Module {
|
|||||||
return this.addModule(moduleOpts)
|
return this.addModule(moduleOpts)
|
||||||
}
|
}
|
||||||
|
|
||||||
addModule(moduleOpts) {
|
addModule (moduleOpts) {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (!moduleOpts) {
|
if (!moduleOpts) {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user