| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- declare type CompilerOptions = {
- warn?: Function, // allow customizing warning in different environments, e.g. node
- isIE?: boolean, // for detecting IE SVG innerHTML bug
- expectHTML?: boolean, // only false for non-web builds
- modules?: Array<ModuleOptions>, // platform specific modules, e.g. style, class
- staticKeys?: string, // a list of AST properties to be considered static, for optimization
- directives?: { [key: string]: Function }, // platform specific directives
- isUnaryTag?: (tag: string) => ?boolean, // check if a tag is unary for the platform
- isReservedTag?: (tag: string) => ?boolean, // check if a tag is a native for the platform
- mustUseProp?: (attr: string) => ?boolean, // check if an attribute should be bound as a property
- getTagNamespace?: (tag: string) => ?string, // check the namespace for a tag
- transforms?: Array<Function>, // a list of transforms on parsed AST before codegen
- // runtime user-configurable
- delimiters?: [string, string] // template delimiters
- }
- declare type CompiledResult = {
- ast: ?ASTElement,
- render: string,
- staticRenderFns: Array<string>,
- errors?: Array<string>
- }
- declare type CompiledFunctionResult = {
- render: Function,
- staticRenderFns: Array<Function>
- }
- declare type ModuleOptions = {
- transformNode: (el: ASTElement) => void, // transform an element's AST node
- genData: (el: ASTElement) => string, // generate extra data string for an element
- transformCode?: (el: ASTElement, code: string) => string, // further transform generated code for an element
- staticKeys?: Array<string> // AST properties to be considered static
- }
- declare type ASTElementHandler = {
- value: string,
- modifiers: ?{ [key: string]: true }
- }
- declare type ASTElementHandlers = {
- [key: string]: ASTElementHandler | Array<ASTElementHandler>
- }
- declare type ASTElementHooks = { [key: string]: Array<string> }
- declare type ASTDirective = {
- name: string,
- value: ?string,
- arg: ?string,
- modifiers: ?{ [key: string]: true }
- }
- declare type ASTNode = ASTElement | ASTText | ASTExpression
- declare type ASTElement = {
- type: 1,
- tag: string,
- attrsList: Array<{ name: string, value: string }>,
- attrsMap: { [key: string]: string | null },
- parent: ASTElement | void,
- children: Array<ASTNode>,
- static?: boolean,
- staticRoot?: boolean,
- text?: string,
- attrs?: Array<{ name: string, value: string }>,
- props?: Array<{ name: string, value: string }>,
- staticAttrs?: Array<{ name: string, value: string }>,
- plain?: boolean,
- pre?: true,
- ns?: string,
- component?: string,
- keepAlive?: boolean,
- inlineTemplate?: true,
- transitionMode?: string | null,
- slotName?: ?string,
- slotTarget?: ?string,
- ref?: string,
- refInFor?: boolean,
- render?: true,
- renderMethod?: ?string,
- renderArgs?: ?string,
- if?: string | null,
- else?: true,
- elseBlock?: ASTElement,
- for?: string | null,
- key?: string,
- alias?: string,
- iterator?: string,
- staticClass?: string,
- classBinding?: string,
- styleBinding?: string,
- hooks?: ASTElementHooks,
- events?: ASTElementHandlers,
- transition?: string | true,
- transitionOnAppear?: boolean,
- directives?: Array<ASTDirective>,
- forbidden?: true,
- once?: true
- }
- declare type ASTExpression = {
- type: 2,
- expression: string,
- text: string,
- static?: boolean
- }
- declare type ASTText = {
- type: 3,
- text: string,
- static?: boolean
- }
- // SFC-parser related declarations
- declare module 'de-indent' {
- declare var exports: {
- (str: string): string;
- }
- }
- declare module 'source-map' {
- declare class SourceMapGenerator {
- setSourceContent(filename: string, content: string): void;
- addMapping(mapping: Object): void;
- toString(): string;
- }
- }
- // an object format describing a single-file component.
- declare type SFCDescriptor = {
- template: ?SFCBlock,
- script: ?SFCBlock,
- styles: Array<SFCBlock>
- }
- declare type SFCBlock = {
- type: string,
- content: string,
- start?: number,
- end?: number,
- lang?: string,
- src?: string,
- scoped?: boolean,
- map?: Object
- }
|