Skip to content

Commit 14d25cd

Browse files
committed
ci: use ni
1 parent 3f53d93 commit 14d25cd

File tree

2 files changed

+278
-4
lines changed

2 files changed

+278
-4
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Set node
2525
uses: actions/setup-node@v4
2626
with:
27-
node-version: lts/*
27+
node-version: 20.x
2828
cache: pnpm
2929
registry-url: 'https://registry.npmjs.org'
3030

@@ -33,11 +33,14 @@ jobs:
3333
env:
3434
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3535

36-
- name: Install Dependencies
37-
run: pnpm i
36+
- name: Setup
37+
run: npm i -g @antfu/ni
38+
39+
- name: Install
40+
run: nci
3841

3942
- name: Build
40-
run: pnpm build
43+
run: nr build
4144

4245
- name: Publish to NPM
4346
run: pnpm -r publish --access public --no-git-checks

playground/src/root_tsx.tsx

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
/* eslint-disable unused-imports/no-unused-vars */
2+
/* eslint-disable @typescript-eslint/no-unused-expressions */
3+
/* eslint-disable @typescript-eslint/consistent-type-assertions */
4+
import { computed, defineComponent, defineVaporComponent } from 'vue'
5+
6+
const Comp = (
7+
props: { id: 1 },
8+
{
9+
slots,
10+
}: {
11+
attrs: any
12+
emit: any
13+
slots: { default: (props: { id: 1 }) => [] }
14+
expose: (exposed: { id: 1 }) => void
15+
},
16+
) => {
17+
const A = (<a href=""></a>) as unknown as __InferJsxElement<'a'>
18+
A.href = '#foo'
19+
return A
20+
}
21+
const comp = (<Comp />) as unknown as __InferJsxElement<typeof Comp>
22+
comp.slots
23+
comp.exposed!.id
24+
comp.block
25+
comp === ({} as HTMLAnchorElement)
26+
27+
const VaporComp = (() => {
28+
const __setup = (
29+
__props: typeof __ctx.props & { id: number },
30+
__context?: typeof __ctx.context,
31+
__ctx = {} as Awaited<ReturnType<typeof __fn>>,
32+
__fn = (props: { id: number }) => {
33+
const __slots = defineSlots({
34+
default: (props: { id: 1 }) => [],
35+
})
36+
const __exposed = defineExpose({
37+
id: computed(() => 1),
38+
})
39+
const __render = (
40+
<div>{props.id}</div>
41+
) as unknown as __InferJsxElement<'div'>
42+
return {} as {
43+
props: {}
44+
context: {} & {
45+
slots: Partial<typeof __slots>
46+
expose: (exposed: typeof __exposed) => void
47+
attrs: Record<string, any>
48+
}
49+
render: typeof __render
50+
}
51+
},
52+
) => __ctx.render
53+
type __Setup = typeof __setup
54+
type __Props = Parameters<__Setup>[0]
55+
type __Slots = Parameters<__Setup>[1] extends
56+
| { slots?: infer Slots }
57+
| undefined
58+
? Slots
59+
: {}
60+
type __Exposed = Parameters<__Setup>[1] extends
61+
| { expose?: (exposed: infer Exposed) => any }
62+
| undefined
63+
? Exposed
64+
: {}
65+
const __component = // @ts-ignore
66+
(defineVaporComponent, await import('vue-jsx-vapor')).defineVaporComponent({
67+
...({} as {
68+
setup: (props: __Props) => __Exposed
69+
render: () => ReturnType<__Setup>
70+
slots: __Slots
71+
}),
72+
})
73+
return {} as Omit<typeof __component, 'constructor'> & {
74+
new (props?: __Props): InstanceType<typeof __component> & {
75+
/** @deprecated This is only a type when used in Vapor Instances. */
76+
$props: __Props
77+
}
78+
}
79+
})()
80+
const vaporComp = (
81+
<VaporComp
82+
id={1}
83+
v-slots={{ default: ({ id }) => <></> } satisfies typeof __VLS_ctx_0.slots}
84+
/>
85+
) as unknown as __InferJsxElement<typeof VaporComp>
86+
vaporComp.props.id
87+
vaporComp.exposeProxy?.id === ({} as number)
88+
vaporComp.block.style
89+
90+
const VDomComp = (() => {
91+
const __setup = (
92+
__props: typeof __ctx.props & { id: number },
93+
__context?: typeof __ctx.context,
94+
__ctx = {} as Awaited<ReturnType<typeof __fn>>,
95+
__fn = (props: { id: number }) => {
96+
const __slots = defineSlots({
97+
default: (props: { id: 1 }) => <div />,
98+
})
99+
const __render: () => JSX.Element = () =>
100+
(<div>{props.id}</div>) as unknown as __InferJsxElement<'div'>
101+
return {} as {
102+
props: {}
103+
context: {} & {
104+
slots: Partial<typeof __slots>
105+
expose: (exposed: {}) => void
106+
attrs: Record<string, any>
107+
}
108+
render: typeof __render
109+
}
110+
},
111+
) => __ctx.render
112+
type __Setup = typeof __setup
113+
type __Props = Parameters<__Setup>[0]
114+
type __Slots = Parameters<__Setup>[1] extends
115+
| { slots?: infer Slots }
116+
| undefined
117+
? Slots
118+
: {}
119+
type __Exposed = Parameters<__Setup>[1] extends
120+
| { expose?: (exposed: infer Exposed) => any }
121+
| undefined
122+
? Exposed
123+
: {}
124+
const __component = defineComponent({
125+
...({} as {
126+
setup: (props: __Props) => __Exposed
127+
render: () => ReturnType<__Setup>
128+
slots: import('vue').SlotsType<__Slots>
129+
}),
130+
})
131+
return {} as Omit<typeof __component, 'constructor'> & {
132+
new (props?: __Props): InstanceType<typeof __component> & {}
133+
}
134+
})()
135+
const vdompComp = (
136+
<VDomComp
137+
id={1}
138+
v-slots={{ default: ({}) => <></> } satisfies typeof __VLS_ctx_1.slots}
139+
/>
140+
) as unknown as __InferJsxElement<typeof VDomComp>
141+
vdompComp.props
142+
143+
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false
144+
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A
145+
declare function __VLS_asFunctionalComponent<
146+
T,
147+
K = T extends new (...args: any) => any ? InstanceType<T> : unknown,
148+
>(
149+
t: T,
150+
instance?: K,
151+
): T extends new (...args: any) => any
152+
? (
153+
props: K extends { $props: infer Props }
154+
? Props
155+
: K extends { props: infer Props }
156+
? Props
157+
: any,
158+
ctx?: any,
159+
) => JSX.Element & {
160+
__ctx: {
161+
attrs?: Record<string, any>
162+
props: K extends { $props: infer Props }
163+
? Props
164+
: K extends { props: infer Props }
165+
? Props
166+
: any
167+
slots?: K extends { $slots: infer Slots }
168+
? Slots
169+
: K extends { slots: infer Slots }
170+
? Slots
171+
: any
172+
emit?: K extends { $emit: infer Emit }
173+
? Emit
174+
: K extends { emit: infer Emit }
175+
? Emit
176+
: any
177+
expose?: (
178+
exposed: K extends { exposeProxy: infer Exposed }
179+
? keyof Exposed extends never
180+
? K
181+
: Exposed
182+
: K,
183+
) => void
184+
}
185+
}
186+
: T extends () => any
187+
? (props: {}, ctx?: any) => ReturnType<T>
188+
: T extends (...args: any) => any
189+
? T
190+
: (
191+
_: {},
192+
ctx?: any,
193+
) => {
194+
__ctx: {
195+
attrs?: any
196+
expose?: any
197+
slots?: any
198+
emit?: any
199+
}
200+
}
201+
const __VLS_nativeElements = {
202+
...({} as SVGElementTagNameMap),
203+
...({} as HTMLElementTagNameMap),
204+
}
205+
declare function __VLS_getFunctionalComponentCtx<T, K, const S>(
206+
comp: T,
207+
compInstance: K,
208+
s: S,
209+
): S extends keyof typeof __VLS_nativeElements
210+
? { expose: (exposed: (typeof __VLS_nativeElements)[S]) => any }
211+
: '__ctx' extends keyof __VLS_PickNotAny<K, {}>
212+
? K extends { __ctx?: infer Ctx }
213+
? Ctx
214+
: never
215+
: T extends (props: infer P, ctx: infer Ctx) => any
216+
? { props: P } & Ctx
217+
: {}
218+
219+
const __VLS_ctx_0 = __VLS_getFunctionalComponentCtx(
220+
VaporComp,
221+
__VLS_asFunctionalComponent(VaporComp)({ id: 1 }),
222+
'VaporComp',
223+
)
224+
225+
const __VLS_ctx_1 = __VLS_getFunctionalComponentCtx(
226+
VDomComp,
227+
__VLS_asFunctionalComponent(VDomComp)({ id: 1 }),
228+
'VDomComp',
229+
)
230+
231+
declare const { defineModel }: typeof import('vue')
232+
declare function defineSlots<T extends Record<string, any>>(): Partial<T>
233+
declare function defineSlots<T extends Record<string, any>>(slots: T): T
234+
declare function defineExpose<
235+
Exposed extends Record<string, any> = Record<string, any>,
236+
>(exposed?: Exposed): Exposed
237+
declare const defineStyle: {
238+
<T>(...args: __StyleArgs): T
239+
scss: <T>(...args: __StyleArgs) => T
240+
sass: <T>(...args: __StyleArgs) => T
241+
stylus: <T>(...args: __StyleArgs) => T
242+
less: <T>(...args: __StyleArgs) => T
243+
postcss: <T>(...args: __StyleArgs) => T
244+
}
245+
type __StyleArgs = [style: string, options?: { scoped?: boolean }]
246+
247+
type __InferJsxElement<T> = T extends keyof HTMLElementTagNameMap
248+
? HTMLElementTagNameMap[T]
249+
: T extends keyof SVGElementTagNameMap
250+
? SVGElementTagNameMap[T]
251+
: T extends (
252+
props: infer Props,
253+
ctx: {
254+
slots: infer Slots extends Record<string, any>
255+
expose: (exposed: infer Exposed extends Record<string, any>) => void
256+
attrs: any
257+
emit: any
258+
},
259+
) => infer TypeBlock
260+
? import('vue-jsx-vapor').VaporComponentInstance<
261+
Props,
262+
{},
263+
Slots,
264+
Exposed,
265+
TypeBlock
266+
>
267+
: T extends { new (...args: any[]): infer Instance }
268+
? Instance extends { $: any }
269+
? import('vue').VNode
270+
: Instance
271+
: JSX.Element

0 commit comments

Comments
 (0)