@open-dy/vibecoding-sdk-taro 0.0.1 → 0.1.0-beta.0
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/adapters/interest-card/eslint/eslint-plugin-custom-navigation.mjs +2 -290
- package/dist/adapters/interest-card/eslint/taro.mjs +8 -42
- package/dist/build/plugins/inject-feed-card-meta.cjs +148 -0
- package/dist/build/taro.js +1 -0
- package/dist/build/taro.js.map +1 -1
- package/dist/components/miniapp-open-card.d.ts +46 -1
- package/dist/components/miniapp-open-card.js +14 -1
- package/dist/components/miniapp-open-card.js.map +1 -1
- package/dist/eslint/eslint-plugin-custom-navigation.mjs +301 -0
- package/dist/eslint/eslint-plugin-network-json-body.mjs +103 -0
- package/dist/eslint/taro.mjs +38 -1
- package/dist/reference/llms.txt +72 -80
- package/dist/reference/sdk-api/build/taro/BuildContext.md +1 -1
- package/dist/reference/sdk-api/build/taro/CreateMicroappTaroConfigOptions.md +1 -1
- package/dist/reference/sdk-api/build/taro/createMicroappTaroConfig.md +1 -1
- package/dist/reference/sdk-api/components/miniapp-open-card/MiniappOpenCard.md +109 -0
- package/dist/reference/sdk-api/components/miniapp-open-card/MiniappOpenCardEnvVersion.md +38 -0
- package/dist/reference/sdk-api/components/miniapp-open-card/MiniappOpenCardErrorDetail.md +52 -0
- package/dist/reference/sdk-api/components/miniapp-open-card/MiniappOpenCardProps.md +76 -0
- package/dist/reference/sdk-api/components/miniapp-open-card/index.md +12 -0
- package/dist/reference/sdk-api/libraries/lucide-taro.md +151 -0
- package/dist/reference/sdk-api/runtime/CreateMicroappClientOptions.md +1 -1
- package/dist/reference/sdk-api/runtime/createMicroappClient.md +2 -2
- package/dist/reference/sdk-api/ui/accordion/Accordion.md +1 -1
- package/dist/reference/sdk-api/ui/accordion/AccordionContent.md +1 -1
- package/dist/reference/sdk-api/ui/accordion/AccordionItem.md +1 -1
- package/dist/reference/sdk-api/ui/accordion/AccordionTrigger.md +1 -1
- package/dist/reference/sdk-api/ui/alert/Alert.md +1 -1
- package/dist/reference/sdk-api/ui/alert/AlertAction.md +1 -1
- package/dist/reference/sdk-api/ui/alert/AlertDescription.md +1 -1
- package/dist/reference/sdk-api/ui/alert/AlertTitle.md +1 -1
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialog.md +1 -1
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogAction.md +2 -2
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogCancel.md +2 -2
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogContent.md +1 -1
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogDescription.md +1 -1
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogFooter.md +1 -1
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogHeader.md +1 -1
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogOverlay.md +1 -1
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogPortal.md +1 -1
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogTitle.md +1 -1
- package/dist/reference/sdk-api/ui/alert-dialog/AlertDialogTrigger.md +22 -22
- package/dist/reference/sdk-api/ui/aspect-ratio/AspectRatio.md +1 -1
- package/dist/reference/sdk-api/ui/avatar/Avatar.md +1 -1
- package/dist/reference/sdk-api/ui/avatar/AvatarBadge.md +1 -1
- package/dist/reference/sdk-api/ui/avatar/AvatarFallback.md +1 -1
- package/dist/reference/sdk-api/ui/avatar/AvatarGroup.md +1 -1
- package/dist/reference/sdk-api/ui/avatar/AvatarGroupCount.md +1 -1
- package/dist/reference/sdk-api/ui/avatar/AvatarImage.md +19 -19
- package/dist/reference/sdk-api/ui/badge/Badge.md +2 -2
- package/dist/reference/sdk-api/ui/badge/badgeVariants.md +2 -2
- package/dist/reference/sdk-api/ui/button/Button.md +2 -2
- package/dist/reference/sdk-api/ui/button/ButtonProps.md +2 -2
- package/dist/reference/sdk-api/ui/button/buttonVariants.md +2 -2
- package/dist/reference/sdk-api/ui/button-group/ButtonGroup.md +1 -1
- package/dist/reference/sdk-api/ui/button-group/ButtonGroupSeparator.md +1 -1
- package/dist/reference/sdk-api/ui/button-group/ButtonGroupText.md +22 -22
- package/dist/reference/sdk-api/ui/button-group/buttonGroupVariants.md +1 -1
- package/dist/reference/sdk-api/ui/calendar/Calendar.md +1 -1
- package/dist/reference/sdk-api/ui/calendar/CalendarProps.md +1 -1
- package/dist/reference/sdk-api/ui/card/Card.md +1 -1
- package/dist/reference/sdk-api/ui/card/CardAction.md +1 -1
- package/dist/reference/sdk-api/ui/card/CardContent.md +1 -1
- package/dist/reference/sdk-api/ui/card/CardDescription.md +1 -1
- package/dist/reference/sdk-api/ui/card/CardFooter.md +1 -1
- package/dist/reference/sdk-api/ui/card/CardHeader.md +1 -1
- package/dist/reference/sdk-api/ui/card/CardTitle.md +1 -1
- package/dist/reference/sdk-api/ui/carousel/Carousel.md +1 -1
- package/dist/reference/sdk-api/ui/carousel/CarouselContent.md +1 -1
- package/dist/reference/sdk-api/ui/carousel/CarouselItem.md +1 -1
- package/dist/reference/sdk-api/ui/carousel/CarouselNext.md +2 -2
- package/dist/reference/sdk-api/ui/carousel/CarouselPrevious.md +2 -2
- package/dist/reference/sdk-api/ui/carousel/useCarousel.md +1 -1
- package/dist/reference/sdk-api/ui/checkbox/Checkbox.md +1 -1
- package/dist/reference/sdk-api/ui/collapsible/Collapsible.md +1 -1
- package/dist/reference/sdk-api/ui/collapsible/CollapsibleContent.md +1 -1
- package/dist/reference/sdk-api/ui/collapsible/CollapsibleTrigger.md +22 -22
- package/dist/reference/sdk-api/ui/combobox/Combobox.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxChip.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxChips.md +22 -22
- package/dist/reference/sdk-api/ui/combobox/ComboboxChipsInput.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxCollection.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxContent.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxEmpty.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxGroup.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxInput.md +22 -22
- package/dist/reference/sdk-api/ui/combobox/ComboboxItem.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxLabel.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxList.md +22 -22
- package/dist/reference/sdk-api/ui/combobox/ComboboxSeparator.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxTrigger.md +1 -1
- package/dist/reference/sdk-api/ui/combobox/ComboboxValue.md +22 -22
- package/dist/reference/sdk-api/ui/combobox/useComboboxAnchor.md +1 -1
- package/dist/reference/sdk-api/ui/dialog/Dialog.md +1 -1
- package/dist/reference/sdk-api/ui/dialog/DialogClose.md +1 -1
- package/dist/reference/sdk-api/ui/dialog/DialogContent.md +1 -1
- package/dist/reference/sdk-api/ui/dialog/DialogDescription.md +1 -1
- package/dist/reference/sdk-api/ui/dialog/DialogFooter.md +1 -1
- package/dist/reference/sdk-api/ui/dialog/DialogHeader.md +1 -1
- package/dist/reference/sdk-api/ui/dialog/DialogOverlay.md +1 -1
- package/dist/reference/sdk-api/ui/dialog/DialogPortal.md +1 -1
- package/dist/reference/sdk-api/ui/dialog/DialogTitle.md +1 -1
- package/dist/reference/sdk-api/ui/dialog/DialogTrigger.md +22 -22
- package/dist/reference/sdk-api/ui/drawer/Drawer.md +1 -1
- package/dist/reference/sdk-api/ui/drawer/DrawerClose.md +1 -1
- package/dist/reference/sdk-api/ui/drawer/DrawerContent.md +1 -1
- package/dist/reference/sdk-api/ui/drawer/DrawerDescription.md +1 -1
- package/dist/reference/sdk-api/ui/drawer/DrawerFooter.md +1 -1
- package/dist/reference/sdk-api/ui/drawer/DrawerHeader.md +1 -1
- package/dist/reference/sdk-api/ui/drawer/DrawerOverlay.md +1 -1
- package/dist/reference/sdk-api/ui/drawer/DrawerPortal.md +1 -1
- package/dist/reference/sdk-api/ui/drawer/DrawerTitle.md +1 -1
- package/dist/reference/sdk-api/ui/drawer/DrawerTrigger.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenu.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuCheckboxItem.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuContent.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuGroup.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuItem.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuLabel.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuPortal.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuRadioGroup.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuRadioItem.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSeparator.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuShortcut.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSub.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSubContent.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuSubTrigger.md +1 -1
- package/dist/reference/sdk-api/ui/dropdown-menu/DropdownMenuTrigger.md +22 -22
- package/dist/reference/sdk-api/ui/empty/Empty.md +1 -1
- package/dist/reference/sdk-api/ui/empty/EmptyContent.md +1 -1
- package/dist/reference/sdk-api/ui/empty/EmptyDescription.md +1 -1
- package/dist/reference/sdk-api/ui/empty/EmptyHeader.md +1 -1
- package/dist/reference/sdk-api/ui/empty/EmptyMedia.md +1 -1
- package/dist/reference/sdk-api/ui/empty/EmptyTitle.md +1 -1
- package/dist/reference/sdk-api/ui/field/Field.md +1 -1
- package/dist/reference/sdk-api/ui/field/FieldContent.md +1 -1
- package/dist/reference/sdk-api/ui/field/FieldDescription.md +1 -1
- package/dist/reference/sdk-api/ui/field/FieldError.md +1 -1
- package/dist/reference/sdk-api/ui/field/FieldGroup.md +1 -1
- package/dist/reference/sdk-api/ui/field/FieldLabel.md +13 -13
- package/dist/reference/sdk-api/ui/field/FieldLegend.md +1 -1
- package/dist/reference/sdk-api/ui/field/FieldSeparator.md +1 -1
- package/dist/reference/sdk-api/ui/field/FieldSet.md +1 -1
- package/dist/reference/sdk-api/ui/field/FieldTitle.md +1 -1
- package/dist/reference/sdk-api/ui/helpers/collectDataIconState.md +1 -1
- package/dist/reference/sdk-api/ui/input/Input.md +13 -13
- package/dist/reference/sdk-api/ui/input-group/InputGroup.md +1 -1
- package/dist/reference/sdk-api/ui/input-group/InputGroupAddon.md +1 -1
- package/dist/reference/sdk-api/ui/input-group/InputGroupButton.md +25 -25
- package/dist/reference/sdk-api/ui/input-group/InputGroupInput.md +13 -13
- package/dist/reference/sdk-api/ui/input-group/InputGroupText.md +1 -1
- package/dist/reference/sdk-api/ui/input-group/InputGroupTextarea.md +13 -13
- package/dist/reference/sdk-api/ui/input-otp/InputOTP.md +1 -1
- package/dist/reference/sdk-api/ui/input-otp/InputOTPGroup.md +1 -1
- package/dist/reference/sdk-api/ui/input-otp/InputOTPSeparator.md +1 -1
- package/dist/reference/sdk-api/ui/input-otp/InputOTPSlot.md +1 -1
- package/dist/reference/sdk-api/ui/item/Item.md +1 -1
- package/dist/reference/sdk-api/ui/item/ItemActions.md +1 -1
- package/dist/reference/sdk-api/ui/item/ItemContent.md +1 -1
- package/dist/reference/sdk-api/ui/item/ItemDescription.md +1 -1
- package/dist/reference/sdk-api/ui/item/ItemFooter.md +1 -1
- package/dist/reference/sdk-api/ui/item/ItemGroup.md +1 -1
- package/dist/reference/sdk-api/ui/item/ItemHeader.md +1 -1
- package/dist/reference/sdk-api/ui/item/ItemMedia.md +2 -2
- package/dist/reference/sdk-api/ui/item/ItemSeparator.md +1 -1
- package/dist/reference/sdk-api/ui/item/ItemTitle.md +1 -1
- package/dist/reference/sdk-api/ui/label/Label.md +13 -13
- package/dist/reference/sdk-api/ui/menubar/Menubar.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarCheckboxItem.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarContent.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarGroup.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarItem.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarLabel.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarMenu.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarPortal.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarRadioGroup.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarRadioItem.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarSeparator.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarShortcut.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarSub.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarSubContent.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarSubTrigger.md +1 -1
- package/dist/reference/sdk-api/ui/menubar/MenubarTrigger.md +1 -1
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenu.md +1 -1
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuContent.md +1 -1
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuIndicator.md +1 -1
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuItem.md +1 -1
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuLink.md +1 -1
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuList.md +1 -1
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuPositioner.md +1 -1
- package/dist/reference/sdk-api/ui/navigation-menu/NavigationMenuTrigger.md +22 -22
- package/dist/reference/sdk-api/ui/navigation-menu/navigationMenuTriggerStyle.md +1 -1
- package/dist/reference/sdk-api/ui/pagination/Pagination.md +1 -1
- package/dist/reference/sdk-api/ui/pagination/PaginationContent.md +1 -1
- package/dist/reference/sdk-api/ui/pagination/PaginationEllipsis.md +1 -1
- package/dist/reference/sdk-api/ui/pagination/PaginationItem.md +1 -1
- package/dist/reference/sdk-api/ui/pagination/PaginationLink.md +1 -1
- package/dist/reference/sdk-api/ui/pagination/PaginationNext.md +1 -1
- package/dist/reference/sdk-api/ui/pagination/PaginationPrevious.md +1 -1
- package/dist/reference/sdk-api/ui/popover/Popover.md +1 -1
- package/dist/reference/sdk-api/ui/popover/PopoverAnchor.md +1 -1
- package/dist/reference/sdk-api/ui/popover/PopoverContent.md +1 -1
- package/dist/reference/sdk-api/ui/popover/PopoverDescription.md +1 -1
- package/dist/reference/sdk-api/ui/popover/PopoverHeader.md +1 -1
- package/dist/reference/sdk-api/ui/popover/PopoverTitle.md +1 -1
- package/dist/reference/sdk-api/ui/popover/PopoverTrigger.md +22 -22
- package/dist/reference/sdk-api/ui/portal/Portal.md +1 -1
- package/dist/reference/sdk-api/ui/progress/Progress.md +1 -1
- package/dist/reference/sdk-api/ui/progress/ProgressIndicator.md +1 -1
- package/dist/reference/sdk-api/ui/progress/ProgressLabel.md +1 -1
- package/dist/reference/sdk-api/ui/progress/ProgressTrack.md +1 -1
- package/dist/reference/sdk-api/ui/progress/ProgressValue.md +22 -22
- package/dist/reference/sdk-api/ui/radio-group/RadioGroup.md +1 -1
- package/dist/reference/sdk-api/ui/radio-group/RadioGroupItem.md +1 -1
- package/dist/reference/sdk-api/ui/resizable/ResizableHandle.md +1 -1
- package/dist/reference/sdk-api/ui/resizable/ResizablePanel.md +1 -1
- package/dist/reference/sdk-api/ui/resizable/ResizablePanelGroup.md +1 -1
- package/dist/reference/sdk-api/ui/scroll-area/ScrollArea.md +13 -13
- package/dist/reference/sdk-api/ui/scroll-area/ScrollBar.md +1 -1
- package/dist/reference/sdk-api/ui/select/Select.md +1 -1
- package/dist/reference/sdk-api/ui/select/SelectContent.md +1 -1
- package/dist/reference/sdk-api/ui/select/SelectGroup.md +1 -1
- package/dist/reference/sdk-api/ui/select/SelectItem.md +1 -1
- package/dist/reference/sdk-api/ui/select/SelectLabel.md +1 -1
- package/dist/reference/sdk-api/ui/select/SelectScrollDownButton.md +1 -1
- package/dist/reference/sdk-api/ui/select/SelectScrollUpButton.md +1 -1
- package/dist/reference/sdk-api/ui/select/SelectSeparator.md +1 -1
- package/dist/reference/sdk-api/ui/select/SelectTrigger.md +1 -1
- package/dist/reference/sdk-api/ui/select/SelectValue.md +1 -1
- package/dist/reference/sdk-api/ui/separator/Separator.md +1 -1
- package/dist/reference/sdk-api/ui/sheet/Sheet.md +1 -1
- package/dist/reference/sdk-api/ui/sheet/SheetClose.md +1 -1
- package/dist/reference/sdk-api/ui/sheet/SheetContent.md +1 -1
- package/dist/reference/sdk-api/ui/sheet/SheetDescription.md +1 -1
- package/dist/reference/sdk-api/ui/sheet/SheetFooter.md +1 -1
- package/dist/reference/sdk-api/ui/sheet/SheetHeader.md +1 -1
- package/dist/reference/sdk-api/ui/sheet/SheetOverlay.md +1 -1
- package/dist/reference/sdk-api/ui/sheet/SheetPortal.md +1 -1
- package/dist/reference/sdk-api/ui/sheet/SheetTitle.md +1 -1
- package/dist/reference/sdk-api/ui/sheet/SheetTrigger.md +1 -1
- package/dist/reference/sdk-api/ui/skeleton/Skeleton.md +1 -1
- package/dist/reference/sdk-api/ui/slider/Slider.md +1 -1
- package/dist/reference/sdk-api/ui/sonner/Toaster.md +1 -1
- package/dist/reference/sdk-api/ui/sonner/toast.md +1 -1
- package/dist/reference/sdk-api/ui/spinner/Spinner.md +1 -1
- package/dist/reference/sdk-api/ui/switch/Switch.md +1 -1
- package/dist/reference/sdk-api/ui/table/Table.md +1 -1
- package/dist/reference/sdk-api/ui/table/TableBody.md +1 -1
- package/dist/reference/sdk-api/ui/table/TableCaption.md +1 -1
- package/dist/reference/sdk-api/ui/table/TableCell.md +1 -1
- package/dist/reference/sdk-api/ui/table/TableFooter.md +1 -1
- package/dist/reference/sdk-api/ui/table/TableHead.md +1 -1
- package/dist/reference/sdk-api/ui/table/TableHeader.md +1 -1
- package/dist/reference/sdk-api/ui/table/TableRow.md +1 -1
- package/dist/reference/sdk-api/ui/tabs/Tabs.md +1 -1
- package/dist/reference/sdk-api/ui/tabs/TabsContent.md +1 -1
- package/dist/reference/sdk-api/ui/tabs/TabsList.md +1 -1
- package/dist/reference/sdk-api/ui/tabs/TabsTrigger.md +1 -1
- package/dist/reference/sdk-api/ui/tabs/tabsListVariants.md +1 -1
- package/dist/reference/sdk-api/ui/textarea/Textarea.md +13 -13
- package/dist/reference/sdk-api/ui/toggle/Toggle.md +1 -1
- package/dist/reference/sdk-api/ui/toggle/toggleVariants.md +1 -1
- package/dist/reference/sdk-api/ui/toggle-group/ToggleGroup.md +1 -1
- package/dist/reference/sdk-api/ui/toggle-group/ToggleGroupItem.md +1 -1
- package/dist/reference/sdk-api.json +2811 -2295
- package/dist/reference/sdk-api.md +12 -1
- package/dist/runtime/client.js +0 -5
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/douyin-container-request.js +0 -7
- package/dist/runtime/douyin-container-request.js.map +1 -1
- package/dist/runtime/network-url.js +0 -3
- package/dist/runtime/network-url.js.map +1 -1
- package/dist/ui/menubar.js +0 -1
- package/dist/ui/menubar.js.map +1 -1
- package/package.json +2 -2
- package/release-provenance.json +5 -5
- package/src/adapters/interest-card/eslint/eslint-plugin-custom-navigation.mjs +2 -290
- package/src/adapters/interest-card/eslint/taro.mjs +8 -42
- package/src/build/plugins/inject-feed-card-meta.ts +172 -0
- package/src/build/taro.ts +1 -0
- package/src/components/miniapp-open-card.ts +46 -1
- package/src/eslint/eslint-plugin-custom-navigation.mjs +301 -0
- package/src/eslint/eslint-plugin-network-json-body.mjs +103 -0
- package/src/eslint/taro.mjs +38 -1
- package/src/runtime/client.ts +0 -6
- package/src/runtime/douyin-container-request.ts +0 -7
- package/src/runtime/network-url.ts +0 -3
- package/src/ui/menubar.tsx +0 -1
|
@@ -4,7 +4,20 @@ import { MiniappOpenCard as NativeMiniappOpenCard } from '#miniapp-open-card-nat
|
|
|
4
4
|
* @desc 承载同一 OpenCard;SDK 选择环境版本并为空初始化参数提供对象,错误类型直接报错。
|
|
5
5
|
* @params {MiniappOpenCardProps} props 卡片标识、页面路径和生命周期回调。
|
|
6
6
|
* @return {React.ReactElement} 注入环境版本与初始化对象的原生卡片组件。
|
|
7
|
-
* @
|
|
7
|
+
* @remarks development 使用 latest,preview 使用 preview,production、未知或无法读取的环境使用 current;业务不传 envVersion。
|
|
8
|
+
* initData 省略时 SDK 传入空对象,传 null、数组、字符串或其他非普通对象会抛出 TypeError;业务示例显式传 {}。
|
|
9
|
+
* 宿主只承载卡片。封闭域请求、数据处理与结果 UI 留在卡内,不通过 initData 或事件把私域结果交给宿主。
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { MiniappOpenCard } from '@open-dy/vibecoding-sdk-taro/components/miniapp-open-card'
|
|
13
|
+
* export function EmbeddedCard({ openCardId }: { openCardId: string }) {
|
|
14
|
+
* return <MiniappOpenCard appId={openCardId} path="pages/index/index" initData={{}} onError={(event) => console.error(event.detail.errMsg)} />
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
* @ai-intent 在普通 Taro 宿主中渲染已确认的 OpenCard 页面。
|
|
18
|
+
* @ai-when 用户要求内嵌卡,或宿主需要通过同一封闭域卡片呈现其结果时。
|
|
19
|
+
* @ai-avoid 不要手写原生标签、传 envVersion 或把卡内私域结果转移到宿主。
|
|
20
|
+
* @ai-example createElement(MiniappOpenCard, { appId: OPEN_CARD_ID, path: 'pages/index/index', initData: {} })
|
|
8
21
|
*/
|
|
9
22
|
export function MiniappOpenCard(props) {
|
|
10
23
|
const initData = props.initData === undefined ? {} : props.initData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"miniapp-open-card.js","sourceRoot":"","sources":["../../src/components/miniapp-open-card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"miniapp-open-card.js","sourceRoot":"","sources":["../../src/components/miniapp-open-card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAyDpF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAA;IACnE,IAAI,QAAQ,KAAK,IAAI,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;WAC3E,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,iBAAiB,EAAE,CAAC;QACpE,MAAM,IAAI,SAAS,CAAC,mEAAmE,CAAC,CAAA;IAC1F,CAAC;IACD,IAAI,UAAU,GAA8B,SAAS,CAAA;IACrD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,OAAO,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAA;QAC1D,MAAM,OAAO,GAAG,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAA;QAC9D,IAAI,OAAO,KAAK,aAAa;YAAE,UAAU,GAAG,QAAQ,CAAA;aAC/C,IAAI,OAAO,KAAK,SAAS;YAAE,UAAU,GAAG,SAAS,CAAA;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,oDAAoD;IACtD,CAAC;IACD,OAAO,aAAa,CAAC,qBAAqB,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAA;AACjF,CAAC"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 强制小程序页面使用自定义导航栏:app config 必须声明 navigationStyle: 'custom',
|
|
3
|
+
* page config 若声明 navigationStyle 也只能是 custom,每个页面必须显式声明导航前景色,
|
|
4
|
+
* 且每个页面入口必须接入顶部避让。
|
|
5
|
+
*/
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
|
|
8
|
+
const ts = createRequire(import.meta.url)('typescript');
|
|
9
|
+
|
|
10
|
+
const CUSTOM = 'custom';
|
|
11
|
+
const NAVIGATION_TEXT_STYLES = new Set(['black', 'white']);
|
|
12
|
+
|
|
13
|
+
const CUSTOM_NAV_IMPORTS = new Set([
|
|
14
|
+
'@/components/custom-nav-space',
|
|
15
|
+
'@/hooks/use-custom-nav-layout',
|
|
16
|
+
'@/lib/custom-nav-layout',
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
const FORBIDDEN_NAVIGATION_APIS = new Map([
|
|
20
|
+
['setNavigationBarTitle', '禁止修改导航栏标题'],
|
|
21
|
+
['setNavigationBarColor', '禁止修改导航栏颜色、前景色或状态栏样式'],
|
|
22
|
+
['showNavigationBarLoading', '禁止显示导航栏 loading'],
|
|
23
|
+
['hideNavigationBarLoading', '禁止隐藏导航栏 loading'],
|
|
24
|
+
['hideHomeButton', '禁止隐藏左上角首页或 logo 按钮'],
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
function getPropertyName(prop) {
|
|
28
|
+
if (!ts.isPropertyAssignment(prop)) return null;
|
|
29
|
+
if (ts.isIdentifier(prop.name)) return prop.name.text;
|
|
30
|
+
if (ts.isStringLiteral(prop.name)) return prop.name.text;
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getStringLiteral(node) {
|
|
35
|
+
if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) {
|
|
36
|
+
return node.text;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function getStaticPropertyName(node) {
|
|
42
|
+
if (!node.computed && node.property.type === 'Identifier') {
|
|
43
|
+
return node.property.name;
|
|
44
|
+
}
|
|
45
|
+
if (
|
|
46
|
+
node.computed &&
|
|
47
|
+
node.property.type === 'Literal' &&
|
|
48
|
+
typeof node.property.value === 'string'
|
|
49
|
+
) {
|
|
50
|
+
return node.property.value;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function getPropertyKeyName(node) {
|
|
56
|
+
if (!node.computed && node.key.type === 'Identifier') {
|
|
57
|
+
return node.key.name;
|
|
58
|
+
}
|
|
59
|
+
if (node.key.type === 'Literal' && typeof node.key.value === 'string') {
|
|
60
|
+
return node.key.value;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @returns {{ windowStyle: string | null, pageStyle: string | null, windowTextStyle: string | null, pageTextStyle: string | null, invalid: Array<{ kind: string, value: string | null }> } | null}
|
|
67
|
+
*/
|
|
68
|
+
function extractNavigationStyles(filePath, text) {
|
|
69
|
+
const sf = ts.createSourceFile(filePath, text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
70
|
+
let result = null;
|
|
71
|
+
|
|
72
|
+
function fromObjectLiteral(obj) {
|
|
73
|
+
const out = {
|
|
74
|
+
windowStyle: null,
|
|
75
|
+
pageStyle: null,
|
|
76
|
+
windowTextStyle: null,
|
|
77
|
+
pageTextStyle: null,
|
|
78
|
+
invalid: [],
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
for (const prop of obj.properties) {
|
|
82
|
+
if (!ts.isPropertyAssignment(prop)) continue;
|
|
83
|
+
const key = getPropertyName(prop);
|
|
84
|
+
|
|
85
|
+
if (key === 'navigationStyle') {
|
|
86
|
+
const value = getStringLiteral(prop.initializer);
|
|
87
|
+
out.pageStyle = value;
|
|
88
|
+
if (value !== CUSTOM) {
|
|
89
|
+
out.invalid.push({ kind: 'page', value });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (key === 'navigationBarTextStyle') {
|
|
94
|
+
out.pageTextStyle = getStringLiteral(prop.initializer);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (key === 'window' && ts.isObjectLiteralExpression(prop.initializer)) {
|
|
98
|
+
for (const windowProp of prop.initializer.properties) {
|
|
99
|
+
if (!ts.isPropertyAssignment(windowProp)) continue;
|
|
100
|
+
const windowKey = getPropertyName(windowProp);
|
|
101
|
+
if (windowKey === 'navigationStyle') {
|
|
102
|
+
const value = getStringLiteral(windowProp.initializer);
|
|
103
|
+
out.windowStyle = value;
|
|
104
|
+
if (value !== CUSTOM) {
|
|
105
|
+
out.invalid.push({ kind: 'window', value });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (windowKey === 'navigationBarTextStyle') {
|
|
109
|
+
out.windowTextStyle = getStringLiteral(windowProp.initializer);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return out;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function visit(node) {
|
|
119
|
+
if (result) return;
|
|
120
|
+
if (ts.isExportAssignment(node) && !node.isExportEquals && node.expression) {
|
|
121
|
+
const expr = node.expression;
|
|
122
|
+
if (
|
|
123
|
+
ts.isCallExpression(expr) &&
|
|
124
|
+
expr.arguments[0] &&
|
|
125
|
+
ts.isObjectLiteralExpression(expr.arguments[0])
|
|
126
|
+
) {
|
|
127
|
+
result = fromObjectLiteral(expr.arguments[0]);
|
|
128
|
+
} else if (ts.isObjectLiteralExpression(expr)) {
|
|
129
|
+
result = fromObjectLiteral(expr);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
ts.forEachChild(node, visit);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
visit(sf);
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const CONFIG_MESSAGE =
|
|
140
|
+
'小程序页面必须使用自定义导航栏:navigationStyle 只能是 "custom",禁止改成 default 或其他值。' +
|
|
141
|
+
'页面顶部请用 <CustomNavSpace /> 或 useCustomNavLayout() 避让状态栏与胶囊。';
|
|
142
|
+
|
|
143
|
+
const TEXT_STYLE_MESSAGE =
|
|
144
|
+
'请根据该页面首次进入时顶部区域的实际明暗,显式设置 navigationBarTextStyle:' +
|
|
145
|
+
'浅色顶部使用 "black",深色顶部使用 "white"。';
|
|
146
|
+
|
|
147
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
148
|
+
const requireCustomNavigationStyle = {
|
|
149
|
+
meta: {
|
|
150
|
+
type: 'problem',
|
|
151
|
+
docs: {
|
|
152
|
+
description: '强制自定义导航,并要求 app fallback 与每个页面显式声明导航前景色',
|
|
153
|
+
},
|
|
154
|
+
schema: [],
|
|
155
|
+
},
|
|
156
|
+
create(context) {
|
|
157
|
+
const filePath = context.filename.replace(/\\/g, '/');
|
|
158
|
+
const isApp = filePath.endsWith('/src/app.config.ts') || filePath.endsWith('src/app.config.ts');
|
|
159
|
+
const isPageConfig = /\/src\/pages\/.+\.config\.ts$/.test(filePath);
|
|
160
|
+
if (!isApp && !isPageConfig) return {};
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
Program(node) {
|
|
164
|
+
const sourceText = context.sourceCode.getText(node);
|
|
165
|
+
const parsed = extractNavigationStyles(filePath, sourceText);
|
|
166
|
+
|
|
167
|
+
if (!parsed) {
|
|
168
|
+
context.report({
|
|
169
|
+
node,
|
|
170
|
+
message: `无法解析 ${isApp ? 'defineAppConfig' : 'definePageConfig'},请使用对象字面量声明。${CONFIG_MESSAGE}`,
|
|
171
|
+
});
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (isApp && parsed.windowStyle !== CUSTOM) {
|
|
176
|
+
context.report({
|
|
177
|
+
node,
|
|
178
|
+
message:
|
|
179
|
+
`src/app.config.ts 的 window.navigationStyle 必须为 "custom"(当前:${parsed.windowStyle ?? '未设置'})。${CONFIG_MESSAGE}`,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const textStyle = isApp ? parsed.windowTextStyle : parsed.pageTextStyle;
|
|
184
|
+
if (!NAVIGATION_TEXT_STYLES.has(textStyle)) {
|
|
185
|
+
context.report({
|
|
186
|
+
node,
|
|
187
|
+
message:
|
|
188
|
+
`${isApp ? 'src/app.config.ts 的 window' : '页面配置'}.navigationBarTextStyle ` +
|
|
189
|
+
`必须为 "black" 或 "white"(当前:${textStyle ?? '未设置'})。${TEXT_STYLE_MESSAGE}`,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
for (const item of parsed.invalid) {
|
|
194
|
+
if (isApp && item.kind === 'window') continue;
|
|
195
|
+
context.report({
|
|
196
|
+
node,
|
|
197
|
+
message:
|
|
198
|
+
`禁止将 ${item.kind === 'window' ? 'window.' : ''}navigationStyle 设为 ${JSON.stringify(item.value)}。${CONFIG_MESSAGE}`,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
207
|
+
const pagesMustUseCustomNavSpace = {
|
|
208
|
+
meta: {
|
|
209
|
+
type: 'problem',
|
|
210
|
+
docs: {
|
|
211
|
+
description: '页面入口必须使用 CustomNavSpace 或 useCustomNavLayout 避让自定义导航栏区域',
|
|
212
|
+
},
|
|
213
|
+
schema: [],
|
|
214
|
+
},
|
|
215
|
+
create(context) {
|
|
216
|
+
const filePath = context.filename.replace(/\\/g, '/');
|
|
217
|
+
if (!/\/src\/pages\/.+\/index\.[jt]sx$/.test(filePath)) return {};
|
|
218
|
+
|
|
219
|
+
let used = false;
|
|
220
|
+
const sarImports = new Set();
|
|
221
|
+
const renderedComponents = new Set();
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
ImportDeclaration(node) {
|
|
225
|
+
if (typeof node.source.value === 'string' && CUSTOM_NAV_IMPORTS.has(node.source.value)) {
|
|
226
|
+
used = true;
|
|
227
|
+
}
|
|
228
|
+
// SAR owns HUD safe spacing; adding host spacing would shrink the canvas.
|
|
229
|
+
if (typeof node.source.value === 'string' && /^(?:@\/|(?:\.\.\/)+)components\/(?:SarGame|sar-game)(?:\/index)?$/.test(node.source.value)) {
|
|
230
|
+
for (const specifier of node.specifiers) {
|
|
231
|
+
if (specifier.type === 'ImportDefaultSpecifier') sarImports.add(specifier.local.name);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
JSXOpeningElement(node) {
|
|
236
|
+
if (node.name.type === 'JSXIdentifier') renderedComponents.add(node.name.name);
|
|
237
|
+
},
|
|
238
|
+
'Program:exit'(node) {
|
|
239
|
+
if (used || [...sarImports].some(name => renderedComponents.has(name))) return;
|
|
240
|
+
context.report({
|
|
241
|
+
node,
|
|
242
|
+
message:
|
|
243
|
+
'小程序页面必须 import <CustomNavSpace /> 或 useCustomNavLayout() 做顶部避让,' +
|
|
244
|
+
'禁止改回原生导航,也禁止只用固定 pt-* / safe-area 代替。',
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
252
|
+
const noNavigationControlApis = {
|
|
253
|
+
meta: {
|
|
254
|
+
type: 'problem',
|
|
255
|
+
docs: {
|
|
256
|
+
description: '禁止小程序页面调用会修改宿主导航栏或左上角按钮的 API',
|
|
257
|
+
},
|
|
258
|
+
schema: [],
|
|
259
|
+
},
|
|
260
|
+
create(context) {
|
|
261
|
+
function report(node, apiName) {
|
|
262
|
+
const reason = FORBIDDEN_NAVIGATION_APIS.get(apiName);
|
|
263
|
+
if (!reason) return;
|
|
264
|
+
|
|
265
|
+
context.report({
|
|
266
|
+
node,
|
|
267
|
+
message:
|
|
268
|
+
`小程序页面禁止使用 ${apiName}:${reason}。` +
|
|
269
|
+
'导航栏和左上角按钮由宿主及自定义导航模板统一管理。',
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return {
|
|
274
|
+
MemberExpression(node) {
|
|
275
|
+
report(node.property, getStaticPropertyName(node));
|
|
276
|
+
},
|
|
277
|
+
ImportSpecifier(node) {
|
|
278
|
+
const importedName = node.imported.type === 'Identifier'
|
|
279
|
+
? node.imported.name
|
|
280
|
+
: node.imported.value;
|
|
281
|
+
report(node.imported, importedName);
|
|
282
|
+
},
|
|
283
|
+
Property(node) {
|
|
284
|
+
if (node.parent.type !== 'ObjectPattern') return;
|
|
285
|
+
report(node.key, getPropertyKeyName(node));
|
|
286
|
+
},
|
|
287
|
+
CallExpression(node) {
|
|
288
|
+
if (node.callee.type !== 'Identifier') return;
|
|
289
|
+
report(node.callee, node.callee.name);
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
export default {
|
|
296
|
+
rules: {
|
|
297
|
+
'require-custom-navigation-style': requireCustomNavigationStyle,
|
|
298
|
+
'pages-must-use-custom-nav-space': pagesMustUseCustomNavSpace,
|
|
299
|
+
'no-navigation-control-apis': noNavigationControlApis,
|
|
300
|
+
},
|
|
301
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Inspect only statically known options; dynamic request builders need runtime tests.
|
|
2
|
+
const unknown = Symbol('unknown');
|
|
3
|
+
|
|
4
|
+
function propertyName(node) {
|
|
5
|
+
if (!node.computed && node.key.type === 'Identifier') return node.key.name;
|
|
6
|
+
return node.key.type === 'Literal' ? node.key.value : unknown;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function property(object, name, ignoreCase = false) {
|
|
10
|
+
if (!object || object.type !== 'ObjectExpression') return unknown;
|
|
11
|
+
let result;
|
|
12
|
+
for (const item of object.properties) {
|
|
13
|
+
if (item.type !== 'Property') {
|
|
14
|
+
result = unknown;
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const key = propertyName(item);
|
|
18
|
+
if (key === unknown) {
|
|
19
|
+
result = unknown;
|
|
20
|
+
} else if (typeof key === 'string' && (ignoreCase ? key.toLowerCase() === name : key === name)) {
|
|
21
|
+
result = item.value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function literal(node) {
|
|
28
|
+
if (node?.type === 'Literal') return node.value;
|
|
29
|
+
if (node?.type === 'TemplateLiteral' && node.expressions.length === 0) {
|
|
30
|
+
return node.quasis[0].value.cooked;
|
|
31
|
+
}
|
|
32
|
+
return unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function variableFor(context, node) {
|
|
36
|
+
let scope = context.sourceCode.getScope(node);
|
|
37
|
+
while (scope) {
|
|
38
|
+
const variable = scope.set.get(node.name);
|
|
39
|
+
if (variable) return variable;
|
|
40
|
+
scope = scope.upper;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isNetworkImport(context, node) {
|
|
45
|
+
if (node?.type !== 'Identifier') return false;
|
|
46
|
+
return variableFor(context, node)?.defs.some(def =>
|
|
47
|
+
def.type === 'ImportBinding' &&
|
|
48
|
+
def.node.type === 'ImportSpecifier' &&
|
|
49
|
+
(def.node.imported.name ?? def.node.imported.value) === 'Network' &&
|
|
50
|
+
/(?:^|\/)network(?:\.ts)?$/.test(def.parent.source.value),
|
|
51
|
+
) ?? false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function isEmptyBody(context, node) {
|
|
55
|
+
if (node === undefined) return true;
|
|
56
|
+
if (node === unknown) return false;
|
|
57
|
+
if (node.type === 'UnaryExpression' && node.operator === 'void') return true;
|
|
58
|
+
if (node.type === 'Identifier' && node.name === 'undefined') {
|
|
59
|
+
return !variableFor(context, node)?.defs.length;
|
|
60
|
+
}
|
|
61
|
+
const value = literal(node);
|
|
62
|
+
return value === null || (typeof value === 'string' && value.trim() === '');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default {
|
|
66
|
+
rules: {
|
|
67
|
+
'require-delete-json-body': {
|
|
68
|
+
meta: {
|
|
69
|
+
type: 'problem',
|
|
70
|
+
schema: [],
|
|
71
|
+
docs: { description: 'Require a non-empty JSON body for Network.request DELETE calls.' },
|
|
72
|
+
messages: {
|
|
73
|
+
empty: 'Network.request 的 DELETE 请求使用默认或显式 JSON Content-Type 时,必须传非空 data;无业务参数请传 data: {}。否则真机可能触发 Fastify FST_ERR_CTP_EMPTY_JSON_BODY。',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
create(context) {
|
|
77
|
+
return {
|
|
78
|
+
CallExpression(node) {
|
|
79
|
+
const callee = node.callee;
|
|
80
|
+
if (callee.type !== 'MemberExpression' || !isNetworkImport(context, callee.object)) return;
|
|
81
|
+
const methodName = callee.computed ? literal(callee.property) : callee.property.name;
|
|
82
|
+
if (methodName !== 'request') return;
|
|
83
|
+
const options = node.arguments[0];
|
|
84
|
+
const method = literal(property(options, 'method'));
|
|
85
|
+
if (typeof method !== 'string' || method.toUpperCase() !== 'DELETE') return;
|
|
86
|
+
const header = property(options, 'header');
|
|
87
|
+
if (header !== undefined) {
|
|
88
|
+
const contentType = property(header, 'content-type', true);
|
|
89
|
+
if (contentType === unknown) return;
|
|
90
|
+
if (contentType !== undefined) {
|
|
91
|
+
const value = literal(contentType);
|
|
92
|
+
if (typeof value !== 'string' || !/^application\/json(?:\s*;|\s*$)/i.test(value.trim())) return;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (isEmptyBody(context, property(options, 'data'))) {
|
|
96
|
+
context.report({ node: options, messageId: 'empty' });
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
package/dist/eslint/taro.mjs
CHANGED
|
@@ -6,6 +6,8 @@ import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
|
6
6
|
import importPlugin from 'eslint-plugin-import';
|
|
7
7
|
import globals from 'globals';
|
|
8
8
|
import microappPages from './eslint-plugin-microapp-pages.mjs';
|
|
9
|
+
import customNavigation from './eslint-plugin-custom-navigation.mjs';
|
|
10
|
+
import networkJsonBody from './eslint-plugin-network-json-body.mjs';
|
|
9
11
|
|
|
10
12
|
const REMOTE_CSS_IMPORT_PATTERN =
|
|
11
13
|
/@import\s+(?:url\(\s*['"]?((?:https?:)?\/\/[^'")\s]+)['"]?\s*\)|['"]((?:https?:)?\/\/[^'"\s]+)['"])/g;
|
|
@@ -69,7 +71,7 @@ function createLucideColorCheckPlugin(importSources = ['@open-dy/lucide-taro'])
|
|
|
69
71
|
const cssImportGuardPlugin = {
|
|
70
72
|
processors: {
|
|
71
73
|
css: {
|
|
72
|
-
preprocess(text) {
|
|
74
|
+
preprocess(text, filename) {
|
|
73
75
|
const lines = text.replace(/\/\*[\s\S]*?\*\//g, comment => {
|
|
74
76
|
if (comment.includes('eslint-')) return comment;
|
|
75
77
|
return comment.replace(/[^\n]/g, ' ');
|
|
@@ -101,6 +103,18 @@ const cssImportGuardPlugin = {
|
|
|
101
103
|
].join(' ');
|
|
102
104
|
});
|
|
103
105
|
|
|
106
|
+
// Scope this guard to the SDK-based host app; OpenCard has its own CSS pipeline.
|
|
107
|
+
if (filename.replaceAll('\\', '/').endsWith('/src/app.css')) {
|
|
108
|
+
const css = lines.join('\n');
|
|
109
|
+
const imports = [...css.matchAll(/@import\s+(?:url\(\s*)?['"]([^'"]+)['"]/g)]
|
|
110
|
+
.map(match => match[1]);
|
|
111
|
+
const usesSdkTheme = imports.some(value => /^@[^/]+\/vibecoding-sdk-taro\/ui\/tailwind\.css$/.test(value));
|
|
112
|
+
const hasUtilities = imports.some(value => ['weapp-tailwindcss', 'tailwindcss', 'tailwindcss/utilities.css', 'weapp-tailwindcss/utilities.css'].includes(value))
|
|
113
|
+
|| /@tailwind\s+utilities\s*;/.test(css);
|
|
114
|
+
if (usesSdkTheme && !hasUtilities) {
|
|
115
|
+
virtualLines[0] = `${virtualLines[0] ?? ''} __cssMissingTailwindEntry();`;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
104
118
|
return [virtualLines.join('\n')];
|
|
105
119
|
},
|
|
106
120
|
postprocess(messages) {
|
|
@@ -249,6 +263,16 @@ function collectStaticStrings(node, result = []) {
|
|
|
249
263
|
|
|
250
264
|
const tailwindEnforcementPlugin = {
|
|
251
265
|
rules: {
|
|
266
|
+
'require-utilities-entry': {
|
|
267
|
+
create(context) {
|
|
268
|
+
return {
|
|
269
|
+
CallExpression(node) {
|
|
270
|
+
if (node.callee?.name !== '__cssMissingTailwindEntry') return;
|
|
271
|
+
context.report({ node, message: 'src/app.css 缺少 Tailwind 工具类入口。请保留模板的 @import "weapp-tailwindcss";;SDK ui/tailwind.css 只提供主题和组件扫描,不能替代此入口。' });
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
},
|
|
275
|
+
},
|
|
252
276
|
'no-arbitrary-font-size': {
|
|
253
277
|
create(context) {
|
|
254
278
|
function reportArbitraryFontSize(node, className) {
|
|
@@ -440,15 +464,27 @@ export function createMicroappTaroEslintConfig(options = {}) {
|
|
|
440
464
|
'tailwindcss/no-custom-classname': 'off',
|
|
441
465
|
},
|
|
442
466
|
},
|
|
467
|
+
{
|
|
468
|
+
files: ['src/**/*.{js,jsx,ts,tsx}'],
|
|
469
|
+
plugins: { customNavigation },
|
|
470
|
+
rules: {
|
|
471
|
+
'customNavigation/no-navigation-control-apis': 'error',
|
|
472
|
+
},
|
|
473
|
+
},
|
|
443
474
|
{
|
|
444
475
|
files: ['src/**/*.{js,jsx,ts,tsx}'],
|
|
445
476
|
ignores: ['src/network.ts'],
|
|
446
477
|
plugins: {
|
|
478
|
+
networkJsonBody,
|
|
447
479
|
lucide: lucideColorCheckPlugin,
|
|
448
480
|
microappPages,
|
|
481
|
+
customNavigation,
|
|
449
482
|
tailwind: tailwindEnforcementPlugin,
|
|
450
483
|
},
|
|
451
484
|
rules: {
|
|
485
|
+
'customNavigation/require-custom-navigation-style': 'error',
|
|
486
|
+
'customNavigation/pages-must-use-custom-nav-space': 'error',
|
|
487
|
+
'networkJsonBody/require-delete-json-body': 'error',
|
|
452
488
|
'microappPages/nav-url-in-app-pages': 'error',
|
|
453
489
|
// 'microappPages/page-dirs-in-app-pages': 'error',
|
|
454
490
|
'microappPages/declared-pages-must-exist': 'error',
|
|
@@ -508,6 +544,7 @@ export function createMicroappTaroEslintConfig(options = {}) {
|
|
|
508
544
|
},
|
|
509
545
|
processor: 'local/css',
|
|
510
546
|
rules: {
|
|
547
|
+
'tailwind/require-utilities-entry': 'error',
|
|
511
548
|
'no-undef': 'off',
|
|
512
549
|
'tailwind/no-arbitrary-font-size': 'error',
|
|
513
550
|
'no-restricted-syntax': ['error', ...baseRestrictedSyntaxRules],
|