import { ElementNode, Namespace, TemplateChildNode, ParentNode } from './ast' import { TextModes } from './parse' import { CompilerError } from './errors' import { NodeTransform, DirectiveTransform, TransformContext } from './transform' import { CompilerCompatOptions } from './compat/compatConfig' import { ParserPlugin } from '@babel/parser' export interface ErrorHandlingOptions { onWarn?: (warning: CompilerError) => void onError?: (error: CompilerError) => void } export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptions { /** * e.g. platform native elements, e.g. `
` for browsers */ isNativeTag?: (tag: string) => boolean /** * e.g. native elements that can self-close, e.g. ``, `
`, `
` */ isVoidTag?: (tag: string) => boolean /** * e.g. elements that should preserve whitespace inside, e.g. `
`
   */
  isPreTag?: (tag: string) => boolean
  /**
   * Platform-specific built-in components e.g. ``
   */
  isBuiltInComponent?: (tag: string) => symbol | void
  /**
   * Separate option for end users to extend the native elements list
   */
  isCustomElement?: (tag: string) => boolean | void
  /**
   * Get tag namespace
   */
  getNamespace?: (tag: string, parent: ElementNode | undefined) => Namespace
  /**
   * Get text parsing mode for this element
   */
  getTextMode?: (
    node: ElementNode,
    parent: ElementNode | undefined
  ) => TextModes
  /**
   * @default ['{{', '}}']
   */
  delimiters?: [string, string]
  /**
   * Whitespace handling strategy
   */
  whitespace?: 'preserve' | 'condense'
  /**
   * Only needed for DOM compilers
   */
  decodeEntities?: (rawText: string, asAttr: boolean) => string
  /**
   * Whether to keep comments in the templates AST.
   * This defaults to `true` in development and `false` in production builds.
   */
  comments?: boolean
}

export type HoistTransform = (
  children: TemplateChildNode[],
  context: TransformContext,
  parent: ParentNode
) => void

export const enum BindingTypes {
  /**
   * returned from data()
   */
  DATA = 'data',
  /**
   * declared as a prop
   */
  PROPS = 'props',
  /**
   * a local alias of a `