index.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import * as t from '@babel/types';
  2. import * as BabelCore from '@babel/core';
  3. import { NodePath } from '@babel/traverse';
  4. export declare type State = {
  5. get: (name: string) => any;
  6. set: (name: string, value: any) => any;
  7. opts: VueJSXPluginOptions;
  8. file: BabelCore.BabelFile;
  9. };
  10. export interface VueJSXPluginOptions {
  11. /** transform `on: { click: xx }` to `onClick: xxx` */
  12. transformOn?: boolean;
  13. /** enable optimization or not. */
  14. optimize?: boolean;
  15. /** merge static and dynamic class / style attributes / onXXX handlers */
  16. mergeProps?: boolean;
  17. /** configuring custom elements */
  18. isCustomElement?: (tag: string) => boolean;
  19. /** enable object slots syntax */
  20. enableObjectSlots?: boolean;
  21. /** Replace the function used when compiling JSX expressions */
  22. pragma?: string;
  23. }
  24. export declare type ExcludesBoolean = <T>(x: T | false | true) => x is T;
  25. declare const _default: ({ types }: typeof BabelCore) => {
  26. name: string;
  27. inherits: any;
  28. visitor: {
  29. Program: {
  30. enter(path: NodePath<t.Program>, state: State): void;
  31. exit(path: NodePath<t.Program>): void;
  32. };
  33. JSXFragment: {
  34. enter(path: BabelCore.NodePath<t.JSXElement>, state: State): void;
  35. };
  36. JSXElement: {
  37. exit(path: BabelCore.NodePath<t.JSXElement>, state: State): void;
  38. };
  39. };
  40. };
  41. export default _default;