mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 13:48:13 +00:00
chore: fix lint errors
This commit is contained in:
parent
1aa47b5edf
commit
052364c689
@ -21,7 +21,7 @@ export class Builder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extends VueRouter
|
// Extends VueRouter
|
||||||
async function build(builder: Builder) {
|
async function build (builder: Builder) {
|
||||||
const { nuxt } = builder
|
const { nuxt } = builder
|
||||||
|
|
||||||
await generate(builder)
|
await generate(builder)
|
||||||
@ -33,7 +33,7 @@ async function build(builder: Builder) {
|
|||||||
await bundle(builder)
|
await bundle(builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
function watch(builder: Builder) {
|
function watch (builder: Builder) {
|
||||||
const { nuxt } = builder
|
const { nuxt } = builder
|
||||||
|
|
||||||
// Watch internal templates
|
// Watch internal templates
|
||||||
@ -52,7 +52,7 @@ function watch(builder: Builder) {
|
|||||||
})
|
})
|
||||||
// appWatcher.debug()
|
// appWatcher.debug()
|
||||||
appWatcher.watch(/(A|a)pp\.[a-z]{2,3}/, async () => {
|
appWatcher.watch(/(A|a)pp\.[a-z]{2,3}/, async () => {
|
||||||
await new Promise((resolve) => setTimeout(resolve, 200))
|
await new Promise(resolve => setTimeout(resolve, 200))
|
||||||
await generate(builder)
|
await generate(builder)
|
||||||
})
|
})
|
||||||
appWatcher.watch('pages/', async () => {
|
appWatcher.watch('pages/', async () => {
|
||||||
@ -61,7 +61,7 @@ function watch(builder: Builder) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generate(builder: Builder) {
|
export async function generate (builder: Builder) {
|
||||||
const { nuxt } = builder
|
const { nuxt } = builder
|
||||||
|
|
||||||
await fsExtra.mkdirp(nuxt.options.buildDir)
|
await fsExtra.mkdirp(nuxt.options.buildDir)
|
||||||
|
@ -9,7 +9,7 @@ interface NuxtTemplate {
|
|||||||
data?: any
|
data?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
async function compileTemplate({ src, path, data }: NuxtTemplate, destDir: string) {
|
async function compileTemplate ({ src, path, data }: NuxtTemplate, destDir: string) {
|
||||||
const srcContents = await fsExtra.readFile(src, 'utf-8')
|
const srcContents = await fsExtra.readFile(src, 'utf-8')
|
||||||
const compiledSrc = lodashTemplate(srcContents, {})(data)
|
const compiledSrc = lodashTemplate(srcContents, {})(data)
|
||||||
const dest = join(destDir, path)
|
const dest = join(destDir, path)
|
||||||
@ -18,7 +18,7 @@ async function compileTemplate({ src, path, data }: NuxtTemplate, destDir: strin
|
|||||||
await fsExtra.writeFile(dest, compiledSrc)
|
await fsExtra.writeFile(dest, compiledSrc)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function compileTemplates(templates: NuxtTemplate[], destDir: string) {
|
export async function compileTemplates (templates: NuxtTemplate[], destDir: string) {
|
||||||
return Promise.all(templates.map(t => compileTemplate(t, destDir)))
|
return Promise.all(templates.map(t => compileTemplate(t, destDir)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ export async function scanTemplates (dir: string, data?: Object) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function watchTemplate(template: NuxtTemplate, watcher: any, cb: Function) {
|
export async function watchTemplate (template: NuxtTemplate, watcher: any, cb: Function) {
|
||||||
template.data = new Proxy(template.data, {
|
template.data = new Proxy(template.data, {
|
||||||
// TODO: deep watch option changes
|
// TODO: deep watch option changes
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import chokidar, { WatchOptions } from 'chokidar'
|
|
||||||
import { relative } from 'path'
|
import { relative } from 'path'
|
||||||
|
import chokidar, { WatchOptions } from 'chokidar'
|
||||||
|
|
||||||
export function createWatcher(dir: string|string[], options?: WatchOptions) {
|
export function createWatcher (dir: string|string[], options?: WatchOptions) {
|
||||||
const watcher = chokidar.watch(dir, {
|
const watcher = chokidar.watch(dir, {
|
||||||
ignored: [],
|
ignored: [],
|
||||||
ignoreInitial: true,
|
ignoreInitial: true,
|
||||||
|
@ -21,7 +21,7 @@ export default class StyleLoader {
|
|||||||
return this.buildContext.buildOptions.extractCSS
|
return this.buildContext.buildOptions.extractCSS
|
||||||
}
|
}
|
||||||
|
|
||||||
get onlyLocals() {
|
get onlyLocals () {
|
||||||
// Not supported anymore by css-loader
|
// Not supported anymore by css-loader
|
||||||
return false // Boolean(this.isServer && this.extractCSS)
|
return false // Boolean(this.isServer && this.extractCSS)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user