diff --git a/packages/babel-plugin-jsx/src/index.ts b/packages/babel-plugin-jsx/src/index.ts index ce1fe61..3a20696 100644 --- a/packages/babel-plugin-jsx/src/index.ts +++ b/packages/babel-plugin-jsx/src/index.ts @@ -10,14 +10,19 @@ import sugarFragment from './sugar-fragment'; export type State = { get: (name: string) => any; set: (name: string, value: any) => any; - opts: Opts; + opts: VueJSXPluginOptions; } -export interface Opts { +export interface VueJSXPluginOptions { + /** transform `on: { click: xx }` to `onClick: xxx` */ transformOn?: boolean; + /** enable optimization or not. */ optimize?: boolean; + /** merge static and dynamic class / style attributes / onXXX handlers */ mergeProps?: boolean; + /** configuring custom elements */ isCustomElement?: (tag: string) => boolean; + /** enable object slots syntax */ enableObjectSlots?: boolean; } diff --git a/packages/babel-plugin-jsx/test/snapshot.test.ts b/packages/babel-plugin-jsx/test/snapshot.test.ts index 8011805..e88d3db 100644 --- a/packages/babel-plugin-jsx/test/snapshot.test.ts +++ b/packages/babel-plugin-jsx/test/snapshot.test.ts @@ -1,5 +1,5 @@ import { transform } from '@babel/core'; -import JSX, { Opts } from '../src'; +import JSX, { VueJSXPluginOptions } from '../src'; interface Test { name: string; @@ -7,7 +7,7 @@ interface Test { } const transpile = ( - source: string, options: Opts = {}, + source: string, options: VueJSXPluginOptions = {}, ) => new Promise((resolve, reject) => transform( source, { diff --git a/packages/babel-plugin-jsx/tsconfig.json b/packages/babel-plugin-jsx/tsconfig.json index 608bfba..269e1fb 100644 --- a/packages/babel-plugin-jsx/tsconfig.json +++ b/packages/babel-plugin-jsx/tsconfig.json @@ -4,11 +4,9 @@ "rootDirs": ["./src"], "outDir": "dist", "downlevelIteration": true, - "types": ["node", "jest"] + "types": ["node", "jest"], + "declaration": true }, - "include": [ - "src/**/*", - "global.d.ts" - ], + "include": ["src/**/*", "global.d.ts"], "exclude": ["node_modules"] }