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 = {
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;
}

View File

@ -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,
{

View File

@ -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"]
}