index.d.mts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import "@babel/types";
  2. import { Options } from "@vue/babel-plugin-resolve-type";
  3. import * as BabelCore from "@babel/core";
  4. //#region src/interface.d.ts
  5. type State = {
  6. get: (name: string) => any;
  7. set: (name: string, value: any) => any;
  8. opts: VueJSXPluginOptions;
  9. file: BabelCore.BabelFile;
  10. };
  11. interface VueJSXPluginOptions {
  12. /** transform `on: { click: xx }` to `onClick: xxx` */
  13. transformOn?: boolean;
  14. /** enable optimization or not. */
  15. optimize?: boolean;
  16. /** merge static and dynamic class / style attributes / onXXX handlers */
  17. mergeProps?: boolean;
  18. /** configuring custom elements */
  19. isCustomElement?: (tag: string) => boolean;
  20. /** enable object slots syntax */
  21. enableObjectSlots?: boolean;
  22. /** Replace the function used when compiling JSX expressions */
  23. pragma?: string;
  24. /**
  25. * (**Experimental**) Infer component metadata from types (e.g. `props`, `emits`, `name`)
  26. * @default false
  27. */
  28. resolveType?: Options | boolean;
  29. }
  30. //#endregion
  31. //#region src/index.d.ts
  32. declare const plugin: (api: object, options: VueJSXPluginOptions | null | undefined, dirname: string) => BabelCore.PluginObj<State>;
  33. //#endregion
  34. export { VueJSXPluginOptions, plugin as default };