* chore: enable tw prefix * chore: enable tw prefix during init * fix: cater for cn function * fix: prevent transforming importDeclaration * chore: update registry to make sure tailwind prefix parse correctly * chore: fix wrong import * chore: checkpoint * refactor: goodbye ts-morph * chore: remove ts-morpg * chore: update test * chore: cleanup * chore: fix test * fix: move vue-metamorph to dep * refactor: transform tw prefix by specific case * fix: transform-sfc not parsing .ts file * fix: prefix double quote * chore: patch vue-eslint-parser * refactor: transform to cater only for class in sfc * refactor: replace detypes with @unovue/detypes * chore: update test snapshot * chore: update pnpm-lock, fix import * chore: bump detypes version * chore: update deps
71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
import { expect, it } from 'vitest'
|
|
import { transform } from '../../src/utils/transformers'
|
|
|
|
it('transform import', async () => {
|
|
expect(
|
|
await transform({
|
|
filename: 'app.ts',
|
|
raw: `import { Foo } from "bar"
|
|
import { Button } from "@/lib/registry/new-york/ui/button"
|
|
import { Label} from "ui/label"
|
|
import { Box } from "@/lib/registry/new-york/box"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
`,
|
|
config: {
|
|
tailwind: {
|
|
baseColor: 'neutral',
|
|
cssVariables: true,
|
|
},
|
|
aliases: {
|
|
components: '@/components',
|
|
utils: '@/lib/utils',
|
|
},
|
|
typescript: true,
|
|
},
|
|
}),
|
|
).toMatchSnapshot()
|
|
|
|
expect(
|
|
await transform({
|
|
filename: 'app.ts',
|
|
raw: `import { Foo } from "bar"
|
|
import { Button } from "@/lib/registry/new-york/ui/button"
|
|
import { Label} from "ui/label"
|
|
import { Box } from "@/lib/registry/new-york/box"
|
|
|
|
import { cn, foo } from "@/lib/utils"
|
|
import { bar } from "@/lib/utils/bar"
|
|
`,
|
|
config: {
|
|
aliases: {
|
|
components: '~/src/components',
|
|
utils: '~/lib',
|
|
},
|
|
typescript: true,
|
|
},
|
|
}),
|
|
).toMatchSnapshot()
|
|
|
|
expect(
|
|
await transform({
|
|
filename: 'app.ts',
|
|
raw: `import { Foo } from "bar"
|
|
import { Button } from "@/lib/registry/new-york/ui/button"
|
|
import { Label} from "ui/label"
|
|
import { Box } from "@/lib/registry/new-york/box"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
import { bar } from "@/lib/utils/bar"
|
|
`,
|
|
config: {
|
|
aliases: {
|
|
components: '~/src/components',
|
|
utils: '~/src/utils',
|
|
},
|
|
typescript: true,
|
|
},
|
|
}),
|
|
).toMatchSnapshot()
|
|
})
|