From f8f3fc754fae99c362fa463a746df0f0e50ad36f Mon Sep 17 00:00:00 2001 From: zernonia <59365435+zernonia@users.noreply.github.com> Date: Mon, 14 Oct 2024 19:39:58 +0800 Subject: [PATCH] feat: support tailwind prefix (#619) * 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 --- .../theme/components/BlockPreview.vue | 10 +- .../theme/components/theming/utils/data.ts | 2 +- apps/www/.vitepress/theme/utils/codeeditor.ts | 4 +- .../src/content/docs/components/breadcrumb.md | 8 +- .../src/content/docs/components/data-table.md | 26 +- .../content/docs/components/number-field.md | 2 +- apps/www/src/content/docs/contribution.md | 10 +- apps/www/src/content/docs/dark-mode/astro.md | 4 +- apps/www/src/content/docs/dark-mode/nuxt.md | 2 +- apps/www/src/content/docs/dark-mode/vite.md | 4 +- .../www/src/content/docs/installation/vite.md | 8 +- .../examples/cards/components/TeamMembers.vue | 8 +- .../forms/components/NotificationsForm.vue | 16 +- .../default/example/CalendarWithSelect.vue | 10 +- .../registry/default/example/CarouselDemo.vue | 2 +- .../default/example/ComboboxPopover.vue | 20 +- .../example/DataTableColumnPinningDemo.vue | 28 +- .../default/example/DataTableDemo.vue | 26 +- .../default/example/DataTableDemoColumn.vue | 4 +- .../default/example/DataTableReactiveDemo.vue | 26 +- .../registry/default/example/DialogForm.vue | 26 +- .../default/example/NumberFieldForm.vue | 10 +- .../registry/default/example/StepperDemo.vue | 4 +- .../registry/default/example/StepperForm.vue | 14 +- .../default/example/StepperHorizental.vue | 4 +- .../default/example/StepperVertical.vue | 4 +- .../default/example/TagsInputComboboxDemo.vue | 6 +- .../default/example/TagsInputFormDemo.vue | 10 +- .../ui/alert-dialog/AlertDialogCancel.vue | 9 +- .../default/ui/auto-form/AutoForm.vue | 10 +- .../default/ui/calendar/CalendarCell.vue | 4 +- .../ui/calendar/CalendarCellTrigger.vue | 4 +- .../registry/default/ui/carousel/Carousel.vue | 2 +- .../default/ui/chart-area/AreaChart.vue | 10 +- .../ui/number-field/NumberFieldDecrement.vue | 6 +- .../ui/number-field/NumberFieldIncrement.vue | 6 +- .../ui/number-field/NumberFieldInput.vue | 2 +- .../ui/range-calendar/RangeCalendarCell.vue | 4 +- .../RangeCalendarCellTrigger.vue | 4 +- .../range-calendar/RangeCalendarHeadCell.vue | 4 +- .../default/ui/select/SelectTrigger.vue | 6 +- .../default/ui/separator/Separator.vue | 4 +- .../lib/registry/default/ui/slider/Slider.vue | 4 +- .../registry/default/ui/stepper/Stepper.vue | 4 +- .../default/ui/stepper/StepperDescription.vue | 4 +- .../default/ui/stepper/StepperIndicator.vue | 4 +- .../default/ui/stepper/StepperItem.vue | 4 +- .../default/ui/stepper/StepperSeparator.vue | 4 +- .../default/ui/stepper/StepperTitle.vue | 4 +- .../default/ui/stepper/StepperTrigger.vue | 4 +- .../lib/registry/default/ui/stepper/index.ts | 8 +- .../lib/registry/default/ui/tabs/TabsList.vue | 4 +- .../registry/default/ui/tabs/TabsTrigger.vue | 4 +- .../default/ui/v-calendar/Calendar.vue | 16 +- .../new-york/example/CalendarWithSelect.vue | 10 +- .../example/DataTableColumnPinningDemo.vue | 28 +- .../new-york/example/DataTableDemoColumn.vue | 4 +- .../example/DataTableReactiveDemo.vue | 26 +- .../registry/new-york/example/DialogForm.vue | 26 +- .../new-york/example/NumberFieldForm.vue | 10 +- .../registry/new-york/example/StepperDemo.vue | 4 +- .../registry/new-york/example/StepperForm.vue | 14 +- .../new-york/example/StepperHorizental.vue | 4 +- .../new-york/example/StepperVertical.vue | 4 +- .../example/TagsInputComboboxDemo.vue | 6 +- .../new-york/example/TagsInputFormDemo.vue | 10 +- .../ui/alert-dialog/AlertDialogCancel.vue | 9 +- .../new-york/ui/auto-form/AutoForm.vue | 10 +- .../new-york/ui/calendar/CalendarCell.vue | 4 +- .../ui/calendar/CalendarCellTrigger.vue | 4 +- .../new-york/ui/carousel/Carousel.vue | 2 +- .../new-york/ui/chart-area/AreaChart.vue | 10 +- .../ui/dialog/DialogScrollContent.vue | 6 +- .../ui/number-field/NumberFieldDecrement.vue | 6 +- .../ui/number-field/NumberFieldIncrement.vue | 6 +- .../ui/number-field/NumberFieldInput.vue | 2 +- .../ui/range-calendar/RangeCalendarCell.vue | 4 +- .../RangeCalendarCellTrigger.vue | 4 +- .../range-calendar/RangeCalendarGridRow.vue | 4 +- .../range-calendar/RangeCalendarHeadCell.vue | 4 +- .../new-york/ui/select/SelectTrigger.vue | 6 +- .../new-york/ui/separator/Separator.vue | 4 +- .../registry/new-york/ui/slider/Slider.vue | 4 +- .../registry/new-york/ui/stepper/Stepper.vue | 4 +- .../ui/stepper/StepperDescription.vue | 4 +- .../new-york/ui/stepper/StepperIndicator.vue | 4 +- .../new-york/ui/stepper/StepperItem.vue | 4 +- .../new-york/ui/stepper/StepperSeparator.vue | 4 +- .../new-york/ui/stepper/StepperTitle.vue | 4 +- .../new-york/ui/stepper/StepperTrigger.vue | 4 +- .../lib/registry/new-york/ui/stepper/index.ts | 8 +- .../registry/new-york/ui/tabs/TabsList.vue | 4 +- .../registry/new-york/ui/tabs/TabsTrigger.vue | 4 +- .../new-york/ui/v-calendar/Calendar.vue | 16 +- .../registry/styles/default/alert-dialog.json | 2 +- .../registry/styles/default/v-calendar.json | 2 +- .../styles/new-york/alert-dialog.json | 2 +- .../registry/styles/new-york/v-calendar.json | 2 +- packages/cli/package.json | 33 +- packages/cli/src/commands/init.ts | 18 +- packages/cli/src/utils/transformers/index.ts | 44 +- .../utils/transformers/transform-css-vars.ts | 100 +- .../utils/transformers/transform-import.ts | 73 +- .../src/utils/transformers/transform-sfc.ts | 24 +- .../utils/transformers/transform-tw-prefix.ts | 114 +- .../transform-cjs-to-esm.test.ts.snap | 2 +- .../transform-css-vars.test.ts.snap | 3 +- .../transform-import.test.ts.snap | 29 +- .../__snapshots__/transform-sfc.test.ts.snap | 32 +- .../transform-tw-prefix.test.ts.snap | 241 + .../cli/test/utils/transform-import.test.ts | 11 +- packages/cli/test/utils/transform-sfc.test.ts | 27 + .../test/utils/transform-tw-prefix.test.ts | 243 +- packages/module/src/module.ts | 4 +- patches/vue-eslint-parser@9.4.3.patch | 15 + pnpm-lock.yaml | 7038 ++++++++--------- 116 files changed, 4244 insertions(+), 4547 deletions(-) create mode 100644 packages/cli/test/utils/__snapshots__/transform-tw-prefix.test.ts.snap create mode 100644 patches/vue-eslint-parser@9.4.3.patch diff --git a/apps/www/.vitepress/theme/components/BlockPreview.vue b/apps/www/.vitepress/theme/components/BlockPreview.vue index 4635d5bd9..ccfcc04ac 100644 --- a/apps/www/.vitepress/theme/components/BlockPreview.vue +++ b/apps/www/.vitepress/theme/components/BlockPreview.vue @@ -1,14 +1,14 @@