Open Teages opened 1 week ago
Attention: Patch coverage is 88.75740%
with 19 lines
in your changes missing coverage. Please review.
Project coverage is 80.69%. Comparing base (
9000888
) to head (31e93f0
). Report is 57 commits behind head on main.
Files with missing lines | Patch % | Lines |
---|---|---|
src/loaders/vue.ts | 87.58% | 19 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
according to tests in https://github.com/unjs/mkdist/pull/251/commits/2452db9dda81d00dd61214f1ad8592959b6c4f6d I think global declare pollution may be a configuration issue (and should not be handled in this pr), so I think this PR is ready for review.
now fixed
Refactor the vue loader with vue/compiler-sfc.
Resolve #209 #249 #243 #14 #15 Close #210
Some break changes:
<script setup lang="*">
, but they are still human readableBut I think it is worth.
also updated test.
It is a draft pull request because I found some timesvue-tsc^2.1.0
will add the vue global declare in dts output for no resaon.It happens in my own package Teages/mkdist-vue-loader but after I merged back to mkdist it disappeared....fixed with https://github.com/unjs/mkdist/pull/251/commits/31e93f077e31fa32ba3caa3081cc4d321a4abc78
tested with https://github.com/unjs/mkdist/pull/251/commits/2452db9dda81d00dd61214f1ad8592959b6c4f6d
Example
```ts import type { Data } from './type'; export interface PropsData { name: string; data: Data; } declare const _default: import("vue").DefineComponent: never : T extends (props: infer P, ...args: any) => any ? P : {}; type __VLS_IsFunction = K extends keyof T ? __VLS_IsAny extends false ? unknown extends T[K] ? false : true : false : false;
type __VLS_UnionToIntersection = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
type __VLS_OverloadUnionInner = U & T extends (...args: infer A) => infer R ? U extends T ? never : __VLS_OverloadUnionInner & U & ((...args: A) => R)> | ((...args: A) => R) : never;
type __VLS_OverloadUnion = Exclude<__VLS_OverloadUnionInner<(() => never) & T>, T extends () => never ? never : () => never>;
type __VLS_ConstructorOverloads = __VLS_OverloadUnion extends infer F ? F extends (event: infer E, ...args: infer A) => any ? {
[K in E & string]: (...args: A) => void;
} : never : never;
type __VLS_NormalizeEmits = __VLS_PrettifyGlobal<__VLS_UnionToIntersection<__VLS_ConstructorOverloads & {
[K in keyof T]: T[K] extends any[] ? {
(...args: T[K]): void;
} : never;
}>>;
type __VLS_PrettifyGlobal = {
[K in keyof T]: T[K];
} & {};
function __VLS_getVForSourceType(source: number): [number, number, number][];
function __VLS_getVForSourceType(source: string): [string, number, number][];
function __VLS_getVForSourceType(source: T): [
item: T[number],
key: number,
index: number
][];
function __VLS_getVForSourceType;
}>(source: T): [
item: T extends {
[Symbol.iterator](): Iterator;
} ? T1 : never,
key: number,
index: undefined
][];
function __VLS_getVForSourceType;
}>(source: T): [
item: number | (Exclude extends {
[Symbol.iterator](): Iterator;
} ? T1 : never),
key: number,
index: undefined
][];
function __VLS_getVForSourceType(source: T): [
item: T[keyof T],
key: keyof T,
index: number
][];
function __VLS_getSlotParams(slot: T): Parameters<__VLS_PickNotAny, (...args: any[]) => any>>;
function __VLS_getSlotParam(slot: T): Parameters<__VLS_PickNotAny, (...args: any[]) => any>>[0];
function __VLS_directiveAsFunction(dir: T): T extends (...args: any) => any ? T | __VLS_unknownDirective : NonNullable<(T & Record)['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']>;
function __VLS_withScope(ctx: T, scope: K): ctx is T & K;
function __VLS_makeOptional(t: T): {
[K in keyof T]?: T[K];
};
function __VLS_nonNullable(t: T): T extends null | undefined ? never : T;
function __VLS_asFunctionalComponent any ? InstanceType : unknown>(t: T, instance?: K): T extends new (...args: any) => any ? (props: (K extends {
$props: infer Props;
} ? Props : any) & Record, ctx?: any) => __VLS_Element & {
__ctx?: {
attrs?: any;
slots?: K extends {
$slots: infer Slots;
} ? Slots : any;
emit?: K extends {
$emit: infer Emit;
} ? Emit : any;
} & {
props?: (K extends {
$props: infer Props;
} ? Props : any) & Record;
expose?(exposed: K): void;
};
} : T extends () => any ? (props: {}, ctx?: any) => ReturnType : T extends (...args: any) => any ? T : (_: {} & Record, ctx?: any) => {
__ctx?: {
attrs?: any;
expose?: any;
slots?: any;
emit?: any;
props?: {} & Record;
};
};
function __VLS_elementAsFunction(tag: T, endTag?: T): (_: T & Record) => void;
function __VLS_functionalComponentArgsRest any>(t: T): 2 extends Parameters['length'] ? [any] : [];
function __VLS_pickFunctionalComponentCtx(comp: T, compInstance: K): NonNullable<__VLS_PickNotAny<'__ctx' extends keyof __VLS_PickNotAny ? K extends {
__ctx?: infer Ctx;
} ? Ctx : never : any, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any>>;
function __VLS_normalizeSlot
(s: S): S extends () => infer R ? (props: {}) => R : S; function __VLS_tryAsConstant(t: T): T;
}
```