index.d.mts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import * as t from '@babel/types';
  2. import * as BabelCore from '@babel/core';
  3. import { NodePath } from '@babel/traverse';
  4. type State = {
  5. get: (name: string) => any;
  6. set: (name: string, value: any) => any;
  7. opts: VueJSXPluginOptions;
  8. file: BabelCore.BabelFile;
  9. };
  10. 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. declare const _default: ({ types }: typeof BabelCore) => {
  25. name: string;
  26. inherits: any;
  27. visitor: {
  28. Program: {
  29. enter(path: NodePath<t.Program>, state: State): void;
  30. exit(path: NodePath<t.Program>): void;
  31. };
  32. JSXFragment: {
  33. enter(path: BabelCore.NodePath<t.JSXElement>, state: State): void;
  34. };
  35. JSXElement: {
  36. exit(path: BabelCore.NodePath<t.JSXElement>, state: State): void;
  37. };
  38. };
  39. };
  40. export { VueJSXPluginOptions, _default as default };