UNPKG

1.31 kBPlain TextView Raw
1import { SFCDescriptor } from './parse'
2
3export interface StartOfSourceMap {
4 file?: string
5 sourceRoot?: string
6}
7
8export interface RawSourceMap extends StartOfSourceMap {
9 version: string
10 sources: string[]
11 names: string[]
12 sourcesContent?: string[]
13 mappings: string
14}
15
16export interface VueTemplateCompiler {
17 parseComponent(source: string, options?: any): SFCDescriptor
18
19 compile(
20 template: string,
21 options: VueTemplateCompilerOptions
22 ): VueTemplateCompilerResults
23
24 ssrCompile(
25 template: string,
26 options: VueTemplateCompilerOptions
27 ): VueTemplateCompilerResults
28}
29
30// we'll just shim this much for now - in the future these types
31// should come from vue-template-compiler directly, or this package should be
32// part of the vue monorepo.
33export interface VueTemplateCompilerOptions {
34 modules?: Object[]
35 outputSourceRange?: boolean
36 whitespace?: 'preserve' | 'condense'
37 directives?: { [key: string]: Function }
38}
39
40export interface VueTemplateCompilerParseOptions {
41 pad?: 'line' | 'space'
42}
43
44export interface ErrorWithRange {
45 msg: string
46 start: number
47 end: number
48}
49
50export interface VueTemplateCompilerResults {
51 ast: Object | undefined
52 render: string
53 staticRenderFns: string[]
54 errors: (string | ErrorWithRange)[]
55 tips: (string | ErrorWithRange)[]
56}