@open-dy/vibecoding-sdk-taro 0.0.1-beta.5 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/reference/llms.txt +52 -2
- package/dist/reference/sdk-api/build/taro/BuildContext.md +7 -2
- package/dist/reference/sdk-api/build/taro/CreateMicroappTaroConfigOptions.md +1 -2
- package/dist/reference/sdk-api/build/taro/createMicroappTaroConfig.md +1 -2
- package/dist/reference/sdk-api/runtime/CreateMicroappClientOptions.md +7 -2
- package/dist/reference/sdk-api/runtime/createMicroappClient.md +7 -2
- package/dist/reference/sdk-api/ui/accordion/Accordion.md +114 -0
- package/dist/reference/sdk-api/ui/accordion/AccordionContent.md +100 -0
- package/dist/reference/sdk-api/ui/accordion/AccordionItem.md +107 -0
- package/dist/reference/sdk-api/ui/accordion/AccordionTrigger.md +100 -0
- package/dist/reference/sdk-api/ui/accordion/index.md +12 -0
- package/dist/reference/sdk-api/ui/alert/Alert.md +106 -0
- package/dist/reference/sdk-api/ui/alert/AlertAction.md +100 -0
- package/dist/reference/sdk-api/ui/alert/AlertDescription.md +100 -0
- package/dist/reference/sdk-api/ui/alert/AlertTitle.md +100 -0
- package/dist/reference/sdk-api/ui/alert/index.md +12 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialog.md +58 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogAction.md +107 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogCancel.md +107 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogContent.md +106 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogDescription.md +100 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogFooter.md +100 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogHeader.md +100 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogOverlay.md +100 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogPortal.md +55 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogTitle.md +100 -0
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogTrigger.md +118 -0
- package/dist/reference/sdk-api/ui/alert-dialog/index.md +19 -0
- package/dist/reference/sdk-api/ui/aspect-ratio/AspectRatio.md +106 -0
- package/dist/reference/sdk-api/ui/aspect-ratio/index.md +9 -0
- package/dist/reference/sdk-api/ui/avatar/Avatar.md +106 -0
- package/dist/reference/sdk-api/ui/avatar/AvatarBadge.md +100 -0
- package/dist/reference/sdk-api/ui/avatar/AvatarFallback.md +100 -0
- package/dist/reference/sdk-api/ui/avatar/AvatarGroup.md +100 -0
- package/dist/reference/sdk-api/ui/avatar/AvatarGroupCount.md +100 -0
- package/dist/reference/sdk-api/ui/avatar/AvatarImage.md +108 -0
- package/dist/reference/sdk-api/ui/avatar/index.md +14 -0
- package/dist/reference/sdk-api/ui/badge/Badge.md +114 -0
- package/dist/reference/sdk-api/ui/badge/badgeVariants.md +70 -0
- package/dist/reference/sdk-api/ui/badge/index.md +10 -0
- package/dist/reference/sdk-api/ui/button/Button.md +210 -0
- package/dist/reference/sdk-api/ui/button/ButtonProps.md +188 -0
- package/dist/reference/sdk-api/ui/button/buttonVariants.md +84 -0
- package/dist/reference/sdk-api/ui/button/index.md +11 -0
- package/dist/reference/sdk-api/ui/button-group/ButtonGroup.md +106 -0
- package/dist/reference/sdk-api/ui/button-group/ButtonGroupSeparator.md +106 -0
- package/dist/reference/sdk-api/ui/button-group/ButtonGroupText.md +106 -0
- package/dist/reference/sdk-api/ui/button-group/buttonGroupVariants.md +70 -0
- package/dist/reference/sdk-api/ui/button-group/index.md +12 -0
- package/dist/reference/sdk-api/ui/calendar/Calendar.md +144 -0
- package/dist/reference/sdk-api/ui/calendar/CalendarProps.md +118 -0
- package/dist/reference/sdk-api/ui/calendar/index.md +10 -0
- package/dist/reference/sdk-api/ui/card/Card.md +106 -0
- package/dist/reference/sdk-api/ui/card/CardAction.md +100 -0
- package/dist/reference/sdk-api/ui/card/CardContent.md +100 -0
- package/dist/reference/sdk-api/ui/card/CardDescription.md +100 -0
- package/dist/reference/sdk-api/ui/card/CardFooter.md +100 -0
- package/dist/reference/sdk-api/ui/card/CardHeader.md +100 -0
- package/dist/reference/sdk-api/ui/card/CardTitle.md +100 -0
- package/dist/reference/sdk-api/ui/card/index.md +15 -0
- package/dist/reference/sdk-api/ui/carousel/Carousel.md +108 -0
- package/dist/reference/sdk-api/ui/carousel/CarouselContent.md +100 -0
- package/dist/reference/sdk-api/ui/carousel/CarouselItem.md +100 -0
- package/dist/reference/sdk-api/ui/carousel/CarouselNext.md +219 -0
- package/dist/reference/sdk-api/ui/carousel/CarouselPrevious.md +219 -0
- package/dist/reference/sdk-api/ui/carousel/index.md +14 -0
- package/dist/reference/sdk-api/ui/carousel/useCarousel.md +46 -0
- package/dist/reference/sdk-api/ui/checkbox/Checkbox.md +109 -0
- package/dist/reference/sdk-api/ui/checkbox/index.md +9 -0
- package/dist/reference/sdk-api/ui/collapsible/Collapsible.md +108 -0
- package/dist/reference/sdk-api/ui/collapsible/CollapsibleContent.md +100 -0
- package/dist/reference/sdk-api/ui/collapsible/CollapsibleTrigger.md +119 -0
- package/dist/reference/sdk-api/ui/collapsible/index.md +11 -0
- package/dist/reference/sdk-api/ui/combobox/Combobox.md +124 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxChip.md +107 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxChips.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxChipsInput.md +107 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxCollection.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxContent.md +106 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxEmpty.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxGroup.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxInput.md +113 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxItem.md +106 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxLabel.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxList.md +105 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxSeparator.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxTrigger.md +100 -0
- package/dist/reference/sdk-api/ui/combobox/ComboboxValue.md +105 -0
- package/dist/reference/sdk-api/ui/combobox/index.md +24 -0
- package/dist/reference/sdk-api/ui/combobox/useComboboxAnchor.md +43 -0
- package/dist/reference/sdk-api/ui/dialog/Dialog.md +58 -0
- package/dist/reference/sdk-api/ui/dialog/DialogClose.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogContent.md +107 -0
- package/dist/reference/sdk-api/ui/dialog/DialogDescription.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogFooter.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogHeader.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogOverlay.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogPortal.md +55 -0
- package/dist/reference/sdk-api/ui/dialog/DialogTitle.md +100 -0
- package/dist/reference/sdk-api/ui/dialog/DialogTrigger.md +106 -0
- package/dist/reference/sdk-api/ui/dialog/index.md +18 -0
- package/dist/reference/sdk-api/ui/drawer/Drawer.md +59 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerClose.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerContent.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerDescription.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerFooter.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerHeader.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerOverlay.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerPortal.md +55 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerTitle.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/DrawerTrigger.md +100 -0
- package/dist/reference/sdk-api/ui/drawer/index.md +18 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenu.md +58 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuCheckboxItem.md +107 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuContent.md +106 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuGroup.md +100 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuItem.md +107 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuLabel.md +106 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuPortal.md +55 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuRadioGroup.md +100 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuRadioItem.md +106 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSeparator.md +100 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuShortcut.md +100 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSub.md +58 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSubContent.md +100 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSubTrigger.md +106 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuTrigger.md +119 -0
- package/dist/reference/sdk-api/ui/dropdown-menu/index.md +23 -0
- package/dist/reference/sdk-api/ui/empty/Empty.md +100 -0
- package/dist/reference/sdk-api/ui/empty/EmptyContent.md +100 -0
- package/dist/reference/sdk-api/ui/empty/EmptyDescription.md +100 -0
- package/dist/reference/sdk-api/ui/empty/EmptyHeader.md +100 -0
- package/dist/reference/sdk-api/ui/empty/EmptyMedia.md +106 -0
- package/dist/reference/sdk-api/ui/empty/EmptyTitle.md +100 -0
- package/dist/reference/sdk-api/ui/empty/index.md +14 -0
- package/dist/reference/sdk-api/ui/field/Field.md +106 -0
- package/dist/reference/sdk-api/ui/field/FieldContent.md +100 -0
- package/dist/reference/sdk-api/ui/field/FieldDescription.md +100 -0
- package/dist/reference/sdk-api/ui/field/FieldError.md +112 -0
- package/dist/reference/sdk-api/ui/field/FieldGroup.md +100 -0
- package/dist/reference/sdk-api/ui/field/FieldLabel.md +85 -0
- package/dist/reference/sdk-api/ui/field/FieldLegend.md +106 -0
- package/dist/reference/sdk-api/ui/field/FieldSeparator.md +105 -0
- package/dist/reference/sdk-api/ui/field/FieldSet.md +100 -0
- package/dist/reference/sdk-api/ui/field/FieldTitle.md +100 -0
- package/dist/reference/sdk-api/ui/field/index.md +18 -0
- package/dist/reference/sdk-api/ui/helpers/collectDataIconState.md +66 -0
- package/dist/reference/sdk-api/ui/helpers/index.md +9 -0
- package/dist/reference/sdk-api/ui/index.md +57 -0
- package/dist/reference/sdk-api/ui/input/Input.md +141 -0
- package/dist/reference/sdk-api/ui/input/index.md +9 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroup.md +100 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroupAddon.md +109 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroupButton.md +220 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroupInput.md +135 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroupText.md +100 -0
- package/dist/reference/sdk-api/ui/input-group/InputGroupTextarea.md +126 -0
- package/dist/reference/sdk-api/ui/input-group/index.md +14 -0
- package/dist/reference/sdk-api/ui/input-otp/InputOTP.md +111 -0
- package/dist/reference/sdk-api/ui/input-otp/InputOTPGroup.md +100 -0
- package/dist/reference/sdk-api/ui/input-otp/InputOTPSeparator.md +100 -0
- package/dist/reference/sdk-api/ui/input-otp/InputOTPSlot.md +107 -0
- package/dist/reference/sdk-api/ui/input-otp/index.md +12 -0
- package/dist/reference/sdk-api/ui/item/Item.md +115 -0
- package/dist/reference/sdk-api/ui/item/ItemActions.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemContent.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemDescription.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemFooter.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemGroup.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemHeader.md +100 -0
- package/dist/reference/sdk-api/ui/item/ItemMedia.md +106 -0
- package/dist/reference/sdk-api/ui/item/ItemSeparator.md +106 -0
- package/dist/reference/sdk-api/ui/item/ItemTitle.md +100 -0
- package/dist/reference/sdk-api/ui/item/index.md +18 -0
- package/dist/reference/sdk-api/ui/label/Label.md +85 -0
- package/dist/reference/sdk-api/ui/label/index.md +9 -0
- package/dist/reference/sdk-api/ui/menubar/Menubar.md +100 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarCheckboxItem.md +111 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarContent.md +108 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarGroup.md +100 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarItem.md +109 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarLabel.md +106 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarMenu.md +55 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarPortal.md +55 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarRadioGroup.md +108 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarRadioItem.md +110 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarSeparator.md +100 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarShortcut.md +100 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarSub.md +58 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarSubContent.md +108 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarSubTrigger.md +107 -0
- package/dist/reference/sdk-api/ui/menubar/MenubarTrigger.md +100 -0
- package/dist/reference/sdk-api/ui/menubar/index.md +24 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenu.md +100 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuContent.md +106 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuIndicator.md +100 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuItem.md +106 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuLink.md +106 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuList.md +100 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuPositioner.md +100 -0
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuTrigger.md +120 -0
- package/dist/reference/sdk-api/ui/navigation-menu/index.md +17 -0
- package/dist/reference/sdk-api/ui/navigation-menu/navigationMenuTriggerStyle.md +64 -0
- package/dist/reference/sdk-api/ui/pagination/Pagination.md +100 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationContent.md +100 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationEllipsis.md +100 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationItem.md +100 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationLink.md +107 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationNext.md +121 -0
- package/dist/reference/sdk-api/ui/pagination/PaginationPrevious.md +121 -0
- package/dist/reference/sdk-api/ui/pagination/index.md +15 -0
- package/dist/reference/sdk-api/ui/popover/Popover.md +58 -0
- package/dist/reference/sdk-api/ui/popover/PopoverAnchor.md +100 -0
- package/dist/reference/sdk-api/ui/popover/PopoverContent.md +108 -0
- package/dist/reference/sdk-api/ui/popover/PopoverDescription.md +100 -0
- package/dist/reference/sdk-api/ui/popover/PopoverHeader.md +100 -0
- package/dist/reference/sdk-api/ui/popover/PopoverTitle.md +100 -0
- package/dist/reference/sdk-api/ui/popover/PopoverTrigger.md +119 -0
- package/dist/reference/sdk-api/ui/popover/index.md +15 -0
- package/dist/reference/sdk-api/ui/portal/Portal.md +55 -0
- package/dist/reference/sdk-api/ui/portal/index.md +9 -0
- package/dist/reference/sdk-api/ui/progress/Progress.md +109 -0
- package/dist/reference/sdk-api/ui/progress/ProgressIndicator.md +107 -0
- package/dist/reference/sdk-api/ui/progress/ProgressLabel.md +100 -0
- package/dist/reference/sdk-api/ui/progress/ProgressTrack.md +100 -0
- package/dist/reference/sdk-api/ui/progress/ProgressValue.md +105 -0
- package/dist/reference/sdk-api/ui/progress/index.md +13 -0
- package/dist/reference/sdk-api/ui/radio-group/RadioGroup.md +108 -0
- package/dist/reference/sdk-api/ui/radio-group/RadioGroupItem.md +107 -0
- package/dist/reference/sdk-api/ui/radio-group/index.md +10 -0
- package/dist/reference/sdk-api/ui/resizable/ResizableHandle.md +107 -0
- package/dist/reference/sdk-api/ui/resizable/ResizablePanel.md +108 -0
- package/dist/reference/sdk-api/ui/resizable/ResizablePanelGroup.md +107 -0
- package/dist/reference/sdk-api/ui/resizable/index.md +11 -0
- package/dist/reference/sdk-api/ui/scroll-area/ScrollArea.md +159 -0
- package/dist/reference/sdk-api/ui/scroll-area/ScrollBar.md +106 -0
- package/dist/reference/sdk-api/ui/scroll-area/index.md +10 -0
- package/dist/reference/sdk-api/ui/select/Select.md +80 -0
- package/dist/reference/sdk-api/ui/select/SelectContent.md +106 -0
- package/dist/reference/sdk-api/ui/select/SelectGroup.md +100 -0
- package/dist/reference/sdk-api/ui/select/SelectItem.md +106 -0
- package/dist/reference/sdk-api/ui/select/SelectLabel.md +100 -0
- package/dist/reference/sdk-api/ui/select/SelectScrollDownButton.md +100 -0
- package/dist/reference/sdk-api/ui/select/SelectScrollUpButton.md +100 -0
- package/dist/reference/sdk-api/ui/select/SelectSeparator.md +100 -0
- package/dist/reference/sdk-api/ui/select/SelectTrigger.md +106 -0
- package/dist/reference/sdk-api/ui/select/SelectValue.md +106 -0
- package/dist/reference/sdk-api/ui/select/index.md +18 -0
- package/dist/reference/sdk-api/ui/separator/Separator.md +106 -0
- package/dist/reference/sdk-api/ui/separator/index.md +9 -0
- package/dist/reference/sdk-api/ui/sheet/Sheet.md +58 -0
- package/dist/reference/sdk-api/ui/sheet/SheetClose.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetContent.md +113 -0
- package/dist/reference/sdk-api/ui/sheet/SheetDescription.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetFooter.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetHeader.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetOverlay.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetPortal.md +55 -0
- package/dist/reference/sdk-api/ui/sheet/SheetTitle.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/SheetTrigger.md +100 -0
- package/dist/reference/sdk-api/ui/sheet/index.md +18 -0
- package/dist/reference/sdk-api/ui/skeleton/Skeleton.md +100 -0
- package/dist/reference/sdk-api/ui/skeleton/index.md +9 -0
- package/dist/reference/sdk-api/ui/slider/Slider.md +116 -0
- package/dist/reference/sdk-api/ui/slider/index.md +9 -0
- package/dist/reference/sdk-api/ui/sonner/Toaster.md +43 -0
- package/dist/reference/sdk-api/ui/sonner/index.md +10 -0
- package/dist/reference/sdk-api/ui/sonner/toast.md +58 -0
- package/dist/reference/sdk-api/ui/spinner/Spinner.md +100 -0
- package/dist/reference/sdk-api/ui/spinner/index.md +9 -0
- package/dist/reference/sdk-api/ui/switch/Switch.md +110 -0
- package/dist/reference/sdk-api/ui/switch/index.md +9 -0
- package/dist/reference/sdk-api/ui/table/Table.md +100 -0
- package/dist/reference/sdk-api/ui/table/TableBody.md +100 -0
- package/dist/reference/sdk-api/ui/table/TableCaption.md +100 -0
- package/dist/reference/sdk-api/ui/table/TableCell.md +106 -0
- package/dist/reference/sdk-api/ui/table/TableFooter.md +100 -0
- package/dist/reference/sdk-api/ui/table/TableHead.md +106 -0
- package/dist/reference/sdk-api/ui/table/TableHeader.md +100 -0
- package/dist/reference/sdk-api/ui/table/TableRow.md +100 -0
- package/dist/reference/sdk-api/ui/table/index.md +16 -0
- package/dist/reference/sdk-api/ui/tabs/Tabs.md +109 -0
- package/dist/reference/sdk-api/ui/tabs/TabsContent.md +106 -0
- package/dist/reference/sdk-api/ui/tabs/TabsList.md +106 -0
- package/dist/reference/sdk-api/ui/tabs/TabsTrigger.md +107 -0
- package/dist/reference/sdk-api/ui/tabs/index.md +13 -0
- package/dist/reference/sdk-api/ui/tabs/tabsListVariants.md +70 -0
- package/dist/reference/sdk-api/ui/textarea/Textarea.md +126 -0
- package/dist/reference/sdk-api/ui/textarea/index.md +9 -0
- package/dist/reference/sdk-api/ui/toggle/Toggle.md +118 -0
- package/dist/reference/sdk-api/ui/toggle/index.md +10 -0
- package/dist/reference/sdk-api/ui/toggle/toggleVariants.md +71 -0
- package/dist/reference/sdk-api/ui/toggle-group/ToggleGroup.md +122 -0
- package/dist/reference/sdk-api/ui/toggle-group/ToggleGroupItem.md +116 -0
- package/dist/reference/sdk-api/ui/toggle-group/index.md +10 -0
- package/dist/reference/sdk-api.json +73810 -2
- package/dist/reference/sdk-api.md +50 -2
- package/dist/ui/accordion.d.ts +48 -0
- package/dist/ui/accordion.js +40 -0
- package/dist/ui/accordion.js.map +1 -1
- package/dist/ui/alert-dialog.d.ts +123 -0
- package/dist/ui/alert-dialog.js +114 -0
- package/dist/ui/alert-dialog.js.map +1 -1
- package/dist/ui/alert.d.ts +41 -0
- package/dist/ui/alert.js +41 -0
- package/dist/ui/alert.js.map +1 -1
- package/dist/ui/aspect-ratio.d.ts +11 -0
- package/dist/ui/aspect-ratio.js +10 -0
- package/dist/ui/aspect-ratio.js.map +1 -1
- package/dist/ui/avatar.d.ts +65 -0
- package/dist/ui/avatar.js +63 -0
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/badge.d.ts +22 -0
- package/dist/ui/badge.js +22 -0
- package/dist/ui/badge.js.map +1 -1
- package/dist/ui/button-group.d.ts +45 -0
- package/dist/ui/button-group.js +43 -0
- package/dist/ui/button-group.js.map +1 -1
- package/dist/ui/button.d.ts +52 -0
- package/dist/ui/button.js +30 -0
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/calendar.d.ts +44 -0
- package/dist/ui/calendar.js +19 -0
- package/dist/ui/calendar.js.map +1 -1
- package/dist/ui/card.d.ts +71 -0
- package/dist/ui/card.js +70 -0
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/carousel.d.ts +71 -0
- package/dist/ui/carousel.js +66 -0
- package/dist/ui/carousel.js.map +1 -1
- package/dist/ui/checkbox.d.ts +14 -0
- package/dist/ui/checkbox.js +10 -0
- package/dist/ui/checkbox.js.map +1 -1
- package/dist/ui/collapsible.d.ts +37 -0
- package/dist/ui/collapsible.js +30 -0
- package/dist/ui/collapsible.js.map +1 -1
- package/dist/ui/combobox.d.ts +190 -0
- package/dist/ui/combobox.js +167 -0
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/dialog.d.ts +109 -0
- package/dist/ui/dialog.js +100 -0
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/drawer.d.ts +106 -0
- package/dist/ui/drawer.js +100 -0
- package/dist/ui/drawer.js.map +1 -1
- package/dist/ui/dropdown-menu.d.ts +171 -0
- package/dist/ui/dropdown-menu.js +150 -0
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/empty.d.ts +61 -0
- package/dist/ui/empty.js +61 -0
- package/dist/ui/empty.js.map +1 -1
- package/dist/ui/field.d.ts +105 -0
- package/dist/ui/field.js +101 -0
- package/dist/ui/field.js.map +1 -1
- package/dist/ui/helpers.d.ts +11 -0
- package/dist/ui/helpers.js +11 -0
- package/dist/ui/helpers.js.map +1 -1
- package/dist/ui/input-group.d.ts +65 -0
- package/dist/ui/input-group.js +65 -0
- package/dist/ui/input-group.js.map +1 -1
- package/dist/ui/input-otp.d.ts +48 -0
- package/dist/ui/input-otp.js +40 -0
- package/dist/ui/input-otp.js.map +1 -1
- package/dist/ui/input.d.ts +24 -2
- package/dist/ui/input.js +20 -0
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/item.d.ts +103 -0
- package/dist/ui/item.js +103 -0
- package/dist/ui/item.js.map +1 -1
- package/dist/ui/label.d.ts +10 -0
- package/dist/ui/label.js +10 -0
- package/dist/ui/label.js.map +1 -1
- package/dist/ui/menubar.d.ts +193 -0
- package/dist/ui/menubar.js +160 -0
- package/dist/ui/menubar.js.map +1 -1
- package/dist/ui/navigation-menu.d.ts +98 -0
- package/dist/ui/navigation-menu.js +90 -0
- package/dist/ui/navigation-menu.js.map +1 -1
- package/dist/ui/pagination.d.ts +76 -0
- package/dist/ui/pagination.js +73 -0
- package/dist/ui/pagination.js.map +1 -1
- package/dist/ui/popover.d.ts +81 -0
- package/dist/ui/popover.js +70 -0
- package/dist/ui/popover.js.map +1 -1
- package/dist/ui/portal.d.ts +11 -0
- package/dist/ui/portal.js +10 -0
- package/dist/ui/portal.js.map +1 -1
- package/dist/ui/progress.d.ts +53 -26
- package/dist/ui/progress.js +50 -26
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/radio-group.d.ts +25 -0
- package/dist/ui/radio-group.js +20 -0
- package/dist/ui/radio-group.js.map +1 -1
- package/dist/ui/resizable.d.ts +37 -0
- package/dist/ui/resizable.js +30 -0
- package/dist/ui/resizable.js.map +1 -1
- package/dist/ui/scroll-area.d.ts +22 -0
- package/dist/ui/scroll-area.js +21 -0
- package/dist/ui/scroll-area.js.map +1 -1
- package/dist/ui/select.d.ts +122 -0
- package/dist/ui/select.js +108 -0
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/separator.d.ts +11 -0
- package/dist/ui/separator.js +10 -0
- package/dist/ui/separator.js.map +1 -1
- package/dist/ui/sheet.d.ts +107 -0
- package/dist/ui/sheet.js +101 -0
- package/dist/ui/sheet.js.map +1 -1
- package/dist/ui/skeleton.d.ts +10 -0
- package/dist/ui/skeleton.js +10 -0
- package/dist/ui/skeleton.js.map +1 -1
- package/dist/ui/slider.d.ts +21 -0
- package/dist/ui/slider.js +14 -0
- package/dist/ui/slider.js.map +1 -1
- package/dist/ui/sonner.d.ts +23 -0
- package/dist/ui/sonner.js +21 -0
- package/dist/ui/sonner.js.map +1 -1
- package/dist/ui/spinner.d.ts +10 -0
- package/dist/ui/spinner.js +10 -0
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/switch.d.ts +15 -0
- package/dist/ui/switch.js +10 -0
- package/dist/ui/switch.js.map +1 -1
- package/dist/ui/table.d.ts +81 -0
- package/dist/ui/table.js +80 -0
- package/dist/ui/table.js.map +1 -1
- package/dist/ui/tabs.d.ts +59 -0
- package/dist/ui/tabs.js +51 -0
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/textarea.d.ts +13 -0
- package/dist/ui/textarea.js +13 -0
- package/dist/ui/textarea.js.map +1 -1
- package/dist/ui/toggle-group.d.ts +34 -0
- package/dist/ui/toggle-group.js +24 -0
- package/dist/ui/toggle-group.js.map +1 -1
- package/dist/ui/toggle.d.ts +28 -0
- package/dist/ui/toggle.js +24 -0
- package/dist/ui/toggle.js.map +1 -1
- package/package.json +5 -3
- package/release-provenance.json +15 -0
- package/src/adapters/interest-card/eslint/eslint-plugin-custom-navigation.mjs +290 -0
- package/src/adapters/interest-card/eslint/taro.mjs +55 -0
- package/src/adapters/interest-card/runtime/microapp.ts +11 -0
- package/src/adapters/interest-card/types/taro.d.ts +28 -0
- package/src/build/config-overrides.ts +39 -0
- package/src/build/index.ts +5 -0
- package/src/build/plugins/app-config.ts +47 -0
- package/src/build/plugins/depend-card/analyze.ts +122 -0
- package/src/build/plugins/depend-card/source.ts +97 -0
- package/src/build/plugins/vite-depend-card.ts +168 -0
- package/src/build/plugins/vite-image-asset-import.ts +178 -0
- package/src/build/plugins/vite-inline-json.ts +149 -0
- package/src/build/plugins/vite-taro-source-location.ts +224 -0
- package/src/build/plugins/vite-tt-components-entry.ts +33 -0
- package/src/build/taro.ts +830 -0
- package/src/components/miniapp-open-card.ts +49 -0
- package/src/components/native-miniapp-open-card.ts +7 -0
- package/src/eslint/eslint-plugin-microapp-pages.mjs +659 -0
- package/src/eslint/server.mjs +69 -0
- package/src/eslint/taro.mjs +553 -0
- package/src/index.ts +2 -0
- package/src/internal/runtime/douyin-open-button.d.ts +29 -0
- package/src/internal/runtime/iframe-auth/identity.ts +236 -0
- package/src/internal/runtime/iframe-auth/index.ts +2 -0
- package/src/internal/runtime/iframe-auth/sync.ts +37 -0
- package/src/internal/vendor-modules.d.ts +8 -0
- package/src/lib/measure.ts +115 -0
- package/src/lib/platform.ts +11 -0
- package/src/lib/utils.ts +6 -0
- package/src/runtime/client.ts +246 -0
- package/src/runtime/default-client.ts +26 -0
- package/src/runtime/default-iframe-auth.ts +13 -0
- package/src/runtime/douyin-container-request.ts +367 -0
- package/src/runtime/douyin-login-request.ts +514 -0
- package/src/runtime/globals.d.ts +342 -0
- package/src/runtime/index.ts +4 -0
- package/src/runtime/network-url.ts +63 -0
- package/src/ui/accordion.tsx +226 -0
- package/src/ui/alert-dialog.tsx +407 -0
- package/src/ui/alert.tsx +149 -0
- package/src/ui/aspect-ratio.tsx +37 -0
- package/src/ui/avatar.tsx +238 -0
- package/src/ui/badge.tsx +77 -0
- package/src/ui/button-group.tsx +173 -0
- package/src/ui/button.tsx +215 -0
- package/src/ui/calendar.tsx +353 -0
- package/src/ui/card.tsx +217 -0
- package/src/ui/carousel.tsx +259 -0
- package/src/ui/checkbox.tsx +62 -0
- package/src/ui/collapsible.tsx +148 -0
- package/src/ui/combobox.tsx +650 -0
- package/src/ui/dialog.tsx +290 -0
- package/src/ui/drawer.tsx +272 -0
- package/src/ui/dropdown-menu.tsx +547 -0
- package/src/ui/empty.tsx +166 -0
- package/src/ui/field.tsx +427 -0
- package/src/ui/helpers.tsx +39 -0
- package/src/ui/index.ts +47 -0
- package/src/ui/input-group.tsx +320 -0
- package/src/ui/input-otp.tsx +189 -0
- package/src/ui/input.tsx +60 -0
- package/src/ui/item.tsx +338 -0
- package/src/ui/label.tsx +31 -0
- package/src/ui/menubar.tsx +835 -0
- package/src/ui/navigation-menu.tsx +341 -0
- package/src/ui/pagination.tsx +195 -0
- package/src/ui/popover.tsx +363 -0
- package/src/ui/portal.tsx +31 -0
- package/src/ui/progress.tsx +182 -0
- package/src/ui/radio-group.tsx +111 -0
- package/src/ui/resizable.tsx +410 -0
- package/src/ui/scroll-area.tsx +102 -0
- package/src/ui/select.tsx +471 -0
- package/src/ui/separator.tsx +37 -0
- package/src/ui/sheet.tsx +289 -0
- package/src/ui/skeleton.tsx +25 -0
- package/src/ui/slider.tsx +176 -0
- package/src/ui/sonner.tsx +40 -0
- package/src/ui/spinner.tsx +23 -0
- package/src/ui/switch.tsx +94 -0
- package/src/ui/table.tsx +240 -0
- package/src/ui/tabs.tsx +233 -0
- package/src/ui/tailwind.css +2 -0
- package/src/ui/textarea.tsx +49 -0
- package/src/ui/theme.css +234 -0
- package/src/ui/toggle-group.tsx +215 -0
- package/src/ui/toggle.tsx +113 -0
|
@@ -0,0 +1,830 @@
|
|
|
1
|
+
import type { UserConfigExport } from "@tarojs/cli";
|
|
2
|
+
import tailwindcss from "@tailwindcss/postcss";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import type { Plugin } from "vite";
|
|
7
|
+
import { UnifiedViteWeappTailwindcssPlugin } from 'weapp-tailwindcss/vite';
|
|
8
|
+
import { viteImageAssetImportPlugin } from "./plugins/vite-image-asset-import";
|
|
9
|
+
import { viteDependCardPlugin } from "./plugins/vite-depend-card";
|
|
10
|
+
import { viteInlineJsonPlugin } from "./plugins/vite-inline-json";
|
|
11
|
+
import { viteTaroSourceLocationPlugin } from "./plugins/vite-taro-source-location";
|
|
12
|
+
import { viteTtComponentsEntryPlugin } from "./plugins/vite-tt-components-entry";
|
|
13
|
+
|
|
14
|
+
const SDK_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @desc Taro 构建阶段共享的编译上下文。
|
|
18
|
+
* @example const context: BuildContext = { isH5: true, isTt: false, mode: 'development', projectRoot }
|
|
19
|
+
* @ai-intent 描述 SDK 构建插件收到的 Taro 编译上下文。
|
|
20
|
+
* @ai-when 需要根据 H5、TT 或开发模式调整构建配置时。
|
|
21
|
+
* @ai-avoid 不要在业务页面中手动伪造该上下文或修改构建产物。
|
|
22
|
+
* @ai-example { isH5: true, isTt: false, mode: 'development', projectRoot }
|
|
23
|
+
*/
|
|
24
|
+
export interface BuildContext {
|
|
25
|
+
/** @desc 是否构建 H5 输出。 */
|
|
26
|
+
isH5: boolean
|
|
27
|
+
/** @desc 是否构建 TT 小程序输出。 */
|
|
28
|
+
isTt: boolean
|
|
29
|
+
/** @desc 当前 Taro 构建模式。 */
|
|
30
|
+
mode: string
|
|
31
|
+
/** @desc 工程根目录。 */
|
|
32
|
+
projectRoot: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @desc 创建普通小程序 Taro 配置的选项。
|
|
37
|
+
* @params {string} projectRoot 工程根目录。
|
|
38
|
+
* @params {'' | 'ext'} [platformChannel] 平台渠道。
|
|
39
|
+
* @params {string[]} [viteErrorTargets] Vite 错误上报目标。
|
|
40
|
+
* @params {Record<string, any> | Function} [overrides] 配置覆盖项。
|
|
41
|
+
* @example createMicroappTaroConfig({ projectRoot: process.cwd() })
|
|
42
|
+
* @ai-intent 配置普通小程序的 Taro/Vite 构建入口。
|
|
43
|
+
* @ai-when 需要从项目构建脚本创建普通小程序配置时。
|
|
44
|
+
* @ai-avoid 不要在业务代码中直接调用 Taro/Vite 内部构建 API。
|
|
45
|
+
* @ai-example createMicroappTaroConfig({ projectRoot: process.cwd() })
|
|
46
|
+
*/
|
|
47
|
+
export interface CreateMicroappTaroConfigOptions {
|
|
48
|
+
/** @desc 工程根目录。 */
|
|
49
|
+
projectRoot: string
|
|
50
|
+
/** @desc 平台渠道。 */
|
|
51
|
+
platformChannel?: '' | 'ext'
|
|
52
|
+
/** @desc Vite 错误上报目标列表。 */
|
|
53
|
+
viteErrorTargets?: string[]
|
|
54
|
+
/** @desc 配置对象或配置变换函数。 */
|
|
55
|
+
overrides?: Record<string, any> | ((config: UserConfigExport, ctx: BuildContext) => UserConfigExport | void)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
import { applyConfigOverrides } from './config-overrides'
|
|
59
|
+
export { applyConfigOverrides, mergeConfigValue } from './config-overrides'
|
|
60
|
+
|
|
61
|
+
function shouldRewritePreviewRequest(req: any) {
|
|
62
|
+
if (req.method !== "GET" && req.method !== "HEAD") return false;
|
|
63
|
+
if (req.headers.accept && !req.headers.accept.includes("text/html")) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function isViteOptimizedDepsRequest(url?: string) {
|
|
70
|
+
if (!url) return false;
|
|
71
|
+
const cleanUrl = url.split("?")[0].split("#")[0];
|
|
72
|
+
return (
|
|
73
|
+
cleanUrl.includes("/node_modules/.vite/deps/") ||
|
|
74
|
+
cleanUrl.includes("/@fs/") && cleanUrl.includes("/node_modules/.vite/deps/")
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface NetworkCallInfo {
|
|
79
|
+
method: string;
|
|
80
|
+
url: string;
|
|
81
|
+
file: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type EstreeNode = {
|
|
85
|
+
type: string;
|
|
86
|
+
loc?: { start: { line: number; column: number } };
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
function extractUrlFromEstree(node: EstreeNode): string {
|
|
91
|
+
if (node.type === "Literal" && typeof node.value === "string")
|
|
92
|
+
return node.value;
|
|
93
|
+
if (node.type === "TemplateLiteral") {
|
|
94
|
+
let result = "";
|
|
95
|
+
for (let i = 0; i < node.quasis.length; i++) {
|
|
96
|
+
result += node.quasis[i].value.cooked ?? node.quasis[i].value.raw;
|
|
97
|
+
if (i < node.expressions.length)
|
|
98
|
+
result += `\${${extractUrlFromEstree(node.expressions[i])}}`;
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
if (node.type === "BinaryExpression" && node.operator === "+")
|
|
103
|
+
return extractUrlFromEstree(node.left) + extractUrlFromEstree(node.right);
|
|
104
|
+
if (node.type === "Identifier") return `\${${node.name}}`;
|
|
105
|
+
return "<dynamic>";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function visitEstree(node: EstreeNode, callback: (node: EstreeNode) => void) {
|
|
109
|
+
callback(node);
|
|
110
|
+
for (const key of Object.keys(node)) {
|
|
111
|
+
const child = node[key];
|
|
112
|
+
if (child && typeof child === "object" && child.type) {
|
|
113
|
+
visitEstree(child, callback);
|
|
114
|
+
} else if (Array.isArray(child)) {
|
|
115
|
+
for (const item of child) {
|
|
116
|
+
if (item && typeof item === "object" && item.type)
|
|
117
|
+
visitEstree(item, callback);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const TARGET_METHODS = new Set(["request", "uploadFile", "downloadFile"]);
|
|
124
|
+
const CLIENT_ROUTES_FILE = "/tmp/routes/client-routes.json";
|
|
125
|
+
|
|
126
|
+
function writeRoutes(results: NetworkCallInfo[]) {
|
|
127
|
+
try {
|
|
128
|
+
const outDir = path.dirname(CLIENT_ROUTES_FILE);
|
|
129
|
+
if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });
|
|
130
|
+
fs.writeFileSync(CLIENT_ROUTES_FILE, JSON.stringify(results, null, 2));
|
|
131
|
+
console.log(
|
|
132
|
+
`\n[NetworkUrlAnalyzerPlugin] Collected ${results.length} client route(s) -> ${CLIENT_ROUTES_FILE}\n`,
|
|
133
|
+
);
|
|
134
|
+
} catch {
|
|
135
|
+
// Ignore route dump failures in build-time analysis.
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function collectNetworkCalls(
|
|
140
|
+
ast: EstreeNode,
|
|
141
|
+
id: string,
|
|
142
|
+
srcDir: string,
|
|
143
|
+
results: NetworkCallInfo[],
|
|
144
|
+
) {
|
|
145
|
+
visitEstree(ast, (node) => {
|
|
146
|
+
if (
|
|
147
|
+
node.type === "CallExpression" &&
|
|
148
|
+
node.callee?.type === "MemberExpression" &&
|
|
149
|
+
node.callee.object?.type === "Identifier" &&
|
|
150
|
+
node.callee.object.name === "Network" &&
|
|
151
|
+
node.callee.property?.type === "Identifier" &&
|
|
152
|
+
TARGET_METHODS.has(node.callee.property.name)
|
|
153
|
+
) {
|
|
154
|
+
const arg = node.arguments?.[0];
|
|
155
|
+
if (arg?.type === "ObjectExpression") {
|
|
156
|
+
const urlProp = arg.properties?.find(
|
|
157
|
+
(p: EstreeNode) =>
|
|
158
|
+
p.type === "Property" &&
|
|
159
|
+
((p.key?.type === "Identifier" && p.key.name === "url") ||
|
|
160
|
+
(p.key?.type === "Literal" && p.key.value === "url")),
|
|
161
|
+
);
|
|
162
|
+
if (urlProp) {
|
|
163
|
+
const urlValue = extractUrlFromEstree(urlProp.value);
|
|
164
|
+
results.push({
|
|
165
|
+
method: node.callee.property.name,
|
|
166
|
+
url: urlValue,
|
|
167
|
+
file: path.relative(path.resolve(srcDir, ".."), id),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function networkUrlAnalyzerPlugin(srcDir: string): Plugin {
|
|
176
|
+
const results: NetworkCallInfo[] = [];
|
|
177
|
+
let isBuild = false;
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
name: "network-url-analyzer",
|
|
181
|
+
buildStart() {
|
|
182
|
+
isBuild = !this.meta.watchMode;
|
|
183
|
+
if (!isBuild) return;
|
|
184
|
+
results.length = 0;
|
|
185
|
+
try {
|
|
186
|
+
fs.unlinkSync(CLIENT_ROUTES_FILE);
|
|
187
|
+
} catch {
|
|
188
|
+
// Ignore missing route snapshot files.
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
transform(code, id) {
|
|
192
|
+
if (!isBuild) return;
|
|
193
|
+
try {
|
|
194
|
+
if (!id.startsWith(srcDir) || id.includes("network.ts")) return;
|
|
195
|
+
if (!/\.(ts|tsx|js|jsx)$/.test(id)) return;
|
|
196
|
+
|
|
197
|
+
const ast = this.parse(code) as unknown as EstreeNode;
|
|
198
|
+
collectNetworkCalls(ast, id, srcDir, results);
|
|
199
|
+
} catch {
|
|
200
|
+
// Ignore analyzer failures and avoid blocking builds.
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
closeBundle() {
|
|
204
|
+
if (!isBuild) return;
|
|
205
|
+
writeRoutes(results);
|
|
206
|
+
results.length = 0;
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function createAppEntryMatcher(srcDir: string) {
|
|
212
|
+
const candidateEntries = new Set(
|
|
213
|
+
["app.ts", "app.tsx", "app.js", "app.jsx"].map((name) =>
|
|
214
|
+
path.normalize(path.join(srcDir, name)),
|
|
215
|
+
),
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
return (id: string) => {
|
|
219
|
+
if (!id.includes("/app.") && !id.includes("\\app.")) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const cleanId = id.split("?")[0];
|
|
224
|
+
return candidateEntries.has(path.normalize(cleanId));
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function buildInjectedViteErrorReporter(targetOrigins: string[]) {
|
|
229
|
+
return `
|
|
230
|
+
/* Injected vite error reporter */
|
|
231
|
+
if (typeof window !== "undefined" &&
|
|
232
|
+
window !== window.parent &&
|
|
233
|
+
import.meta.hot &&
|
|
234
|
+
!window.__AGI_VITE_ERROR_SYNC__) {
|
|
235
|
+
window.__AGI_VITE_ERROR_SYNC__ = true;
|
|
236
|
+
const viteErrorTargets = ${JSON.stringify(targetOrigins)};
|
|
237
|
+
const postToParent = (message) => {
|
|
238
|
+
viteErrorTargets.forEach((targetOrigin) => {
|
|
239
|
+
try {
|
|
240
|
+
window.parent.postMessage(message, targetOrigin);
|
|
241
|
+
} catch (error) {
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
const normalizeError = (err) => {
|
|
246
|
+
if (!err) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
message: err.message,
|
|
251
|
+
id: err.id,
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
import.meta.hot.on("vite:error", (payload) => {
|
|
256
|
+
const error = normalizeError(payload && payload.err);
|
|
257
|
+
if (!error) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
window.__LAST_VITE_ERROR__ = error;
|
|
261
|
+
postToParent({ type: "VITE_ERROR", hasError: true, error });
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
import.meta.hot.on("vite:beforeUpdate", () => {
|
|
265
|
+
window.__LAST_VITE_ERROR__ = null;
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
`;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// dev-only 路由自愈:app.config 改动重启重载后,若当前 URL 对应页面已从
|
|
272
|
+
// pages 中移除,重定向到新首页。兼容 hash(本地)与 browser(云端 + basename)模式。
|
|
273
|
+
function buildInjectedRouteHealer() {
|
|
274
|
+
return `
|
|
275
|
+
/* Injected dev route healer */
|
|
276
|
+
if (typeof window !== "undefined" && !window.__AGI_ROUTE_HEALER__) {
|
|
277
|
+
window.__AGI_ROUTE_HEALER__ = true;
|
|
278
|
+
var healRoute = function () {
|
|
279
|
+
try {
|
|
280
|
+
var config = window.__taroAppConfig;
|
|
281
|
+
var pages = config && config.pages;
|
|
282
|
+
if (!pages || !pages.length) return;
|
|
283
|
+
var router = config.router || {};
|
|
284
|
+
var mode = router.mode || "hash";
|
|
285
|
+
var basename = router.basename || "";
|
|
286
|
+
var stripBase = function (p) {
|
|
287
|
+
if (basename && p.indexOf(basename) === 0) p = p.slice(basename.length);
|
|
288
|
+
return p.replace(/^\\//, "");
|
|
289
|
+
};
|
|
290
|
+
var currentPath;
|
|
291
|
+
if (mode === "browser" || mode === "multi") {
|
|
292
|
+
currentPath = stripBase(window.location.pathname).split("?")[0];
|
|
293
|
+
} else {
|
|
294
|
+
var hash = window.location.hash || "";
|
|
295
|
+
currentPath = hash.replace(/^#/, "").split("?")[0].replace(/^\\//, "");
|
|
296
|
+
}
|
|
297
|
+
if (!currentPath) return;
|
|
298
|
+
var exists = pages.some(function (p) {
|
|
299
|
+
return p === currentPath || ("/" + p) === ("/" + currentPath);
|
|
300
|
+
});
|
|
301
|
+
if (exists) return;
|
|
302
|
+
var home = pages[0];
|
|
303
|
+
if (mode === "browser" || mode === "multi") {
|
|
304
|
+
var target = (basename ? basename.replace(/\\/$/, "") : "") + "/" + home;
|
|
305
|
+
window.location.replace(target + window.location.search);
|
|
306
|
+
} else {
|
|
307
|
+
window.location.hash = "#/" + home;
|
|
308
|
+
}
|
|
309
|
+
} catch (e) {}
|
|
310
|
+
};
|
|
311
|
+
if (document.readyState === "complete") {
|
|
312
|
+
setTimeout(healRoute, 0);
|
|
313
|
+
} else {
|
|
314
|
+
window.addEventListener("load", function () { setTimeout(healRoute, 0); });
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
`;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* @desc 创建普通小程序的 Taro/Vite 构建配置。
|
|
322
|
+
* @params {CreateMicroappTaroConfigOptions} options 构建配置选项。
|
|
323
|
+
* @return {UserConfigExport} Taro 配置工厂函数。
|
|
324
|
+
* @example createMicroappTaroConfig({ projectRoot: process.cwd() })
|
|
325
|
+
* @ai-intent 创建普通小程序的 Taro/Vite 构建配置。
|
|
326
|
+
* @ai-when 构建脚本需要加载普通小程序的 SDK 配置时。
|
|
327
|
+
* @ai-avoid 不要在业务页面调用该构建工厂,也不要绕过 SDK 修改代理配置。
|
|
328
|
+
* @ai-example createMicroappTaroConfig({ projectRoot: process.cwd() })
|
|
329
|
+
*/
|
|
330
|
+
export function createMicroappTaroConfig(
|
|
331
|
+
options: CreateMicroappTaroConfigOptions,
|
|
332
|
+
): UserConfigExport {
|
|
333
|
+
return (async (merge: (...configs: any[]) => UserConfigExport) => {
|
|
334
|
+
const DOUYIN_CLOUD_ENV_ID = process.env.DOUYIN_CLOUD_ENV_ID || "";
|
|
335
|
+
const DOUYIN_CLOUD_DEV_ENV_ID = process.env.DOUYIN_CLOUD_DEV_ENV_ID || "";
|
|
336
|
+
const DOUYIN_CLOUD_SERVICE_ID = process.env.DOUYIN_CLOUD_SERVICE_ID || "";
|
|
337
|
+
const APP_ID = process.env.APP_ID || "";
|
|
338
|
+
const OPEN_CARD_ID = process.env.OPEN_CARD_ID || "";
|
|
339
|
+
const AUDIT_DOUYIN_CLOUD_ENV_ID = process.env.AUDIT_DOUYIN_CLOUD_ENV_ID || "";
|
|
340
|
+
const AUDIT_DOUYIN_CLOUD_SERVICE_ID = process.env.AUDIT_DOUYIN_CLOUD_SERVICE_ID || "";
|
|
341
|
+
if (APP_ID) {
|
|
342
|
+
process.env.TARO_APP_ID = APP_ID;
|
|
343
|
+
}
|
|
344
|
+
const projectRoot = path.resolve(options.projectRoot)
|
|
345
|
+
const srcDir = path.resolve(projectRoot, "src");
|
|
346
|
+
// Keep generated projects using their local icons; SDK-based templates use
|
|
347
|
+
// the scoped package while still accepting legacy `lucide-taro` imports.
|
|
348
|
+
const legacyIconEntry = path.resolve(projectRoot, 'icons/dist/lucide-taro.mjs')
|
|
349
|
+
const isH5 = process.env.TARO_ENV === 'h5';
|
|
350
|
+
const viteErrorTargets = options.viteErrorTargets ?? []
|
|
351
|
+
const cloudDevProjectDomain = viteErrorTargets[0] ?? ''
|
|
352
|
+
let conversationId = ''
|
|
353
|
+
try {
|
|
354
|
+
const meta = JSON.parse(
|
|
355
|
+
fs.readFileSync('/opt/gem/ai_coding_app/.meta/ai_coding_app_meta.json', 'utf8'),
|
|
356
|
+
) as { conversation_id?: string }
|
|
357
|
+
conversationId = meta.conversation_id ?? ''
|
|
358
|
+
} catch {
|
|
359
|
+
// Local development has no cloud metadata.
|
|
360
|
+
}
|
|
361
|
+
const isCloudEnv = Boolean(conversationId)
|
|
362
|
+
const previewBasePath = isCloudEnv
|
|
363
|
+
? `/api/apps/open_ai_coding_chat_server/aio_fe/${conversationId}/preview`
|
|
364
|
+
: ''
|
|
365
|
+
const aioServerPath = isCloudEnv
|
|
366
|
+
? `${cloudDevProjectDomain}/api/apps/open_ai_coding_chat_server/aio_server/${conversationId}/api`
|
|
367
|
+
: 'http://localhost:10086/api'
|
|
368
|
+
const backendUrl = `http://localhost:${process.env.NJS_SERVER_PORT || '3000'}`
|
|
369
|
+
const withProjectDomain = (urlPath: string) => {
|
|
370
|
+
if (isCloudEnv && process.env.NODE_ENV === 'production') {
|
|
371
|
+
return `https://ma.zijieapi.com${urlPath}`
|
|
372
|
+
}
|
|
373
|
+
if (isCloudEnv && process.env.NODE_ENV === 'development') {
|
|
374
|
+
return `${cloudDevProjectDomain}${urlPath}`
|
|
375
|
+
}
|
|
376
|
+
return `http://localhost:10086${urlPath}`
|
|
377
|
+
}
|
|
378
|
+
const aioServerUrl = new URL(aioServerPath)
|
|
379
|
+
const PROJECT_DOMAIN = process.env.PROJECT_DOMAIN || withProjectDomain(aioServerUrl.pathname)
|
|
380
|
+
const UPLOAD_URL = process.env.UPLOAD_URL || withProjectDomain(
|
|
381
|
+
`/api/apps/open_ai_coding_chat_server/aio_server/${conversationId}/v1/file/upload`,
|
|
382
|
+
)
|
|
383
|
+
const DOWNLOAD_URL = process.env.DOWNLOAD_URL || withProjectDomain(
|
|
384
|
+
`/api/apps/open_ai_coding_chat_server/aio_server/${conversationId}/v1/file/download?path=`,
|
|
385
|
+
)
|
|
386
|
+
const proxyConfig = isCloudEnv
|
|
387
|
+
? {
|
|
388
|
+
[aioServerPath]: {
|
|
389
|
+
target: backendUrl,
|
|
390
|
+
changeOrigin: true,
|
|
391
|
+
secure: false,
|
|
392
|
+
rewrite: (requestPath: string) => {
|
|
393
|
+
const rest = requestPath.replace(aioServerPath, '')
|
|
394
|
+
return rest.startsWith('/api') ? rest : `/api${rest}`
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
}
|
|
398
|
+
: {
|
|
399
|
+
'/api': { target: backendUrl, changeOrigin: true, secure: false },
|
|
400
|
+
}
|
|
401
|
+
const devConfig: UserConfigExport<'vite'> = {
|
|
402
|
+
logger: { quiet: false, stats: true },
|
|
403
|
+
mini: {},
|
|
404
|
+
h5: {
|
|
405
|
+
publicPath: isCloudEnv ? `${previewBasePath}/` : '/',
|
|
406
|
+
router: isCloudEnv
|
|
407
|
+
? { mode: 'browser', basename: previewBasePath }
|
|
408
|
+
: { mode: 'hash' },
|
|
409
|
+
devServer: {
|
|
410
|
+
port: 10086,
|
|
411
|
+
open: false,
|
|
412
|
+
...({ hmr: false } as Record<string, unknown>),
|
|
413
|
+
proxy: proxyConfig,
|
|
414
|
+
},
|
|
415
|
+
},
|
|
416
|
+
}
|
|
417
|
+
const prodConfig: UserConfigExport = {
|
|
418
|
+
mini: {},
|
|
419
|
+
cache: { enable: true },
|
|
420
|
+
h5: {},
|
|
421
|
+
}
|
|
422
|
+
const appConfigPath = path.join(srcDir, "app.config.ts");
|
|
423
|
+
// 保存 Taro 常驻编译上下文的引用,用于刷新 app/pages 与重置 loaderMeta。
|
|
424
|
+
let taroCompilerContext: any;
|
|
425
|
+
const isAppEntry = createAppEntryMatcher(srcDir);
|
|
426
|
+
const injectedViteErrorReporter = buildInjectedViteErrorReporter(
|
|
427
|
+
viteErrorTargets,
|
|
428
|
+
);
|
|
429
|
+
// dev(watch 模式)下 tt 产物输出到 dist,
|
|
430
|
+
// 与 build:tt(NODE_ENV=production)的 dist-tt 区分开。
|
|
431
|
+
const isDevBuild = process.env.NODE_ENV === 'development';
|
|
432
|
+
const injectedRouteHealer = buildInjectedRouteHealer();
|
|
433
|
+
const isTt = process.env.TARO_ENV === 'tt';
|
|
434
|
+
const shouldRefreshAppConfigOnUpdate = isH5 || isTt;
|
|
435
|
+
let shouldRefreshTtConfig = false;
|
|
436
|
+
const refreshTaroCompilerContext = (
|
|
437
|
+
ctx: any,
|
|
438
|
+
options: { resetLoaderMeta?: boolean } = {},
|
|
439
|
+
) => {
|
|
440
|
+
if (!ctx) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (options.resetLoaderMeta) {
|
|
444
|
+
ctx.loaderMeta = undefined;
|
|
445
|
+
}
|
|
446
|
+
// 原地更新,保持 app 对象 / pages 数组引用(下游插件闭包持有)。
|
|
447
|
+
if (typeof ctx.getApp === "function" && ctx.app) {
|
|
448
|
+
Object.assign(ctx.app, ctx.getApp());
|
|
449
|
+
}
|
|
450
|
+
if (typeof ctx.getPages === "function" && Array.isArray(ctx.pages)) {
|
|
451
|
+
ctx.pages.splice(0, ctx.pages.length, ...ctx.getPages());
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
const outputRootMap: Record<string, string> = {
|
|
455
|
+
tt: isDevBuild ? 'dist' : 'dist-tt',
|
|
456
|
+
h5: 'dist-web',
|
|
457
|
+
};
|
|
458
|
+
const defaultOutputRoot = outputRootMap[process.env.TARO_ENV || ''] || 'dist';
|
|
459
|
+
const baseConfig: UserConfigExport<"vite"> = {
|
|
460
|
+
projectName: "microapp",
|
|
461
|
+
date: "2026-3-5",
|
|
462
|
+
designWidth: 375,
|
|
463
|
+
deviceRatio: {
|
|
464
|
+
640: 2.34 / 2,
|
|
465
|
+
750: 1,
|
|
466
|
+
375: 2,
|
|
467
|
+
828: 1.81 / 2,
|
|
468
|
+
},
|
|
469
|
+
sourceRoot: "src",
|
|
470
|
+
outputRoot: defaultOutputRoot,
|
|
471
|
+
alias: {
|
|
472
|
+
"@": srcDir,
|
|
473
|
+
// TT collects used native components from plugin-inject's export barrel.
|
|
474
|
+
// Only replace the internal native entry; preserve the SDK runtime wrapper.
|
|
475
|
+
...(isTt ? {
|
|
476
|
+
'#miniapp-open-card-native': '@tarojs/plugin-inject/dist/components-react.js',
|
|
477
|
+
} : {}),
|
|
478
|
+
"lucide-taro": fs.existsSync(legacyIconEntry)
|
|
479
|
+
? legacyIconEntry
|
|
480
|
+
: '@open-dy/lucide-taro',
|
|
481
|
+
},
|
|
482
|
+
plugins: [
|
|
483
|
+
[
|
|
484
|
+
path.resolve(SDK_DIR, "plugins/app-config.cjs"),
|
|
485
|
+
{ previewBasePath }
|
|
486
|
+
],
|
|
487
|
+
[
|
|
488
|
+
"@tarojs/plugin-inject", // 注入抖音小程序的一些原生事件
|
|
489
|
+
{
|
|
490
|
+
components: {
|
|
491
|
+
// Registers the host-side MiniappOpenCard mapping. Business code
|
|
492
|
+
// imports MiniappOpenCard from the Taro SDK; its props,
|
|
493
|
+
// domain rules, and rendering requirements live in the Skill
|
|
494
|
+
// reference rather than in this build-only plugin configuration.
|
|
495
|
+
MiniappOpenCard: {
|
|
496
|
+
'app-id': JSON.stringify(OPEN_CARD_ID),
|
|
497
|
+
path: '',
|
|
498
|
+
'init-data': '',
|
|
499
|
+
'env-version': '',
|
|
500
|
+
bindLoad: '',
|
|
501
|
+
bindError: '',
|
|
502
|
+
},
|
|
503
|
+
Button: {
|
|
504
|
+
'bindaddshortcut': '', // 注入 bindaddshortcut 事件,当openType为addShortcut时回调触发
|
|
505
|
+
'data-video-id': '', // 注入 data-video-id 属性,当openType为navigateToVideoView时,指定跳转的视频id
|
|
506
|
+
'data-video-type': '', // 注入 data-video-type 属性,当openType为navigateToVideoView时,指定跳转的视频类型
|
|
507
|
+
'bindnavigatetovideoview': '', // 注入 bindnavigatetovideoview 事件,当openType为navigateToVideoView时回调触发
|
|
508
|
+
},
|
|
509
|
+
ChannelVideo: {
|
|
510
|
+
'item-id': '',
|
|
511
|
+
'item-id-type': "'raw'",
|
|
512
|
+
autoplay: 'false',
|
|
513
|
+
loop: 'false',
|
|
514
|
+
'object-fit': "'contain'",
|
|
515
|
+
preload: 'false',
|
|
516
|
+
bindplay: '',
|
|
517
|
+
bindpause: '',
|
|
518
|
+
bindwaiting: '',
|
|
519
|
+
bindstop: '',
|
|
520
|
+
bindend: '',
|
|
521
|
+
bindprogress: '',
|
|
522
|
+
binderror: '',
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
componentsMap: {
|
|
526
|
+
MiniappOpenCard: "miniapp-open-card",
|
|
527
|
+
ChannelVideo: 'channel-video',
|
|
528
|
+
},
|
|
529
|
+
voidComponents: ['channel-video'],
|
|
530
|
+
}
|
|
531
|
+
],
|
|
532
|
+
],
|
|
533
|
+
defineConstants: {
|
|
534
|
+
PROJECT_DOMAIN: JSON.stringify(PROJECT_DOMAIN),
|
|
535
|
+
DOUYIN_CLOUD_ENV_ID: JSON.stringify(DOUYIN_CLOUD_ENV_ID),
|
|
536
|
+
DOUYIN_CLOUD_DEV_ENV_ID: JSON.stringify(DOUYIN_CLOUD_DEV_ENV_ID),
|
|
537
|
+
DOUYIN_CLOUD_SERVICE_ID: JSON.stringify(DOUYIN_CLOUD_SERVICE_ID),
|
|
538
|
+
OPEN_CARD_ID: JSON.stringify(OPEN_CARD_ID),
|
|
539
|
+
AUDIT_DOUYIN_CLOUD_ENV_ID: JSON.stringify(AUDIT_DOUYIN_CLOUD_ENV_ID),
|
|
540
|
+
AUDIT_DOUYIN_CLOUD_SERVICE_ID: JSON.stringify(AUDIT_DOUYIN_CLOUD_SERVICE_ID),
|
|
541
|
+
UPLOAD_URL: JSON.stringify(UPLOAD_URL),
|
|
542
|
+
DOWNLOAD_URL: JSON.stringify(DOWNLOAD_URL),
|
|
543
|
+
},
|
|
544
|
+
copy: {
|
|
545
|
+
patterns: [],
|
|
546
|
+
options: {},
|
|
547
|
+
},
|
|
548
|
+
jsMinimizer: "esbuild",
|
|
549
|
+
framework: "react",
|
|
550
|
+
compiler: {
|
|
551
|
+
type: "vite",
|
|
552
|
+
vitePlugins: [
|
|
553
|
+
...(isTt ? [viteTtComponentsEntryPlugin()] : []),
|
|
554
|
+
viteDependCardPlugin(),
|
|
555
|
+
viteTaroSourceLocationPlugin({
|
|
556
|
+
enabled: isDevBuild,
|
|
557
|
+
projectRoot,
|
|
558
|
+
}),
|
|
559
|
+
{
|
|
560
|
+
name: "build-sourcemap",
|
|
561
|
+
config(config) {
|
|
562
|
+
if (!isTt && !isDevBuild) {
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
config.build = config.build ?? {};
|
|
566
|
+
config.build.sourcemap = true;
|
|
567
|
+
if (isDevBuild) {
|
|
568
|
+
config.build.minify = false;
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
},
|
|
572
|
+
viteInlineJsonPlugin({
|
|
573
|
+
projectRoot,
|
|
574
|
+
}),
|
|
575
|
+
viteImageAssetImportPlugin({
|
|
576
|
+
projectRoot,
|
|
577
|
+
}),
|
|
578
|
+
...(isH5
|
|
579
|
+
? []
|
|
580
|
+
: [
|
|
581
|
+
UnifiedViteWeappTailwindcssPlugin({
|
|
582
|
+
rem2rpx: true,
|
|
583
|
+
cssEntries: [path.resolve(srcDir, "app.css")],
|
|
584
|
+
cssSelectorReplacement: {
|
|
585
|
+
universal: ['view', 'text', 'page'],
|
|
586
|
+
},
|
|
587
|
+
}),
|
|
588
|
+
]),
|
|
589
|
+
{
|
|
590
|
+
name: "postcss-config-loader-plugin",
|
|
591
|
+
config(config) {
|
|
592
|
+
if (typeof config.css?.postcss === "object") {
|
|
593
|
+
config.css?.postcss.plugins?.unshift(tailwindcss());
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
// Avoid a separate pre-bundled lucide-taro chunk in H5 dev.
|
|
599
|
+
name: "lucide-taro-alias-fix",
|
|
600
|
+
config(config) {
|
|
601
|
+
config.optimizeDeps = config.optimizeDeps ?? {};
|
|
602
|
+
config.optimizeDeps.exclude = [...new Set([
|
|
603
|
+
...(config.optimizeDeps.exclude ?? []),
|
|
604
|
+
"lucide-taro",
|
|
605
|
+
"@open-dy/lucide-taro",
|
|
606
|
+
])];
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: "cloud-preview-hmr-path",
|
|
611
|
+
config() {
|
|
612
|
+
if (!isH5 || !previewBasePath) {
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
return {
|
|
616
|
+
server: {
|
|
617
|
+
hmr: {
|
|
618
|
+
path: `/ws`,
|
|
619
|
+
},
|
|
620
|
+
},
|
|
621
|
+
};
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
name: "allow-all-hosts",
|
|
626
|
+
configureServer(server) {
|
|
627
|
+
server.config.server.allowedHosts = true;
|
|
628
|
+
},
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
name: "vite-optimized-deps-no-cache",
|
|
632
|
+
configureServer(server: any) {
|
|
633
|
+
if (!isH5 || process.env.NODE_ENV === "production") {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
server.middlewares.use((req: any, res: any, next: any) => {
|
|
637
|
+
if (!isViteOptimizedDepsRequest(req.url)) {
|
|
638
|
+
return next();
|
|
639
|
+
}
|
|
640
|
+
const originalSetHeader = res.setHeader.bind(res);
|
|
641
|
+
res.setHeader = ((name: string, value: string | number | readonly string[]) => {
|
|
642
|
+
if (name.toLowerCase() === "cache-control") {
|
|
643
|
+
return originalSetHeader(name, "no-cache");
|
|
644
|
+
}
|
|
645
|
+
return originalSetHeader(name, value);
|
|
646
|
+
}) as typeof res.setHeader;
|
|
647
|
+
next();
|
|
648
|
+
});
|
|
649
|
+
},
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: "preview-history-fallback",
|
|
653
|
+
configureServer(server) {
|
|
654
|
+
server.middlewares.use((req, res, next) => {
|
|
655
|
+
if (!shouldRewritePreviewRequest(req)) {
|
|
656
|
+
return next();
|
|
657
|
+
}
|
|
658
|
+
if (
|
|
659
|
+
previewBasePath &&
|
|
660
|
+
req.url?.startsWith(previewBasePath) &&
|
|
661
|
+
!req.url.startsWith(`${previewBasePath}/ws`) &&
|
|
662
|
+
!req.url.includes("/@vite/") &&
|
|
663
|
+
!/\.[a-zA-Z0-9]+($|\?)/.test(req.url)
|
|
664
|
+
) {
|
|
665
|
+
const urlObj = new URL(req.url, `http://${req.headers.host}`);
|
|
666
|
+
urlObj.pathname = `${previewBasePath}/`;
|
|
667
|
+
req.url = urlObj.pathname + urlObj.search;
|
|
668
|
+
}
|
|
669
|
+
next();
|
|
670
|
+
});
|
|
671
|
+
},
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
// app.config 改动需重建路由/入口,普通 HMR 无效。Taro 常驻
|
|
675
|
+
// viteCompilerContext 的 app/pages 在进程启动时定死,因此要在同一
|
|
676
|
+
// context 上原地刷新 app/pages。H5 侧仍触发 dev server 重启,并重置
|
|
677
|
+
// loaderMeta(规避 taro-react 字符串拼接累积导致的 React import 重复)。
|
|
678
|
+
// tt 侧显式 watch app.config.ts,页面配置由 Taro 自身监听。
|
|
679
|
+
// 两者变化时都在下一轮编译前刷新 context,让 JSON 和页面 JS 使用新配置。
|
|
680
|
+
name: "refresh-on-app-config-change",
|
|
681
|
+
async buildStart() {
|
|
682
|
+
if (!shouldRefreshAppConfigOnUpdate) {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
if (isTt && this.meta.watchMode) {
|
|
686
|
+
this.addWatchFile(appConfigPath);
|
|
687
|
+
}
|
|
688
|
+
try {
|
|
689
|
+
const info = await (this as any).load({ id: "taro:compiler" });
|
|
690
|
+
const ctx = (info?.meta as any)?.viteCompilerContext;
|
|
691
|
+
if (ctx) {
|
|
692
|
+
taroCompilerContext = ctx;
|
|
693
|
+
if (isTt && this.meta.watchMode && shouldRefreshTtConfig) {
|
|
694
|
+
refreshTaroCompilerContext(ctx);
|
|
695
|
+
shouldRefreshTtConfig = false;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
} catch {
|
|
699
|
+
// 取不到时静默降级。
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
watchChange(id) {
|
|
703
|
+
if (!isTt || !this.meta.watchMode) {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
const configPath = path.normalize(id.split("?")[0].split("#")[0]);
|
|
707
|
+
const isPageConfig = taroCompilerContext?.pages?.some(
|
|
708
|
+
(page: { configPath?: string }) =>
|
|
709
|
+
typeof page?.configPath === "string" &&
|
|
710
|
+
path.normalize(page.configPath) === configPath,
|
|
711
|
+
);
|
|
712
|
+
if (configPath === path.normalize(appConfigPath) || isPageConfig) {
|
|
713
|
+
shouldRefreshTtConfig = true;
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
handleHotUpdate({ file, server }) {
|
|
717
|
+
if (!isH5) {
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
if (file === appConfigPath) {
|
|
721
|
+
server.config.logger.info(
|
|
722
|
+
"[refresh-on-app-config-change] app.config 变化,重启 dev server...",
|
|
723
|
+
{ timestamp: true },
|
|
724
|
+
);
|
|
725
|
+
const ctx = taroCompilerContext;
|
|
726
|
+
if (ctx) {
|
|
727
|
+
try {
|
|
728
|
+
refreshTaroCompilerContext(ctx, { resetLoaderMeta: true });
|
|
729
|
+
} catch {
|
|
730
|
+
// 刷新失败时退回到「仅重启」。
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
server.restart();
|
|
734
|
+
return [];
|
|
735
|
+
}
|
|
736
|
+
},
|
|
737
|
+
},
|
|
738
|
+
networkUrlAnalyzerPlugin(srcDir),
|
|
739
|
+
{
|
|
740
|
+
name: "inject-dev-scripts",
|
|
741
|
+
transform(code: string, id: string) {
|
|
742
|
+
if (!isH5 || process.env.NODE_ENV === "production") {
|
|
743
|
+
return null;
|
|
744
|
+
}
|
|
745
|
+
if (!isAppEntry(id)) {
|
|
746
|
+
return null;
|
|
747
|
+
}
|
|
748
|
+
return `${code}\n${injectedViteErrorReporter}\n${injectedRouteHealer}`;
|
|
749
|
+
},
|
|
750
|
+
transformIndexHtml(html: string) {
|
|
751
|
+
if (!isH5 || process.env.NODE_ENV === "production") {
|
|
752
|
+
return html;
|
|
753
|
+
}
|
|
754
|
+
return html.replace(
|
|
755
|
+
"</head>",
|
|
756
|
+
` <script>window.__CONSOLE_BRIDGE_CONFIG__ = Object.assign({}, window.__CONSOLE_BRIDGE_CONFIG__, { appType: "microapp" });</script>\n <script src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_wwhpupt_ylwvslclk/ljhwZthlaukjlkulzlp/vibe-coding-inject/console-proxy.js?t=${Date.now()}"></script>\n <script src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_wwhpupt_ylwvslclk/ljhwZthlaukjlkulzlp/vibe-coding-inject/vite-overlay-observer.js?t=${Date.now()}"></script>\n</head>`,
|
|
757
|
+
);
|
|
758
|
+
},
|
|
759
|
+
},
|
|
760
|
+
],
|
|
761
|
+
},
|
|
762
|
+
cache: {
|
|
763
|
+
enable: true, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
|
764
|
+
},
|
|
765
|
+
mini: {
|
|
766
|
+
postcss: {
|
|
767
|
+
pxtransform: {
|
|
768
|
+
enable: true,
|
|
769
|
+
config: {},
|
|
770
|
+
},
|
|
771
|
+
cssModules: {
|
|
772
|
+
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
|
773
|
+
config: {
|
|
774
|
+
namingPattern: "module", // 转换模式,取值为 global/module
|
|
775
|
+
generateScopedName: "[name]__[local]___[hash:base64:5]",
|
|
776
|
+
},
|
|
777
|
+
},
|
|
778
|
+
},
|
|
779
|
+
},
|
|
780
|
+
h5: {
|
|
781
|
+
publicPath: "/",
|
|
782
|
+
staticDirectory: "static",
|
|
783
|
+
miniCssExtractPluginOption: {
|
|
784
|
+
ignoreOrder: true,
|
|
785
|
+
filename: "css/[name].[hash].css",
|
|
786
|
+
chunkFilename: "css/[name].[chunkhash].css",
|
|
787
|
+
},
|
|
788
|
+
postcss: {
|
|
789
|
+
autoprefixer: {
|
|
790
|
+
enable: true,
|
|
791
|
+
config: {},
|
|
792
|
+
},
|
|
793
|
+
cssModules: {
|
|
794
|
+
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
|
795
|
+
config: {
|
|
796
|
+
namingPattern: "module", // 转换模式,取值为 global/module
|
|
797
|
+
generateScopedName: "[name]__[local]___[hash:base64:5]",
|
|
798
|
+
},
|
|
799
|
+
},
|
|
800
|
+
},
|
|
801
|
+
},
|
|
802
|
+
rn: {
|
|
803
|
+
appName: "taroDemo",
|
|
804
|
+
postcss: {
|
|
805
|
+
cssModules: {
|
|
806
|
+
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
|
807
|
+
},
|
|
808
|
+
},
|
|
809
|
+
},
|
|
810
|
+
};
|
|
811
|
+
if (process.env.NODE_ENV === "development") {
|
|
812
|
+
// 本地开发构建配置(不混淆压缩)
|
|
813
|
+
const config = merge({}, baseConfig, devConfig)
|
|
814
|
+
return applyConfigOverrides(config, options.overrides, {
|
|
815
|
+
isH5,
|
|
816
|
+
isTt,
|
|
817
|
+
mode: process.env.NODE_ENV ?? '',
|
|
818
|
+
projectRoot,
|
|
819
|
+
})
|
|
820
|
+
}
|
|
821
|
+
// 生产构建配置(默认开启压缩混淆等)
|
|
822
|
+
const config = merge({}, baseConfig, prodConfig)
|
|
823
|
+
return applyConfigOverrides(config, options.overrides, {
|
|
824
|
+
isH5,
|
|
825
|
+
isTt,
|
|
826
|
+
mode: process.env.NODE_ENV ?? '',
|
|
827
|
+
projectRoot,
|
|
828
|
+
})
|
|
829
|
+
}) as UserConfigExport
|
|
830
|
+
}
|