forked from nuxt/nuxt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.ts
72 lines (61 loc) · 2.01 KB
/
nuxt.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import type { Hookable } from 'hookable'
import type { Ignore } from 'ignore'
import type { NuxtHooks, NuxtLayout, NuxtMiddleware } from './hooks'
import type { Component } from './components'
import type { NuxtOptions } from './config'
export interface Nuxt {
// Private fields.
_version: string
_ignore?: Ignore
/** The resolved Nuxt configuration. */
options: NuxtOptions
hooks: Hookable<NuxtHooks>
hook: Nuxt['hooks']['hook']
callHook: Nuxt['hooks']['callHook']
addHooks: Nuxt['hooks']['addHooks']
ready: () => Promise<void>
close: () => Promise<void>
/** The production or development server. */
server?: any
vfs: Record<string, string>
apps: Record<string, NuxtApp>
}
export interface NuxtTemplate<Options = Record<string, any>> {
/** resolved output file path (generated) */
dst?: string
/** The target filename once the template is copied into the Nuxt buildDir */
filename?: string
/** An options object that will be accessible within the template via `<% options %>` */
options?: Options
/** The resolved path to the source file to be template */
src?: string
/** Provided compile option instead of src */
getContents?: (data: Options) => string | Promise<string>
/** Write to filesystem */
write?: boolean
}
export interface ResolvedNuxtTemplate<Options = Record<string, any>> extends NuxtTemplate<Options> {
filename: string
dst: string
}
export interface NuxtPlugin {
/** @deprecated use mode */
ssr?: boolean
src: string
mode?: 'all' | 'server' | 'client'
}
export interface NuxtApp {
mainComponent?: string | null
rootComponent?: string | null
errorComponent?: string | null
dir: string
extensions: string[]
plugins: NuxtPlugin[]
components: Component[]
layouts: Record<string, NuxtLayout>
middleware: NuxtMiddleware[]
templates: NuxtTemplate[]
configs: string[]
}
type _TemplatePlugin<Options> = Omit<NuxtPlugin, 'src'> & NuxtTemplate<Options>
export interface NuxtPluginTemplate<Options = Record<string, any>> extends _TemplatePlugin<Options> { }