chore: bump detypes (#548)
* chore: bump detypes * test: update snapshot * test: add test to check all type references --------- Co-authored-by: zernonia <zernonia@gmail.com>
This commit is contained in:
parent
61dcd63ef2
commit
175762a959
|
|
@ -42,6 +42,7 @@
|
||||||
"pub:next": "pnpm build && pnpm publish --no-git-checks --access public --tag next",
|
"pub:next": "pnpm build && pnpm publish --no-git-checks --access public --tag next",
|
||||||
"pub:release": "pnpm build && pnpm publish --no-git-checks --access public",
|
"pub:release": "pnpm build && pnpm publish --no-git-checks --access public",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
|
"test:update": "vitest run -u",
|
||||||
"test:ui": "vitest --ui"
|
"test:ui": "vitest --ui"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|
@ -55,7 +56,7 @@
|
||||||
"c12": "^1.10.0",
|
"c12": "^1.10.0",
|
||||||
"commander": "^12.0.0",
|
"commander": "^12.0.0",
|
||||||
"consola": "^3.2.3",
|
"consola": "^3.2.3",
|
||||||
"detype": "npm:detypes@^0.7.9",
|
"detype": "npm:detypes@^0.8.0",
|
||||||
"diff": "^5.2.0",
|
"diff": "^5.2.0",
|
||||||
"fs-extra": "^11.2.0",
|
"fs-extra": "^11.2.0",
|
||||||
"https-proxy-agent": "^7.0.4",
|
"https-proxy-agent": "^7.0.4",
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,44 @@
|
||||||
exports[`transform css vars 1`] = `
|
exports[`transform css vars 1`] = `
|
||||||
"<script setup lang="ts"></script>
|
"<script setup lang="ts"></script>
|
||||||
<template>
|
<template>
|
||||||
<div class="bg-background hover:bg-muted text-primary-foreground sm:focus:text-accent-foreground">foo</div>
|
<div
|
||||||
</template>""
|
class="bg-background hover:bg-muted text-primary-foreground sm:focus:text-accent-foreground"
|
||||||
|
>
|
||||||
|
foo
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
"
|
||||||
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`transform css vars 2`] = `
|
exports[`transform css vars 2`] = `
|
||||||
"<script setup lang="ts"></script>
|
"<script setup lang="ts"></script>
|
||||||
<template>
|
<template>
|
||||||
<div class="bg-white hover:bg-stone-100 text-stone-50 sm:focus:text-stone-900 dark:bg-stone-950 dark:hover:bg-stone-800 dark:text-stone-900 dark:sm:focus:text-stone-50">foo</div>
|
<div
|
||||||
</template>""
|
class="bg-white hover:bg-stone-100 text-stone-50 sm:focus:text-stone-900 dark:bg-stone-950 dark:hover:bg-stone-800 dark:text-stone-900 dark:sm:focus:text-stone-50"
|
||||||
|
>
|
||||||
|
foo
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
"
|
||||||
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`transform css vars 3`] = `
|
exports[`transform css vars 3`] = `
|
||||||
"<script setup lang="ts"></script>
|
"<script setup lang="ts"></script>
|
||||||
<template>
|
<template>
|
||||||
<div :class="cn('bg-white hover:bg-stone-100 dark:bg-stone-950 dark:hover:bg-stone-800', true && 'text-stone-50 sm:focus:text-stone-900 dark:text-stone-900 dark:sm:focus:text-stone-50')">foo</div>
|
<div
|
||||||
</template>""
|
:class="
|
||||||
|
cn(
|
||||||
|
'bg-white hover:bg-stone-100 dark:bg-stone-950 dark:hover:bg-stone-800',
|
||||||
|
true &&
|
||||||
|
'text-stone-50 sm:focus:text-stone-900 dark:text-stone-900 dark:sm:focus:text-stone-50',
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
foo
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
"
|
||||||
|
"
|
||||||
`;
|
`;
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,22 @@
|
||||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||||
|
|
||||||
exports[`transform import 1`] = `
|
exports[`transform import 1`] = `
|
||||||
"import { Foo } from "bar"
|
"import { Foo } from "bar" import { Button } from "@/components/ui/button" import
|
||||||
import { Button } from "@/components/ui/button"
|
{ Label} from "ui/label" import { Box } from "@/components/box" import { cn }
|
||||||
import { Label} from "ui/label"
|
from "@/lib/utils"
|
||||||
import { Box } from "@/components/box"
|
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`transform import 2`] = `
|
exports[`transform import 2`] = `
|
||||||
"import { Foo } from "bar"
|
"import { Foo } from "bar" import { Button } from "~/src/components/ui/button"
|
||||||
import { Button } from "~/src/components/ui/button"
|
import { Label} from "ui/label" import { Box } from "~/src/components/box"
|
||||||
import { Label} from "ui/label"
|
import { cn, foo, bar } from "~/lib" import { bar } from "@/lib/utils/bar"
|
||||||
import { Box } from "~/src/components/box"
|
|
||||||
|
|
||||||
import { cn, foo, bar } from "~/lib"
|
|
||||||
import { bar } from "@/lib/utils/bar"
|
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`transform import 3`] = `
|
exports[`transform import 3`] = `
|
||||||
"import { Foo } from "bar"
|
"import { Foo } from "bar" import { Button } from "~/src/components/ui/button"
|
||||||
import { Button } from "~/src/components/ui/button"
|
import { Label} from "ui/label" import { Box } from "~/src/components/box"
|
||||||
import { Label} from "ui/label"
|
import { cn } from "~/src/utils" import { bar } from "@/lib/utils/bar"
|
||||||
import { Box } from "~/src/components/box"
|
|
||||||
|
|
||||||
import { cn } from "~/src/utils"
|
|
||||||
import { bar } from "@/lib/utils/bar"
|
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ const props = defineProps({
|
||||||
a: { type: String, required: true },
|
a: { type: String, required: true },
|
||||||
b: { type: Number, required: true },
|
b: { type: Number, required: true },
|
||||||
});
|
});
|
||||||
export {};
|
|
||||||
</script>
|
</script>
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
@ -49,7 +48,6 @@ const props = defineProps({
|
||||||
asChild: { type: Boolean, required: false },
|
asChild: { type: Boolean, required: false },
|
||||||
as: { type: null, required: false },
|
as: { type: null, required: false },
|
||||||
});
|
});
|
||||||
export {};
|
|
||||||
</script>
|
</script>
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
@ -62,3 +60,27 @@ const props = defineProps({
|
||||||
</script>
|
</script>
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`transformSFC > remove all type reference 1`] = `
|
||||||
|
"<script setup>
|
||||||
|
const array = [1, 2, 3];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
v-bind="{ array }"
|
||||||
|
:prop="(a) => a"
|
||||||
|
:prop2="
|
||||||
|
(a) => {
|
||||||
|
let b = a;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ true ? 123 : 0 }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,30 @@ describe('transformSFC', () => {
|
||||||
expect(result).toMatchSnapshot()
|
expect(result).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('remove all type reference', async () => {
|
||||||
|
const result = await transform({
|
||||||
|
filename: 'app.vue',
|
||||||
|
raw: `<script lang="ts" setup>
|
||||||
|
const array: (number | string)[] = [1, 2, 3]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div v-bind="{ array }" :prop="(a: number) => a" :prop2="(a: number) => {
|
||||||
|
let b: number = a
|
||||||
|
return b
|
||||||
|
}">
|
||||||
|
{{ true ? 123 as number : 0 }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
|
`,
|
||||||
|
config: {},
|
||||||
|
})
|
||||||
|
expect(result).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
it('defineProps', async () => {
|
it('defineProps', async () => {
|
||||||
const result = await transform({
|
const result = await transform({
|
||||||
filename: 'app.vue',
|
filename: 'app.vue',
|
||||||
|
|
|
||||||
3916
pnpm-lock.yaml
3916
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user