mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
parent
1162f2ddc1
commit
655f11cefd
@ -100,7 +100,9 @@ export default class Builder {
|
||||
normalizePlugins() {
|
||||
return uniqBy(
|
||||
this.options.plugins.map((p) => {
|
||||
if (typeof p === 'string') p = { src: p }
|
||||
if (typeof p === 'string') {
|
||||
p = { src: p }
|
||||
}
|
||||
const pluginBaseName = path.basename(p.src, path.extname(p.src)).replace(
|
||||
/[^a-zA-Z?\d\s:]/g,
|
||||
''
|
||||
@ -551,7 +553,9 @@ export default class Builder {
|
||||
this.watchers.restart = chokidar
|
||||
.watch(nuxtRestartWatch, this.options.watchers.chokidar)
|
||||
.on('all', (event, _path) => {
|
||||
if (['add', 'change', 'unlink'].includes(event) === false) return
|
||||
if (['add', 'change', 'unlink'].includes(event) === false) {
|
||||
return
|
||||
}
|
||||
this.nuxt.callHook('watch:fileChanged', this, _path) // Legacy
|
||||
this.nuxt.callHook('watch:restart', { event, path: _path })
|
||||
})
|
||||
@ -564,7 +568,9 @@ export default class Builder {
|
||||
}
|
||||
|
||||
async close() {
|
||||
if (this.__closed) return
|
||||
if (this.__closed) {
|
||||
return
|
||||
}
|
||||
this.__closed = true
|
||||
|
||||
// Unwatch
|
||||
|
@ -142,8 +142,12 @@ export default class NuxtCommand {
|
||||
const opts = foldLines(`Options:`, startSpaces) + '\n\n' + _opts
|
||||
|
||||
let helpText = colorize(`${usage}\n\n`)
|
||||
if (this.cmd.description) helpText += colorize(`${description}\n\n`)
|
||||
if (options.length) helpText += colorize(`${opts}\n\n`)
|
||||
if (this.cmd.description) {
|
||||
helpText += colorize(`${description}\n\n`)
|
||||
}
|
||||
if (options.length) {
|
||||
helpText += colorize(`${opts}\n\n`)
|
||||
}
|
||||
|
||||
return helpText
|
||||
}
|
||||
|
@ -137,7 +137,9 @@ export default class Generator {
|
||||
const { fallback } = this.options.generate
|
||||
|
||||
// Disable SPA fallback if value isn't a non-empty string
|
||||
if (typeof fallback !== 'string' || !fallback) return
|
||||
if (typeof fallback !== 'string' || !fallback) {
|
||||
return
|
||||
}
|
||||
|
||||
const fallbackPath = path.join(this.distPath, fallback)
|
||||
|
||||
|
@ -178,7 +178,9 @@ export default class Server {
|
||||
try {
|
||||
handler = this.nuxt.resolver.requireModule(middleware.handler || middleware)
|
||||
} catch (err) {
|
||||
if (!this.options.dev) throw err[0]
|
||||
if (!this.options.dev) {
|
||||
throw err[0]
|
||||
}
|
||||
// Only warn missing file in development
|
||||
consola.warn(err[0])
|
||||
}
|
||||
@ -231,7 +233,9 @@ export default class Server {
|
||||
}
|
||||
|
||||
async close() {
|
||||
if (this.__closed) return
|
||||
if (this.__closed) {
|
||||
return
|
||||
}
|
||||
this.__closed = true
|
||||
|
||||
for (const listener of this.listeners) {
|
||||
|
@ -33,7 +33,9 @@ export default class VueRenderer {
|
||||
}
|
||||
|
||||
get assetsMapping() {
|
||||
if (this._assetsMapping) return this._assetsMapping
|
||||
if (this._assetsMapping) {
|
||||
return this._assetsMapping
|
||||
}
|
||||
|
||||
const legacyAssets = this.context.resources.clientManifest.assetsMapping
|
||||
const modernAssets = invert(this.context.resources.modernManifest.assetsMapping)
|
||||
@ -449,7 +451,9 @@ export default class VueRenderer {
|
||||
}
|
||||
|
||||
close() {
|
||||
if (this.__closed) return
|
||||
if (this.__closed) {
|
||||
return
|
||||
}
|
||||
this.__closed = true
|
||||
|
||||
for (const key in this.renderer) {
|
||||
|
@ -232,7 +232,9 @@ export class WebpackBundler {
|
||||
}
|
||||
|
||||
async close() {
|
||||
if (this.__closed) return
|
||||
if (this.__closed) {
|
||||
return
|
||||
}
|
||||
this.__closed = true
|
||||
|
||||
// Unwatch
|
||||
|
@ -115,7 +115,9 @@ export default class PostcssConfig {
|
||||
.map((p) => {
|
||||
const plugin = require(p)
|
||||
const opts = plugins[p]
|
||||
if (opts === false) return // Disabled
|
||||
if (opts === false) {
|
||||
return // Disabled
|
||||
}
|
||||
const instance = plugin(opts)
|
||||
return instance
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user