feat: export interface VueJSXPluginOptions

This commit is contained in:
Amour1688 2021-01-09 21:18:02 +08:00
parent 764afcdb3c
commit 689ceea4c0
3 changed files with 12 additions and 9 deletions

View File

@ -10,14 +10,19 @@ import sugarFragment from './sugar-fragment';
export type State = { export type State = {
get: (name: string) => any; get: (name: string) => any;
set: (name: string, value: any) => 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; transformOn?: boolean;
/** enable optimization or not. */
optimize?: boolean; optimize?: boolean;
/** merge static and dynamic class / style attributes / onXXX handlers */
mergeProps?: boolean; mergeProps?: boolean;
/** configuring custom elements */
isCustomElement?: (tag: string) => boolean; isCustomElement?: (tag: string) => boolean;
/** enable object slots syntax */
enableObjectSlots?: boolean; enableObjectSlots?: boolean;
} }

View File

@ -1,5 +1,5 @@
import { transform } from '@babel/core'; import { transform } from '@babel/core';
import JSX, { Opts } from '../src'; import JSX, { VueJSXPluginOptions } from '../src';
interface Test { interface Test {
name: string; name: string;
@ -7,7 +7,7 @@ interface Test {
} }
const transpile = ( const transpile = (
source: string, options: Opts = {}, source: string, options: VueJSXPluginOptions = {},
) => new Promise((resolve, reject) => transform( ) => new Promise((resolve, reject) => transform(
source, source,
{ {

View File

@ -4,11 +4,9 @@
"rootDirs": ["./src"], "rootDirs": ["./src"],
"outDir": "dist", "outDir": "dist",
"downlevelIteration": true, "downlevelIteration": true,
"types": ["node", "jest"] "types": ["node", "jest"],
"declaration": true
}, },
"include": [ "include": ["src/**/*", "global.d.ts"],
"src/**/*",
"global.d.ts"
],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }