compiler.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. declare type CompilerOptions = {
  2. warn?: Function,
  3. expectHTML?: boolean,
  4. directives?: { [key: string]: Function },
  5. isUnaryTag?: (tag: string) => ?boolean,
  6. isReservedTag?: (tag: string) => ?boolean,
  7. mustUseProp?: (attr: string) => ?boolean,
  8. getTagNamespace?: (tag: string) => ?string,
  9. delimiters?: [string, string]
  10. }
  11. declare type ASTElementHandler = {
  12. value: string,
  13. modifiers: ?{ [key: string]: true }
  14. }
  15. declare type ASTElementHandlers = {
  16. [key: string]: ASTElementHandler | Array<ASTElementHandler>
  17. }
  18. declare type ASTElementHooks = { [key: string]: Array<string> }
  19. declare type ASTText = {
  20. text?: string,
  21. expression?: string
  22. }
  23. declare type ASTElement = {
  24. tag: string,
  25. attrsList: Array<{ name: string, value: string }>,
  26. attrsMap: { [key: string]: string | null },
  27. parent: ASTElement | void,
  28. children: Array<any>, // for flexibility
  29. static?: boolean,
  30. staticRoot?: true,
  31. text?: string,
  32. attrs?: Array<{ name: string, value: string }>,
  33. props?: Array<{ name: string, value: string }>,
  34. staticAttrs?: Array<{ name: string, value: string }>,
  35. plain?: boolean,
  36. pre?: true,
  37. ns?: string,
  38. component?: string,
  39. inlineTemplate?: true,
  40. slotName?: ?string,
  41. slotTarget?: ?string,
  42. render?: true,
  43. renderMethod?: ?string,
  44. renderArgs?: ?string,
  45. if?: string | null,
  46. else?: true,
  47. elseBlock?: ASTElement,
  48. for?: string | null,
  49. key?: string,
  50. alias?: string,
  51. iterator?: string,
  52. staticClass?: string,
  53. classBinding?: string,
  54. styleBinding?: string,
  55. hooks?: ASTElementHooks,
  56. events?: ASTElementHandlers,
  57. transition?: string | true,
  58. transitionOnAppear?: boolean,
  59. directives?: Array<{
  60. name: string,
  61. value: ?string,
  62. arg: ?string,
  63. modifiers: ?{ [key: string]: true }
  64. }>,
  65. forbidden?: true,
  66. once?: true
  67. }