compiler.js 2.0 KB

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