Skip to content
Source
Sign inSign up
TanStack/devtools
Open History to see the last commit

plugin.ts

23 lines506 Bytes

1import { Fragment } from 'vue'
2import type { DefineComponent } from 'vue'
3​
4export function createVuePlugin<TComponentProps extends Record<string, any>>(
5 name: string,
6 component: DefineComponent<TComponentProps, {}, unknown>,
7) {
8 function Plugin(props: TComponentProps) {
9 return {
10 name,
11 component,
12 props,
13 }
14 }
15 function NoOpPlugin(props: TComponentProps) {
16 return {
17 name,
18 component: Fragment,
19 props,
20 }
21 }
22 return [Plugin, NoOpPlugin] as const