@maizzle/framework 6.0.0-8 → 6.0.0-rc.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.
Files changed (614) hide show
  1. package/bin/maizzle.mjs +10 -0
  2. package/dist/build.d.mts +19 -0
  3. package/dist/build.d.mts.map +1 -0
  4. package/dist/build.mjs +121 -0
  5. package/dist/build.mjs.map +1 -0
  6. package/dist/components/Button.vue +141 -0
  7. package/dist/components/Divider.vue +105 -0
  8. package/dist/components/NoWidows.vue +123 -0
  9. package/dist/components/NotOutlook.vue +17 -0
  10. package/dist/components/Outlook.vue +74 -0
  11. package/dist/components/Spacer.vue +36 -0
  12. package/dist/components/Vml.vue +89 -0
  13. package/dist/components/WithUrl.vue +190 -0
  14. package/dist/components/utils.d.mts +5 -0
  15. package/dist/components/utils.d.mts.map +1 -0
  16. package/dist/components/utils.mjs +9 -0
  17. package/dist/components/utils.mjs.map +1 -0
  18. package/dist/components/utils.ts +6 -0
  19. package/dist/composables/defineConfig.d.mts +14 -0
  20. package/dist/composables/defineConfig.d.mts.map +1 -0
  21. package/dist/composables/defineConfig.mjs +34 -0
  22. package/dist/composables/defineConfig.mjs.map +1 -0
  23. package/dist/composables/renderContext.d.mts +19 -0
  24. package/dist/composables/renderContext.d.mts.map +1 -0
  25. package/dist/composables/renderContext.mjs +6 -0
  26. package/dist/composables/renderContext.mjs.map +1 -0
  27. package/dist/composables/useConfig.d.mts +9 -0
  28. package/dist/composables/useConfig.d.mts.map +1 -0
  29. package/dist/composables/useConfig.mjs +13 -0
  30. package/dist/composables/useConfig.mjs.map +1 -0
  31. package/dist/composables/useDoctype.d.mts +13 -0
  32. package/dist/composables/useDoctype.d.mts.map +1 -0
  33. package/dist/composables/useDoctype.mjs +20 -0
  34. package/dist/composables/useDoctype.mjs.map +1 -0
  35. package/dist/composables/useEvent.d.mts +17 -0
  36. package/dist/composables/useEvent.d.mts.map +1 -0
  37. package/dist/composables/useEvent.mjs +25 -0
  38. package/dist/composables/useEvent.mjs.map +1 -0
  39. package/dist/composables/usePlaintext.d.mts +19 -0
  40. package/dist/composables/usePlaintext.d.mts.map +1 -0
  41. package/dist/composables/usePlaintext.mjs +22 -0
  42. package/dist/composables/usePlaintext.mjs.map +1 -0
  43. package/dist/config/defaults.d.mts +6 -0
  44. package/dist/config/defaults.d.mts.map +1 -0
  45. package/dist/config/defaults.mjs +28 -0
  46. package/dist/config/defaults.mjs.map +1 -0
  47. package/dist/config/index.d.mts +15 -0
  48. package/dist/config/index.d.mts.map +1 -0
  49. package/dist/config/index.mjs +47 -0
  50. package/dist/config/index.mjs.map +1 -0
  51. package/dist/events/index.d.mts +91 -0
  52. package/dist/events/index.d.mts.map +1 -0
  53. package/dist/events/index.mjs +110 -0
  54. package/dist/events/index.mjs.map +1 -0
  55. package/dist/index.d.mts +29 -0
  56. package/dist/index.mjs +29 -0
  57. package/dist/plaintext.d.mts +5 -0
  58. package/dist/plaintext.d.mts.map +1 -0
  59. package/dist/plaintext.mjs +15 -0
  60. package/dist/plaintext.mjs.map +1 -0
  61. package/dist/plugin.d.mts +17 -0
  62. package/dist/plugin.d.mts.map +1 -0
  63. package/dist/plugin.mjs +41 -0
  64. package/dist/plugin.mjs.map +1 -0
  65. package/dist/plugins/postcss/mergeMediaQueries.d.mts +18 -0
  66. package/dist/plugins/postcss/mergeMediaQueries.d.mts.map +1 -0
  67. package/dist/plugins/postcss/mergeMediaQueries.mjs +22 -0
  68. package/dist/plugins/postcss/mergeMediaQueries.mjs.map +1 -0
  69. package/dist/plugins/postcss/pruneVars.d.mts +8 -0
  70. package/dist/plugins/postcss/pruneVars.d.mts.map +1 -0
  71. package/dist/plugins/postcss/pruneVars.mjs +49 -0
  72. package/dist/plugins/postcss/pruneVars.mjs.map +1 -0
  73. package/dist/plugins/postcss/removeDeclarations.d.mts +12 -0
  74. package/dist/plugins/postcss/removeDeclarations.d.mts.map +1 -0
  75. package/dist/plugins/postcss/removeDeclarations.mjs +45 -0
  76. package/dist/plugins/postcss/removeDeclarations.mjs.map +1 -0
  77. package/dist/plugins/postcss/tailwindCleanup.d.mts +18 -0
  78. package/dist/plugins/postcss/tailwindCleanup.d.mts.map +1 -0
  79. package/dist/plugins/postcss/tailwindCleanup.mjs +35 -0
  80. package/dist/plugins/postcss/tailwindCleanup.mjs.map +1 -0
  81. package/dist/render/createRenderer.d.mts +34 -0
  82. package/dist/render/createRenderer.d.mts.map +1 -0
  83. package/dist/render/createRenderer.mjs +149 -0
  84. package/dist/render/createRenderer.mjs.map +1 -0
  85. package/dist/render/index.d.mts +26 -0
  86. package/dist/render/index.d.mts.map +1 -0
  87. package/dist/render/index.mjs +40 -0
  88. package/dist/render/index.mjs.map +1 -0
  89. package/dist/serve.d.mts +25 -0
  90. package/dist/serve.d.mts.map +1 -0
  91. package/dist/serve.mjs +402 -0
  92. package/dist/serve.mjs.map +1 -0
  93. package/dist/server/compatibility.d.mts +6 -0
  94. package/dist/server/compatibility.d.mts.map +1 -0
  95. package/dist/server/compatibility.mjs +83 -0
  96. package/dist/server/compatibility.mjs.map +1 -0
  97. package/dist/server/linter.d.mts +6 -0
  98. package/dist/server/linter.d.mts.map +1 -0
  99. package/dist/server/linter.mjs +200 -0
  100. package/dist/server/linter.mjs.map +1 -0
  101. package/dist/server/ui/App.vue +360 -0
  102. package/dist/server/ui/components/ui/button/Button.vue +31 -0
  103. package/dist/server/ui/components/ui/button/index.ts +38 -0
  104. package/dist/server/ui/components/ui/command/Command.vue +87 -0
  105. package/dist/server/ui/components/ui/command/CommandDialog.vue +31 -0
  106. package/dist/server/ui/components/ui/command/CommandEmpty.vue +27 -0
  107. package/dist/server/ui/components/ui/command/CommandGroup.vue +45 -0
  108. package/dist/server/ui/components/ui/command/CommandInput.vue +39 -0
  109. package/dist/server/ui/components/ui/command/CommandItem.vue +76 -0
  110. package/dist/server/ui/components/ui/command/CommandList.vue +25 -0
  111. package/dist/server/ui/components/ui/command/CommandSeparator.vue +21 -0
  112. package/dist/server/ui/components/ui/command/CommandShortcut.vue +17 -0
  113. package/dist/server/ui/components/ui/command/index.ts +25 -0
  114. package/dist/server/ui/components/ui/dialog/Dialog.vue +19 -0
  115. package/dist/server/ui/components/ui/dialog/DialogClose.vue +15 -0
  116. package/dist/server/ui/components/ui/dialog/DialogContent.vue +53 -0
  117. package/dist/server/ui/components/ui/dialog/DialogDescription.vue +23 -0
  118. package/dist/server/ui/components/ui/dialog/DialogFooter.vue +27 -0
  119. package/dist/server/ui/components/ui/dialog/DialogHeader.vue +17 -0
  120. package/dist/server/ui/components/ui/dialog/DialogOverlay.vue +21 -0
  121. package/dist/server/ui/components/ui/dialog/DialogScrollContent.vue +59 -0
  122. package/dist/server/ui/components/ui/dialog/DialogTitle.vue +23 -0
  123. package/dist/server/ui/components/ui/dialog/DialogTrigger.vue +15 -0
  124. package/dist/server/ui/components/ui/dialog/index.ts +10 -0
  125. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenu.vue +19 -0
  126. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +39 -0
  127. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuContent.vue +39 -0
  128. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuGroup.vue +15 -0
  129. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuItem.vue +31 -0
  130. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuLabel.vue +23 -0
  131. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
  132. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +40 -0
  133. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSeparator.vue +23 -0
  134. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuShortcut.vue +17 -0
  135. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSub.vue +18 -0
  136. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSubContent.vue +27 -0
  137. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +31 -0
  138. package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
  139. package/dist/server/ui/components/ui/dropdown-menu/index.ts +16 -0
  140. package/dist/server/ui/components/ui/empty/Empty.vue +20 -0
  141. package/dist/server/ui/components/ui/empty/EmptyContent.vue +20 -0
  142. package/dist/server/ui/components/ui/empty/EmptyDescription.vue +20 -0
  143. package/dist/server/ui/components/ui/empty/EmptyHeader.vue +20 -0
  144. package/dist/server/ui/components/ui/empty/EmptyMedia.vue +21 -0
  145. package/dist/server/ui/components/ui/empty/EmptyTitle.vue +17 -0
  146. package/dist/server/ui/components/ui/empty/index.ts +26 -0
  147. package/dist/server/ui/components/ui/input/Input.vue +33 -0
  148. package/dist/server/ui/components/ui/input/index.ts +1 -0
  149. package/dist/server/ui/components/ui/kbd/Kbd.vue +20 -0
  150. package/dist/server/ui/components/ui/kbd/KbdGroup.vue +17 -0
  151. package/dist/server/ui/components/ui/kbd/index.ts +2 -0
  152. package/dist/server/ui/components/ui/resizable/ResizableHandle.vue +30 -0
  153. package/dist/server/ui/components/ui/resizable/ResizablePanel.vue +21 -0
  154. package/dist/server/ui/components/ui/resizable/ResizablePanelGroup.vue +25 -0
  155. package/dist/server/ui/components/ui/resizable/index.ts +3 -0
  156. package/dist/server/ui/components/ui/scroll-area/ScrollArea.vue +33 -0
  157. package/dist/server/ui/components/ui/scroll-area/ScrollBar.vue +32 -0
  158. package/dist/server/ui/components/ui/scroll-area/index.ts +2 -0
  159. package/dist/server/ui/components/ui/separator/Separator.vue +29 -0
  160. package/dist/server/ui/components/ui/separator/index.ts +1 -0
  161. package/dist/server/ui/components/ui/sheet/Sheet.vue +19 -0
  162. package/dist/server/ui/components/ui/sheet/SheetClose.vue +15 -0
  163. package/dist/server/ui/components/ui/sheet/SheetContent.vue +62 -0
  164. package/dist/server/ui/components/ui/sheet/SheetDescription.vue +21 -0
  165. package/dist/server/ui/components/ui/sheet/SheetFooter.vue +16 -0
  166. package/dist/server/ui/components/ui/sheet/SheetHeader.vue +15 -0
  167. package/dist/server/ui/components/ui/sheet/SheetOverlay.vue +21 -0
  168. package/dist/server/ui/components/ui/sheet/SheetTitle.vue +21 -0
  169. package/dist/server/ui/components/ui/sheet/SheetTrigger.vue +15 -0
  170. package/dist/server/ui/components/ui/sheet/index.ts +8 -0
  171. package/dist/server/ui/components/ui/sidebar/Sidebar.vue +96 -0
  172. package/dist/server/ui/components/ui/sidebar/SidebarContent.vue +18 -0
  173. package/dist/server/ui/components/ui/sidebar/SidebarFooter.vue +18 -0
  174. package/dist/server/ui/components/ui/sidebar/SidebarGroup.vue +18 -0
  175. package/dist/server/ui/components/ui/sidebar/SidebarGroupAction.vue +27 -0
  176. package/dist/server/ui/components/ui/sidebar/SidebarGroupContent.vue +18 -0
  177. package/dist/server/ui/components/ui/sidebar/SidebarGroupLabel.vue +25 -0
  178. package/dist/server/ui/components/ui/sidebar/SidebarHeader.vue +18 -0
  179. package/dist/server/ui/components/ui/sidebar/SidebarInput.vue +31 -0
  180. package/dist/server/ui/components/ui/sidebar/SidebarInset.vue +21 -0
  181. package/dist/server/ui/components/ui/sidebar/SidebarMenu.vue +18 -0
  182. package/dist/server/ui/components/ui/sidebar/SidebarMenuAction.vue +35 -0
  183. package/dist/server/ui/components/ui/sidebar/SidebarMenuBadge.vue +26 -0
  184. package/dist/server/ui/components/ui/sidebar/SidebarMenuButton.vue +48 -0
  185. package/dist/server/ui/components/ui/sidebar/SidebarMenuButtonChild.vue +36 -0
  186. package/dist/server/ui/components/ui/sidebar/SidebarMenuItem.vue +18 -0
  187. package/dist/server/ui/components/ui/sidebar/SidebarMenuSkeleton.vue +35 -0
  188. package/dist/server/ui/components/ui/sidebar/SidebarMenuSub.vue +22 -0
  189. package/dist/server/ui/components/ui/sidebar/SidebarMenuSubButton.vue +36 -0
  190. package/dist/server/ui/components/ui/sidebar/SidebarMenuSubItem.vue +18 -0
  191. package/dist/server/ui/components/ui/sidebar/SidebarProvider.vue +82 -0
  192. package/dist/server/ui/components/ui/sidebar/SidebarRail.vue +33 -0
  193. package/dist/server/ui/components/ui/sidebar/SidebarSeparator.vue +19 -0
  194. package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +28 -0
  195. package/dist/server/ui/components/ui/sidebar/index.ts +60 -0
  196. package/dist/server/ui/components/ui/sidebar/utils.ts +19 -0
  197. package/dist/server/ui/components/ui/skeleton/Skeleton.vue +17 -0
  198. package/dist/server/ui/components/ui/skeleton/index.ts +1 -0
  199. package/dist/server/ui/components/ui/tabs/Tabs.vue +24 -0
  200. package/dist/server/ui/components/ui/tabs/TabsContent.vue +21 -0
  201. package/dist/server/ui/components/ui/tabs/TabsList.vue +24 -0
  202. package/dist/server/ui/components/ui/tabs/TabsTrigger.vue +26 -0
  203. package/dist/server/ui/components/ui/tabs/index.ts +4 -0
  204. package/dist/server/ui/components/ui/toggle/Toggle.vue +35 -0
  205. package/dist/server/ui/components/ui/toggle/index.ts +28 -0
  206. package/dist/server/ui/components/ui/toggle-group/ToggleGroup.vue +49 -0
  207. package/dist/server/ui/components/ui/toggle-group/ToggleGroupItem.vue +46 -0
  208. package/dist/server/ui/components/ui/toggle-group/index.ts +2 -0
  209. package/dist/server/ui/components/ui/tooltip/Tooltip.vue +19 -0
  210. package/dist/server/ui/components/ui/tooltip/TooltipContent.vue +34 -0
  211. package/dist/server/ui/components/ui/tooltip/TooltipProvider.vue +14 -0
  212. package/dist/server/ui/components/ui/tooltip/TooltipTrigger.vue +15 -0
  213. package/dist/server/ui/components/ui/tooltip/index.ts +4 -0
  214. package/dist/server/ui/favicon.svg +1 -0
  215. package/dist/server/ui/index.html +13 -0
  216. package/dist/server/ui/lib/utils.ts +7 -0
  217. package/dist/server/ui/logo-gradient.svg +1 -0
  218. package/dist/server/ui/logo.svg +1 -0
  219. package/dist/server/ui/main.css +129 -0
  220. package/dist/server/ui/main.ts +16 -0
  221. package/dist/server/ui/mark-gradient.svg +1 -0
  222. package/dist/server/ui/mark.svg +1 -0
  223. package/dist/server/ui/pages/Home.vue +39 -0
  224. package/dist/server/ui/pages/Preview.vue +609 -0
  225. package/dist/server/ui/stripes.svg +174 -0
  226. package/dist/transformers/addAttributes.d.mts +32 -0
  227. package/dist/transformers/addAttributes.d.mts.map +1 -0
  228. package/dist/transformers/addAttributes.mjs +101 -0
  229. package/dist/transformers/addAttributes.mjs.map +1 -0
  230. package/dist/transformers/attributeToStyle.d.mts +25 -0
  231. package/dist/transformers/attributeToStyle.d.mts.map +1 -0
  232. package/dist/transformers/attributeToStyle.mjs +80 -0
  233. package/dist/transformers/attributeToStyle.mjs.map +1 -0
  234. package/dist/transformers/base.d.mts +8 -0
  235. package/dist/transformers/base.d.mts.map +1 -0
  236. package/dist/transformers/base.mjs +160 -0
  237. package/dist/transformers/base.mjs.map +1 -0
  238. package/dist/transformers/entities.d.mts +8 -0
  239. package/dist/transformers/entities.d.mts.map +1 -0
  240. package/dist/transformers/entities.mjs +38 -0
  241. package/dist/transformers/entities.mjs.map +1 -0
  242. package/dist/transformers/format.d.mts +15 -0
  243. package/dist/transformers/format.d.mts.map +1 -0
  244. package/dist/transformers/format.mjs +26 -0
  245. package/dist/transformers/format.mjs.map +1 -0
  246. package/dist/transformers/index.d.mts +35 -0
  247. package/dist/transformers/index.d.mts.map +1 -0
  248. package/dist/transformers/index.mjs +73 -0
  249. package/dist/transformers/index.mjs.map +1 -0
  250. package/dist/transformers/inlineCSS.d.mts +30 -0
  251. package/dist/transformers/inlineCSS.d.mts.map +1 -0
  252. package/dist/transformers/inlineCSS.mjs +79 -0
  253. package/dist/transformers/inlineCSS.mjs.map +1 -0
  254. package/dist/transformers/inlineLink.d.mts +14 -0
  255. package/dist/transformers/inlineLink.d.mts.map +1 -0
  256. package/dist/transformers/inlineLink.mjs +76 -0
  257. package/dist/transformers/inlineLink.mjs.map +1 -0
  258. package/dist/transformers/minify.d.mts +17 -0
  259. package/dist/transformers/minify.d.mts.map +1 -0
  260. package/dist/transformers/minify.mjs +24 -0
  261. package/dist/transformers/minify.mjs.map +1 -0
  262. package/dist/transformers/purgeCSS.d.mts +23 -0
  263. package/dist/transformers/purgeCSS.d.mts.map +1 -0
  264. package/dist/transformers/purgeCSS.mjs +66 -0
  265. package/dist/transformers/purgeCSS.mjs.map +1 -0
  266. package/dist/transformers/removeAttributes.d.mts +31 -0
  267. package/dist/transformers/removeAttributes.d.mts.map +1 -0
  268. package/dist/transformers/removeAttributes.mjs +63 -0
  269. package/dist/transformers/removeAttributes.mjs.map +1 -0
  270. package/dist/transformers/replaceStrings.d.mts +16 -0
  271. package/dist/transformers/replaceStrings.d.mts.map +1 -0
  272. package/dist/transformers/replaceStrings.mjs +19 -0
  273. package/dist/transformers/replaceStrings.mjs.map +1 -0
  274. package/dist/transformers/safeClassNames.d.mts +22 -0
  275. package/dist/transformers/safeClassNames.d.mts.map +1 -0
  276. package/dist/transformers/safeClassNames.mjs +103 -0
  277. package/dist/transformers/safeClassNames.mjs.map +1 -0
  278. package/dist/transformers/shorthandCSS.d.mts +24 -0
  279. package/dist/transformers/shorthandCSS.d.mts.map +1 -0
  280. package/dist/transformers/shorthandCSS.mjs +48 -0
  281. package/dist/transformers/shorthandCSS.mjs.map +1 -0
  282. package/dist/transformers/tailwindcss.d.mts +20 -0
  283. package/dist/transformers/tailwindcss.d.mts.map +1 -0
  284. package/dist/transformers/tailwindcss.mjs +136 -0
  285. package/dist/transformers/tailwindcss.mjs.map +1 -0
  286. package/dist/transformers/urlQuery.d.mts +24 -0
  287. package/dist/transformers/urlQuery.d.mts.map +1 -0
  288. package/dist/transformers/urlQuery.mjs +65 -0
  289. package/dist/transformers/urlQuery.mjs.map +1 -0
  290. package/dist/types/config.d.mts +129 -0
  291. package/dist/types/config.d.mts.map +1 -0
  292. package/dist/types/config.mjs +1 -0
  293. package/dist/types/index.d.mts +2 -0
  294. package/dist/types/index.mjs +1 -0
  295. package/dist/utils/ast/index.d.mts +4 -0
  296. package/dist/utils/ast/index.mjs +5 -0
  297. package/dist/utils/ast/parser.d.mts +7 -0
  298. package/dist/utils/ast/parser.d.mts.map +1 -0
  299. package/dist/utils/ast/parser.mjs +15 -0
  300. package/dist/utils/ast/parser.mjs.map +1 -0
  301. package/dist/utils/ast/serializer.d.mts +7 -0
  302. package/dist/utils/ast/serializer.d.mts.map +1 -0
  303. package/dist/utils/ast/serializer.mjs +13 -0
  304. package/dist/utils/ast/serializer.mjs.map +1 -0
  305. package/dist/utils/ast/walker.d.mts +7 -0
  306. package/dist/utils/ast/walker.d.mts.map +1 -0
  307. package/dist/utils/ast/walker.mjs +12 -0
  308. package/dist/utils/ast/walker.mjs.map +1 -0
  309. package/dist/utils/url.d.mts +8 -0
  310. package/dist/utils/url.d.mts.map +1 -0
  311. package/dist/utils/url.mjs +32 -0
  312. package/dist/utils/url.mjs.map +1 -0
  313. package/node_modules/@clack/core/CHANGELOG.md +257 -0
  314. package/node_modules/@clack/core/LICENSE +9 -0
  315. package/node_modules/@clack/core/README.md +22 -0
  316. package/node_modules/@clack/core/dist/index.cjs +15 -0
  317. package/node_modules/@clack/core/dist/index.cjs.map +1 -0
  318. package/node_modules/@clack/core/dist/index.d.cts +211 -0
  319. package/node_modules/@clack/core/dist/index.d.mts +211 -0
  320. package/node_modules/@clack/core/dist/index.d.ts +211 -0
  321. package/node_modules/@clack/core/dist/index.mjs +15 -0
  322. package/node_modules/@clack/core/dist/index.mjs.map +1 -0
  323. package/node_modules/@clack/core/package.json +62 -0
  324. package/node_modules/@clack/prompts/CHANGELOG.md +412 -0
  325. package/node_modules/@clack/prompts/LICENSE +9 -0
  326. package/node_modules/@clack/prompts/README.md +207 -0
  327. package/node_modules/@clack/prompts/dist/index.cjs +87 -0
  328. package/node_modules/@clack/prompts/dist/index.cjs.map +1 -0
  329. package/node_modules/@clack/prompts/dist/index.d.cts +165 -0
  330. package/node_modules/@clack/prompts/dist/index.d.mts +165 -0
  331. package/node_modules/@clack/prompts/dist/index.d.ts +165 -0
  332. package/node_modules/@clack/prompts/dist/index.mjs +87 -0
  333. package/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
  334. package/node_modules/@clack/prompts/package.json +61 -0
  335. package/node_modules/@maizzle/cli/LICENSE +21 -0
  336. package/node_modules/@maizzle/cli/README.md +58 -0
  337. package/node_modules/@maizzle/cli/dist/commands/make/component.d.mts +4 -0
  338. package/node_modules/@maizzle/cli/dist/commands/make/component.mjs +31 -0
  339. package/node_modules/@maizzle/cli/dist/commands/make/config.d.mts +4 -0
  340. package/node_modules/@maizzle/cli/dist/commands/make/config.mjs +21 -0
  341. package/node_modules/@maizzle/cli/dist/commands/make/layout.d.mts +4 -0
  342. package/node_modules/@maizzle/cli/dist/commands/make/layout.mjs +31 -0
  343. package/node_modules/@maizzle/cli/dist/commands/make/scaffold.d.mts +5 -0
  344. package/node_modules/@maizzle/cli/dist/commands/make/scaffold.mjs +28 -0
  345. package/node_modules/@maizzle/cli/dist/commands/make/stubs/component.vue +9 -0
  346. package/node_modules/@maizzle/cli/dist/commands/make/stubs/config.ts +9 -0
  347. package/node_modules/@maizzle/cli/dist/commands/make/stubs/layout.vue +39 -0
  348. package/node_modules/@maizzle/cli/dist/commands/make/stubs/template.vue +8 -0
  349. package/node_modules/@maizzle/cli/dist/commands/make/template.d.mts +4 -0
  350. package/node_modules/@maizzle/cli/dist/commands/make/template.mjs +31 -0
  351. package/node_modules/@maizzle/cli/dist/index.d.mts +8 -0
  352. package/node_modules/@maizzle/cli/dist/index.mjs +42 -0
  353. package/node_modules/@maizzle/cli/package.json +59 -0
  354. package/node_modules/citty/LICENSE +36 -0
  355. package/node_modules/citty/README.md +134 -0
  356. package/node_modules/citty/dist/index.cjs +475 -0
  357. package/node_modules/citty/dist/index.d.cts +80 -0
  358. package/node_modules/citty/dist/index.d.mts +80 -0
  359. package/node_modules/citty/dist/index.d.ts +80 -0
  360. package/node_modules/citty/dist/index.mjs +463 -0
  361. package/node_modules/citty/package.json +49 -0
  362. package/node_modules/commander/LICENSE +22 -0
  363. package/node_modules/commander/Readme.md +1149 -0
  364. package/node_modules/commander/esm.mjs +16 -0
  365. package/node_modules/commander/index.js +24 -0
  366. package/node_modules/commander/lib/argument.js +149 -0
  367. package/node_modules/commander/lib/command.js +2662 -0
  368. package/node_modules/commander/lib/error.js +39 -0
  369. package/node_modules/commander/lib/help.js +709 -0
  370. package/node_modules/commander/lib/option.js +367 -0
  371. package/node_modules/commander/lib/suggestSimilar.js +101 -0
  372. package/node_modules/commander/package-support.json +16 -0
  373. package/node_modules/commander/package.json +82 -0
  374. package/node_modules/commander/typings/esm.d.mts +3 -0
  375. package/node_modules/commander/typings/index.d.ts +1045 -0
  376. package/node_modules/consola/LICENSE +47 -0
  377. package/node_modules/consola/README.md +352 -0
  378. package/node_modules/consola/basic.d.ts +1 -0
  379. package/node_modules/consola/browser.d.ts +1 -0
  380. package/node_modules/consola/core.d.ts +1 -0
  381. package/node_modules/consola/dist/basic.cjs +32 -0
  382. package/node_modules/consola/dist/basic.d.cts +23 -0
  383. package/node_modules/consola/dist/basic.d.mts +21 -0
  384. package/node_modules/consola/dist/basic.d.ts +23 -0
  385. package/node_modules/consola/dist/basic.mjs +24 -0
  386. package/node_modules/consola/dist/browser.cjs +84 -0
  387. package/node_modules/consola/dist/browser.d.cts +23 -0
  388. package/node_modules/consola/dist/browser.d.mts +21 -0
  389. package/node_modules/consola/dist/browser.d.ts +23 -0
  390. package/node_modules/consola/dist/browser.mjs +76 -0
  391. package/node_modules/consola/dist/chunks/prompt.cjs +288 -0
  392. package/node_modules/consola/dist/chunks/prompt.mjs +280 -0
  393. package/node_modules/consola/dist/core.cjs +517 -0
  394. package/node_modules/consola/dist/core.d.cts +459 -0
  395. package/node_modules/consola/dist/core.d.mts +459 -0
  396. package/node_modules/consola/dist/core.d.ts +459 -0
  397. package/node_modules/consola/dist/core.mjs +512 -0
  398. package/node_modules/consola/dist/index.cjs +663 -0
  399. package/node_modules/consola/dist/index.d.cts +24 -0
  400. package/node_modules/consola/dist/index.d.mts +22 -0
  401. package/node_modules/consola/dist/index.d.ts +24 -0
  402. package/node_modules/consola/dist/index.mjs +651 -0
  403. package/node_modules/consola/dist/shared/consola.DCGIlDNP.cjs +75 -0
  404. package/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
  405. package/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
  406. package/node_modules/consola/dist/shared/consola.DwRq1yyg.cjs +312 -0
  407. package/node_modules/consola/dist/utils.cjs +64 -0
  408. package/node_modules/consola/dist/utils.d.cts +286 -0
  409. package/node_modules/consola/dist/utils.d.mts +286 -0
  410. package/node_modules/consola/dist/utils.d.ts +286 -0
  411. package/node_modules/consola/dist/utils.mjs +54 -0
  412. package/node_modules/consola/lib/index.cjs +10 -0
  413. package/node_modules/consola/package.json +136 -0
  414. package/node_modules/consola/utils.d.ts +1 -0
  415. package/node_modules/create-maizzle/README.md +86 -0
  416. package/node_modules/create-maizzle/bin/create-maizzle.mjs +4 -0
  417. package/node_modules/create-maizzle/node_modules/@clack/core/CHANGELOG.md +340 -0
  418. package/node_modules/create-maizzle/node_modules/@clack/core/LICENSE +9 -0
  419. package/node_modules/create-maizzle/node_modules/@clack/core/README.md +22 -0
  420. package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.d.mts +349 -0
  421. package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.mjs +11 -0
  422. package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.mjs.map +1 -0
  423. package/node_modules/create-maizzle/node_modules/@clack/core/package.json +60 -0
  424. package/node_modules/create-maizzle/node_modules/@clack/prompts/CHANGELOG.md +576 -0
  425. package/node_modules/create-maizzle/node_modules/@clack/prompts/LICENSE +9 -0
  426. package/node_modules/create-maizzle/node_modules/@clack/prompts/README.md +270 -0
  427. package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.d.mts +391 -0
  428. package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.mjs +137 -0
  429. package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
  430. package/node_modules/create-maizzle/node_modules/@clack/prompts/package.json +65 -0
  431. package/node_modules/create-maizzle/package.json +47 -0
  432. package/node_modules/create-maizzle/src/index.js +242 -0
  433. package/node_modules/defu/LICENSE +21 -0
  434. package/node_modules/defu/README.md +171 -0
  435. package/node_modules/defu/dist/defu.cjs +77 -0
  436. package/node_modules/defu/dist/defu.d.cts +31 -0
  437. package/node_modules/defu/dist/defu.d.mts +29 -0
  438. package/node_modules/defu/dist/defu.d.ts +31 -0
  439. package/node_modules/defu/dist/defu.mjs +69 -0
  440. package/node_modules/defu/lib/defu.cjs +10 -0
  441. package/node_modules/defu/lib/defu.d.cts +12 -0
  442. package/node_modules/defu/package.json +48 -0
  443. package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  444. package/node_modules/fast-string-truncated-width/dist/index.js +171 -0
  445. package/node_modules/fast-string-truncated-width/dist/types.d.ts +22 -0
  446. package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  447. package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  448. package/node_modules/fast-string-truncated-width/dist/utils.js +15 -0
  449. package/node_modules/fast-string-truncated-width/license +21 -0
  450. package/node_modules/fast-string-truncated-width/package.json +35 -0
  451. package/node_modules/fast-string-truncated-width/readme.md +60 -0
  452. package/node_modules/fast-string-width/dist/index.d.ts +4 -0
  453. package/node_modules/fast-string-width/dist/index.js +14 -0
  454. package/node_modules/fast-string-width/license +21 -0
  455. package/node_modules/fast-string-width/package.json +34 -0
  456. package/node_modules/fast-string-width/readme.md +45 -0
  457. package/node_modules/fast-wrap-ansi/LICENSE +23 -0
  458. package/node_modules/fast-wrap-ansi/README.md +26 -0
  459. package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  460. package/node_modules/fast-wrap-ansi/lib/main.js +216 -0
  461. package/node_modules/fast-wrap-ansi/lib/main.js.map +1 -0
  462. package/node_modules/fast-wrap-ansi/package.json +51 -0
  463. package/node_modules/giget/LICENSE +184 -0
  464. package/node_modules/giget/README.md +248 -0
  465. package/node_modules/giget/dist/cli.mjs +112 -0
  466. package/node_modules/giget/dist/index.d.mts +49 -0
  467. package/node_modules/giget/dist/index.mjs +22 -0
  468. package/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +468 -0
  469. package/node_modules/giget/package.json +62 -0
  470. package/node_modules/node-fetch-native/LICENSE +114 -0
  471. package/node_modules/node-fetch-native/README.md +225 -0
  472. package/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +2 -0
  473. package/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +2 -0
  474. package/node_modules/node-fetch-native/dist/index.cjs +1 -0
  475. package/node_modules/node-fetch-native/dist/index.mjs +1 -0
  476. package/node_modules/node-fetch-native/dist/native.cjs +1 -0
  477. package/node_modules/node-fetch-native/dist/native.mjs +1 -0
  478. package/node_modules/node-fetch-native/dist/node.cjs +19 -0
  479. package/node_modules/node-fetch-native/dist/node.mjs +19 -0
  480. package/node_modules/node-fetch-native/dist/polyfill.cjs +1 -0
  481. package/node_modules/node-fetch-native/dist/polyfill.mjs +1 -0
  482. package/node_modules/node-fetch-native/dist/proxy-stub.cjs +1 -0
  483. package/node_modules/node-fetch-native/dist/proxy-stub.mjs +1 -0
  484. package/node_modules/node-fetch-native/dist/proxy.cjs +58 -0
  485. package/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs +1 -0
  486. package/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs +1 -0
  487. package/node_modules/node-fetch-native/index.d.ts +1 -0
  488. package/node_modules/node-fetch-native/lib/empty.cjs +0 -0
  489. package/node_modules/node-fetch-native/lib/empty.mjs +0 -0
  490. package/node_modules/node-fetch-native/lib/index.cjs +11 -0
  491. package/node_modules/node-fetch-native/lib/index.d.cts +10 -0
  492. package/node_modules/node-fetch-native/lib/index.d.mts +10 -0
  493. package/node_modules/node-fetch-native/lib/index.d.ts +10 -0
  494. package/node_modules/node-fetch-native/lib/native.cjs +11 -0
  495. package/node_modules/node-fetch-native/lib/polyfill.d.cts +1 -0
  496. package/node_modules/node-fetch-native/lib/polyfill.d.mts +1 -0
  497. package/node_modules/node-fetch-native/lib/polyfill.d.ts +1 -0
  498. package/node_modules/node-fetch-native/lib/proxy.d.ts +32 -0
  499. package/node_modules/node-fetch-native/node.d.ts +1 -0
  500. package/node_modules/node-fetch-native/package.json +138 -0
  501. package/node_modules/node-fetch-native/polyfill.d.ts +1 -0
  502. package/node_modules/node-fetch-native/proxy.d.ts +1 -0
  503. package/node_modules/nypm/LICENSE +21 -0
  504. package/node_modules/nypm/README.md +152 -0
  505. package/node_modules/nypm/dist/cli.d.mts +1 -0
  506. package/node_modules/nypm/dist/cli.mjs +460 -0
  507. package/node_modules/nypm/dist/index.d.mts +209 -0
  508. package/node_modules/nypm/dist/index.mjs +423 -0
  509. package/node_modules/nypm/node_modules/citty/LICENSE +21 -0
  510. package/node_modules/nypm/node_modules/citty/README.md +231 -0
  511. package/node_modules/nypm/node_modules/citty/dist/THIRD-PARTY-LICENSES.md +33 -0
  512. package/node_modules/nypm/node_modules/citty/dist/_chunks/libs/scule.mjs +70 -0
  513. package/node_modules/nypm/node_modules/citty/dist/index.d.mts +112 -0
  514. package/node_modules/nypm/node_modules/citty/dist/index.mjs +425 -0
  515. package/node_modules/nypm/node_modules/citty/package.json +42 -0
  516. package/node_modules/nypm/package.json +54 -0
  517. package/node_modules/pathe/LICENSE +70 -0
  518. package/node_modules/pathe/README.md +73 -0
  519. package/node_modules/pathe/dist/index.cjs +39 -0
  520. package/node_modules/pathe/dist/index.d.cts +47 -0
  521. package/node_modules/pathe/dist/index.d.mts +47 -0
  522. package/node_modules/pathe/dist/index.d.ts +47 -0
  523. package/node_modules/pathe/dist/index.mjs +19 -0
  524. package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +266 -0
  525. package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +249 -0
  526. package/node_modules/pathe/dist/utils.cjs +82 -0
  527. package/node_modules/pathe/dist/utils.d.cts +32 -0
  528. package/node_modules/pathe/dist/utils.d.mts +32 -0
  529. package/node_modules/pathe/dist/utils.d.ts +32 -0
  530. package/node_modules/pathe/dist/utils.mjs +77 -0
  531. package/node_modules/pathe/package.json +61 -0
  532. package/node_modules/pathe/utils.d.ts +1 -0
  533. package/node_modules/picocolors/LICENSE +15 -0
  534. package/node_modules/picocolors/README.md +21 -0
  535. package/node_modules/picocolors/package.json +25 -0
  536. package/node_modules/picocolors/picocolors.browser.js +4 -0
  537. package/node_modules/picocolors/picocolors.d.ts +5 -0
  538. package/node_modules/picocolors/picocolors.js +75 -0
  539. package/node_modules/picocolors/types.d.ts +51 -0
  540. package/node_modules/sisteransi/license +21 -0
  541. package/node_modules/sisteransi/package.json +34 -0
  542. package/node_modules/sisteransi/readme.md +113 -0
  543. package/node_modules/sisteransi/src/index.js +58 -0
  544. package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
  545. package/node_modules/tinyexec/LICENSE +21 -0
  546. package/node_modules/tinyexec/README.md +269 -0
  547. package/node_modules/tinyexec/dist/LICENSES.txt +83 -0
  548. package/node_modules/tinyexec/dist/main.d.mts +71 -0
  549. package/node_modules/tinyexec/dist/main.mjs +642 -0
  550. package/node_modules/tinyexec/package.json +62 -0
  551. package/package.json +74 -74
  552. package/CHANGELOG.md +0 -764
  553. package/bin/maizzle +0 -5
  554. package/src/commands/build.js +0 -348
  555. package/src/commands/serve.js +0 -3
  556. package/src/generators/plaintext.js +0 -222
  557. package/src/generators/render.js +0 -129
  558. package/src/index.js +0 -49
  559. package/src/posthtml/defaultComponentsConfig.js +0 -19
  560. package/src/posthtml/defaultConfig.js +0 -14
  561. package/src/posthtml/index.js +0 -102
  562. package/src/posthtml/plugins/combineMediaQueries.js +0 -42
  563. package/src/posthtml/plugins/envAttributes.js +0 -32
  564. package/src/posthtml/plugins/envTags.js +0 -33
  565. package/src/posthtml/plugins/expandLinkTag.js +0 -59
  566. package/src/posthtml/plugins/postcss/compileCss.js +0 -129
  567. package/src/posthtml/plugins/removeRawStyleAttributes.js +0 -30
  568. package/src/server/client.js +0 -182
  569. package/src/server/index.js +0 -464
  570. package/src/server/routes/hmr.js +0 -26
  571. package/src/server/routes/index.js +0 -77
  572. package/src/server/views/404.html +0 -59
  573. package/src/server/views/error.html +0 -83
  574. package/src/server/views/index.html +0 -172
  575. package/src/server/websockets.js +0 -27
  576. package/src/transformers/addAttributes.js +0 -29
  577. package/src/transformers/attributeToStyle.js +0 -90
  578. package/src/transformers/baseUrl.js +0 -154
  579. package/src/transformers/core.js +0 -32
  580. package/src/transformers/filters/defaultFilters.js +0 -146
  581. package/src/transformers/filters/index.js +0 -18
  582. package/src/transformers/index.js +0 -259
  583. package/src/transformers/inline.js +0 -306
  584. package/src/transformers/markdown.js +0 -26
  585. package/src/transformers/minify.js +0 -27
  586. package/src/transformers/posthtmlMso.js +0 -14
  587. package/src/transformers/prettify.js +0 -29
  588. package/src/transformers/preventWidows.js +0 -37
  589. package/src/transformers/purge.js +0 -56
  590. package/src/transformers/removeAttributes.js +0 -55
  591. package/src/transformers/replaceStrings.js +0 -37
  592. package/src/transformers/safeClassNames.js +0 -29
  593. package/src/transformers/shorthandCss.js +0 -20
  594. package/src/transformers/sixHex.js +0 -30
  595. package/src/transformers/template.js +0 -26
  596. package/src/transformers/urlParameters.js +0 -20
  597. package/src/transformers/useAttributeSizes.js +0 -63
  598. package/src/utils/getConfigByFilePath.js +0 -143
  599. package/src/utils/node.js +0 -68
  600. package/src/utils/string.js +0 -186
  601. package/types/build.d.ts +0 -166
  602. package/types/config.d.ts +0 -638
  603. package/types/css/combineMediaQueries.d.ts +0 -90
  604. package/types/css/inline.d.ts +0 -218
  605. package/types/css/purge.d.ts +0 -125
  606. package/types/events.d.ts +0 -153
  607. package/types/index.d.ts +0 -232
  608. package/types/markdown.d.ts +0 -33
  609. package/types/minify.d.ts +0 -138
  610. package/types/plaintext.d.ts +0 -56
  611. package/types/posthtml.d.ts +0 -162
  612. package/types/render.d.ts +0 -13
  613. package/types/urlParameters.d.ts +0 -40
  614. package/types/widowWords.d.ts +0 -38
@@ -0,0 +1,33 @@
1
+ # Licenses of Bundled Dependencies
2
+
3
+ The published artifact additionally contains code with the following licenses:
4
+ MIT
5
+
6
+ # Bundled Dependencies
7
+
8
+ ## scule
9
+
10
+ License: MIT
11
+ Repository: https://github.com/unjs/scule
12
+
13
+ > MIT License
14
+ >
15
+ > Copyright (c) Pooya Parsa <pooya@pi0.io>
16
+ >
17
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ > of this software and associated documentation files (the "Software"), to deal
19
+ > in the Software without restriction, including without limitation the rights
20
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ > copies of the Software, and to permit persons to whom the Software is
22
+ > furnished to do so, subject to the following conditions:
23
+ >
24
+ > The above copyright notice and this permission notice shall be included in all
25
+ > copies or substantial portions of the Software.
26
+ >
27
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ > SOFTWARE.
@@ -0,0 +1,70 @@
1
+ //#region node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs
2
+ const NUMBER_CHAR_RE = /\d/;
3
+ const STR_SPLITTERS = [
4
+ "-",
5
+ "_",
6
+ "/",
7
+ "."
8
+ ];
9
+ function isUppercase(char = "") {
10
+ if (NUMBER_CHAR_RE.test(char)) return;
11
+ return char !== char.toLowerCase();
12
+ }
13
+ function splitByCase(str, separators) {
14
+ const splitters = separators ?? STR_SPLITTERS;
15
+ const parts = [];
16
+ if (!str || typeof str !== "string") return parts;
17
+ let buff = "";
18
+ let previousUpper;
19
+ let previousSplitter;
20
+ for (const char of str) {
21
+ const isSplitter = splitters.includes(char);
22
+ if (isSplitter === true) {
23
+ parts.push(buff);
24
+ buff = "";
25
+ previousUpper = void 0;
26
+ continue;
27
+ }
28
+ const isUpper = isUppercase(char);
29
+ if (previousSplitter === false) {
30
+ if (previousUpper === false && isUpper === true) {
31
+ parts.push(buff);
32
+ buff = char;
33
+ previousUpper = isUpper;
34
+ continue;
35
+ }
36
+ if (previousUpper === true && isUpper === false && buff.length > 1) {
37
+ const lastChar = buff.at(-1);
38
+ parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
39
+ buff = lastChar + char;
40
+ previousUpper = isUpper;
41
+ continue;
42
+ }
43
+ }
44
+ buff += char;
45
+ previousUpper = isUpper;
46
+ previousSplitter = isSplitter;
47
+ }
48
+ parts.push(buff);
49
+ return parts;
50
+ }
51
+ function upperFirst(str) {
52
+ return str ? str[0].toUpperCase() + str.slice(1) : "";
53
+ }
54
+ function lowerFirst(str) {
55
+ return str ? str[0].toLowerCase() + str.slice(1) : "";
56
+ }
57
+ function pascalCase(str, opts) {
58
+ return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
59
+ }
60
+ function camelCase(str, opts) {
61
+ return lowerFirst(pascalCase(str || "", opts));
62
+ }
63
+ function kebabCase(str, joiner) {
64
+ return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
65
+ }
66
+ function snakeCase(str) {
67
+ return kebabCase(str || "", "_");
68
+ }
69
+ //#endregion
70
+ export { kebabCase as n, snakeCase as r, camelCase as t };
@@ -0,0 +1,112 @@
1
+ //#region src/types.d.ts
2
+ type ArgType = "boolean" | "string" | "enum" | "positional" | undefined;
3
+ type _ArgDef<T extends ArgType, VT extends boolean | number | string> = {
4
+ type?: T;
5
+ description?: string;
6
+ valueHint?: string;
7
+ alias?: string | string[];
8
+ default?: VT;
9
+ required?: boolean;
10
+ options?: string[];
11
+ };
12
+ type BooleanArgDef = Omit<_ArgDef<"boolean", boolean>, "options"> & {
13
+ negativeDescription?: string;
14
+ };
15
+ type StringArgDef = Omit<_ArgDef<"string", string>, "options">;
16
+ type EnumArgDef = _ArgDef<"enum", string>;
17
+ type PositionalArgDef = Omit<_ArgDef<"positional", string>, "alias" | "options">;
18
+ type ArgDef = BooleanArgDef | StringArgDef | PositionalArgDef | EnumArgDef;
19
+ type ArgsDef = Record<string, ArgDef>;
20
+ type Arg = ArgDef & {
21
+ name: string;
22
+ alias: string[];
23
+ };
24
+ type ResolveParsedArgType<T extends ArgDef, VT> = T extends {
25
+ default?: any;
26
+ required?: boolean;
27
+ } ? T["default"] extends NonNullable<VT> ? VT : T["required"] extends true ? VT : VT | undefined : VT | undefined;
28
+ type ParsedPositionalArg<T extends ArgDef> = T extends {
29
+ type: "positional";
30
+ } ? ResolveParsedArgType<T, string> : never;
31
+ type ParsedStringArg<T extends ArgDef> = T extends {
32
+ type: "string";
33
+ } ? ResolveParsedArgType<T, string> : never;
34
+ type ParsedBooleanArg<T extends ArgDef> = T extends {
35
+ type: "boolean";
36
+ } ? ResolveParsedArgType<T, boolean> : never;
37
+ type ParsedEnumArg<T extends ArgDef> = T extends {
38
+ type: "enum";
39
+ options: infer U;
40
+ } ? U extends Array<any> ? ResolveParsedArgType<T, U[number]> : never : never;
41
+ type RawArgs = {
42
+ _: string[];
43
+ };
44
+ type ParsedArg<T extends ArgDef> = T["type"] extends "positional" ? ParsedPositionalArg<T> : T["type"] extends "boolean" ? ParsedBooleanArg<T> : T["type"] extends "string" ? ParsedStringArg<T> : T["type"] extends "enum" ? ParsedEnumArg<T> : never;
45
+ type ParsedArgs<T extends ArgsDef = ArgsDef> = RawArgs & { [K in keyof T]: ParsedArg<T[K]> } & { [K in keyof T as T[K] extends {
46
+ alias: string;
47
+ } ? T[K]["alias"] : never]: ParsedArg<T[K]> } & { [K in keyof T as T[K] extends {
48
+ alias: string[];
49
+ } ? T[K]["alias"][number] : never]: ParsedArg<T[K]> } & Record<string, string | number | boolean | string[]>;
50
+ interface CommandMeta {
51
+ name?: string;
52
+ version?: string;
53
+ description?: string;
54
+ hidden?: boolean;
55
+ alias?: string | string[];
56
+ }
57
+ type SubCommandsDef = Record<string, Resolvable<CommandDef<any>>>;
58
+ type CommandDef<T extends ArgsDef = ArgsDef> = {
59
+ meta?: Resolvable<CommandMeta>;
60
+ args?: Resolvable<T>;
61
+ default?: Resolvable<string>;
62
+ subCommands?: Resolvable<SubCommandsDef>;
63
+ plugins?: Resolvable<CittyPlugin>[];
64
+ setup?: (context: CommandContext<T>) => any | Promise<any>;
65
+ cleanup?: (context: CommandContext<T>) => any | Promise<any>;
66
+ run?: (context: CommandContext<T>) => any | Promise<any>;
67
+ };
68
+ type CommandContext<T extends ArgsDef = ArgsDef> = {
69
+ rawArgs: string[];
70
+ args: ParsedArgs<T>;
71
+ cmd: CommandDef<T>;
72
+ subCommand?: CommandDef<T>;
73
+ data?: any;
74
+ };
75
+ type CittyPlugin = {
76
+ name: string;
77
+ setup?(context: CommandContext<any>): void | Promise<void>;
78
+ cleanup?(context: CommandContext<any>): void | Promise<void>;
79
+ };
80
+ type Awaitable<T> = () => T | Promise<T>;
81
+ type Resolvable<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
82
+ //#endregion
83
+ //#region src/command.d.ts
84
+ declare function defineCommand<const T extends ArgsDef = ArgsDef>(def: CommandDef<T>): CommandDef<T>;
85
+ interface RunCommandOptions {
86
+ rawArgs: string[];
87
+ data?: any;
88
+ showUsage?: boolean;
89
+ }
90
+ declare function runCommand<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, opts: RunCommandOptions): Promise<{
91
+ result: unknown;
92
+ }>;
93
+ //#endregion
94
+ //#region src/usage.d.ts
95
+ declare function showUsage<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, parent?: CommandDef<T>): Promise<void>;
96
+ declare function renderUsage<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, parent?: CommandDef<T>): Promise<string>;
97
+ //#endregion
98
+ //#region src/main.d.ts
99
+ interface RunMainOptions {
100
+ rawArgs?: string[];
101
+ showUsage?: typeof showUsage;
102
+ }
103
+ declare function runMain<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, opts?: RunMainOptions): Promise<void>;
104
+ declare function createMain<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>): (opts?: RunMainOptions) => Promise<void>;
105
+ //#endregion
106
+ //#region src/args.d.ts
107
+ declare function parseArgs<T extends ArgsDef = ArgsDef>(rawArgs: string[], argsDef: ArgsDef): ParsedArgs<T>;
108
+ //#endregion
109
+ //#region src/plugin.d.ts
110
+ declare function defineCittyPlugin(plugin: Resolvable<CittyPlugin>): Resolvable<CittyPlugin>;
111
+ //#endregion
112
+ export { Arg, ArgDef, ArgType, ArgsDef, Awaitable, BooleanArgDef, CittyPlugin, CommandContext, CommandDef, CommandMeta, EnumArgDef, ParsedArgs, PositionalArgDef, Resolvable, type RunCommandOptions, type RunMainOptions, StringArgDef, SubCommandsDef, _ArgDef, createMain, defineCittyPlugin, defineCommand, parseArgs, renderUsage, runCommand, runMain, showUsage };
@@ -0,0 +1,425 @@
1
+ import { n as kebabCase, r as snakeCase, t as camelCase } from "./_chunks/libs/scule.mjs";
2
+ import { parseArgs as parseArgs$1 } from "node:util";
3
+ //#region src/_utils.ts
4
+ function toArray(val) {
5
+ if (Array.isArray(val)) return val;
6
+ return val === void 0 ? [] : [val];
7
+ }
8
+ function formatLineColumns(lines, linePrefix = "") {
9
+ const maxLength = [];
10
+ for (const line of lines) for (const [i, element] of line.entries()) maxLength[i] = Math.max(maxLength[i] || 0, element.length);
11
+ return lines.map((l) => l.map((c, i) => linePrefix + c[i === 0 ? "padStart" : "padEnd"](maxLength[i])).join(" ")).join("\n");
12
+ }
13
+ function resolveValue(input) {
14
+ return typeof input === "function" ? input() : input;
15
+ }
16
+ var CLIError = class extends Error {
17
+ code;
18
+ constructor(message, code) {
19
+ super(message);
20
+ this.name = "CLIError";
21
+ this.code = code;
22
+ }
23
+ };
24
+ //#endregion
25
+ //#region src/_parser.ts
26
+ function parseRawArgs(args = [], opts = {}) {
27
+ const booleans = new Set(opts.boolean || []);
28
+ const strings = new Set(opts.string || []);
29
+ const aliasMap = opts.alias || {};
30
+ const defaults = opts.default || {};
31
+ const aliasToMain = /* @__PURE__ */ new Map();
32
+ const mainToAliases = /* @__PURE__ */ new Map();
33
+ for (const [key, value] of Object.entries(aliasMap)) {
34
+ const targets = value;
35
+ for (const target of targets) {
36
+ aliasToMain.set(key, target);
37
+ if (!mainToAliases.has(target)) mainToAliases.set(target, []);
38
+ mainToAliases.get(target).push(key);
39
+ aliasToMain.set(target, key);
40
+ if (!mainToAliases.has(key)) mainToAliases.set(key, []);
41
+ mainToAliases.get(key).push(target);
42
+ }
43
+ }
44
+ const options = {};
45
+ function getType(name) {
46
+ if (booleans.has(name)) return "boolean";
47
+ const aliases = mainToAliases.get(name) || [];
48
+ for (const alias of aliases) if (booleans.has(alias)) return "boolean";
49
+ return "string";
50
+ }
51
+ function isStringType(name) {
52
+ if (strings.has(name)) return true;
53
+ const aliases = mainToAliases.get(name) || [];
54
+ for (const alias of aliases) if (strings.has(alias)) return true;
55
+ return false;
56
+ }
57
+ const allOptions = new Set([
58
+ ...booleans,
59
+ ...strings,
60
+ ...Object.keys(aliasMap),
61
+ ...Object.values(aliasMap).flat(),
62
+ ...Object.keys(defaults)
63
+ ]);
64
+ for (const name of allOptions) if (!options[name]) options[name] = {
65
+ type: getType(name),
66
+ default: defaults[name]
67
+ };
68
+ for (const [alias, main] of aliasToMain.entries()) if (alias.length === 1 && options[main] && !options[main].short) options[main].short = alias;
69
+ const processedArgs = [];
70
+ const negatedFlags = {};
71
+ for (let i = 0; i < args.length; i++) {
72
+ const arg = args[i];
73
+ if (arg === "--") {
74
+ processedArgs.push(...args.slice(i));
75
+ break;
76
+ }
77
+ if (arg.startsWith("--no-")) {
78
+ const flagName = arg.slice(5);
79
+ negatedFlags[flagName] = true;
80
+ continue;
81
+ }
82
+ processedArgs.push(arg);
83
+ }
84
+ let parsed;
85
+ try {
86
+ parsed = parseArgs$1({
87
+ args: processedArgs,
88
+ options: Object.keys(options).length > 0 ? options : void 0,
89
+ allowPositionals: true,
90
+ strict: false
91
+ });
92
+ } catch {
93
+ parsed = {
94
+ values: {},
95
+ positionals: processedArgs
96
+ };
97
+ }
98
+ const out = { _: [] };
99
+ out._ = parsed.positionals;
100
+ for (const [key, value] of Object.entries(parsed.values)) {
101
+ let coerced = value;
102
+ if (getType(key) === "boolean" && typeof value === "string") coerced = value !== "false";
103
+ else if (isStringType(key) && typeof value === "boolean") coerced = "";
104
+ out[key] = coerced;
105
+ }
106
+ for (const [name] of Object.entries(negatedFlags)) {
107
+ out[name] = false;
108
+ const mainName = aliasToMain.get(name);
109
+ if (mainName) out[mainName] = false;
110
+ const aliases = mainToAliases.get(name);
111
+ if (aliases) for (const alias of aliases) out[alias] = false;
112
+ }
113
+ for (const [alias, main] of aliasToMain.entries()) {
114
+ if (out[alias] !== void 0 && out[main] === void 0) out[main] = out[alias];
115
+ if (out[main] !== void 0 && out[alias] === void 0) out[alias] = out[main];
116
+ if (out[alias] !== out[main] && defaults[main] === out[main]) out[main] = out[alias];
117
+ }
118
+ return out;
119
+ }
120
+ //#endregion
121
+ //#region src/_color.ts
122
+ const noColor = /* @__PURE__ */ (() => {
123
+ const env = globalThis.process?.env ?? {};
124
+ return env.NO_COLOR === "1" || env.TERM === "dumb" || env.TEST || env.CI;
125
+ })();
126
+ const _c = (c, r = 39) => (t) => noColor ? t : `\u001B[${c}m${t}\u001B[${r}m`;
127
+ const bold = /* @__PURE__ */ _c(1, 22);
128
+ const cyan = /* @__PURE__ */ _c(36);
129
+ const gray = /* @__PURE__ */ _c(90);
130
+ const underline = /* @__PURE__ */ _c(4, 24);
131
+ //#endregion
132
+ //#region src/args.ts
133
+ function parseArgs(rawArgs, argsDef) {
134
+ const parseOptions = {
135
+ boolean: [],
136
+ string: [],
137
+ alias: {},
138
+ default: {}
139
+ };
140
+ const args = resolveArgs(argsDef);
141
+ for (const arg of args) {
142
+ if (arg.type === "positional") continue;
143
+ if (arg.type === "string" || arg.type === "enum") parseOptions.string.push(arg.name);
144
+ else if (arg.type === "boolean") parseOptions.boolean.push(arg.name);
145
+ if (arg.default !== void 0) parseOptions.default[arg.name] = arg.default;
146
+ if (arg.alias) parseOptions.alias[arg.name] = arg.alias;
147
+ const camelName = camelCase(arg.name);
148
+ const kebabName = kebabCase(arg.name);
149
+ if (camelName !== arg.name || kebabName !== arg.name) {
150
+ const existingAliases = toArray(parseOptions.alias[arg.name] || []);
151
+ if (camelName !== arg.name && !existingAliases.includes(camelName)) existingAliases.push(camelName);
152
+ if (kebabName !== arg.name && !existingAliases.includes(kebabName)) existingAliases.push(kebabName);
153
+ if (existingAliases.length > 0) parseOptions.alias[arg.name] = existingAliases;
154
+ }
155
+ }
156
+ const parsed = parseRawArgs(rawArgs, parseOptions);
157
+ const [ ...positionalArguments] = parsed._;
158
+ const parsedArgsProxy = new Proxy(parsed, { get(target, prop) {
159
+ return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
160
+ } });
161
+ for (const [, arg] of args.entries()) if (arg.type === "positional") {
162
+ const nextPositionalArgument = positionalArguments.shift();
163
+ if (nextPositionalArgument !== void 0) parsedArgsProxy[arg.name] = nextPositionalArgument;
164
+ else if (arg.default === void 0 && arg.required !== false) throw new CLIError(`Missing required positional argument: ${arg.name.toUpperCase()}`, "EARG");
165
+ else parsedArgsProxy[arg.name] = arg.default;
166
+ } else if (arg.type === "enum") {
167
+ const argument = parsedArgsProxy[arg.name];
168
+ const options = arg.options || [];
169
+ if (argument !== void 0 && options.length > 0 && !options.includes(argument)) throw new CLIError(`Invalid value for argument: ${cyan(`--${arg.name}`)} (${cyan(argument)}). Expected one of: ${options.map((o) => cyan(o)).join(", ")}.`, "EARG");
170
+ } else if (arg.required && parsedArgsProxy[arg.name] === void 0) throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
171
+ return parsedArgsProxy;
172
+ }
173
+ function resolveArgs(argsDef) {
174
+ const args = [];
175
+ for (const [name, argDef] of Object.entries(argsDef || {})) args.push({
176
+ ...argDef,
177
+ name,
178
+ alias: toArray(argDef.alias)
179
+ });
180
+ return args;
181
+ }
182
+ //#endregion
183
+ //#region src/plugin.ts
184
+ function defineCittyPlugin(plugin) {
185
+ return plugin;
186
+ }
187
+ async function resolvePlugins(plugins) {
188
+ return Promise.all(plugins.map((p) => resolveValue(p)));
189
+ }
190
+ //#endregion
191
+ //#region src/command.ts
192
+ function defineCommand(def) {
193
+ return def;
194
+ }
195
+ async function runCommand(cmd, opts) {
196
+ const cmdArgs = await resolveValue(cmd.args || {});
197
+ const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
198
+ const context = {
199
+ rawArgs: opts.rawArgs,
200
+ args: parsedArgs,
201
+ data: opts.data,
202
+ cmd
203
+ };
204
+ const plugins = await resolvePlugins(cmd.plugins ?? []);
205
+ let result;
206
+ let runError;
207
+ try {
208
+ for (const plugin of plugins) await plugin.setup?.(context);
209
+ if (typeof cmd.setup === "function") await cmd.setup(context);
210
+ const subCommands = await resolveValue(cmd.subCommands);
211
+ if (subCommands && Object.keys(subCommands).length > 0) {
212
+ const subCommandArgIndex = findSubCommandIndex(opts.rawArgs, cmdArgs);
213
+ const explicitName = opts.rawArgs[subCommandArgIndex];
214
+ if (explicitName) {
215
+ const subCommand = await _findSubCommand(subCommands, explicitName);
216
+ if (!subCommand) throw new CLIError(`Unknown command ${cyan(explicitName)}`, "E_UNKNOWN_COMMAND");
217
+ await runCommand(subCommand, { rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1) });
218
+ } else {
219
+ const defaultSubCommand = await resolveValue(cmd.default);
220
+ if (defaultSubCommand) {
221
+ if (cmd.run) throw new CLIError(`Cannot specify both 'run' and 'default' on the same command.`, "E_DEFAULT_CONFLICT");
222
+ const subCommand = await _findSubCommand(subCommands, defaultSubCommand);
223
+ if (!subCommand) throw new CLIError(`Default sub command ${cyan(defaultSubCommand)} not found in subCommands.`, "E_UNKNOWN_COMMAND");
224
+ await runCommand(subCommand, { rawArgs: opts.rawArgs });
225
+ } else if (!cmd.run) throw new CLIError(`No command specified.`, "E_NO_COMMAND");
226
+ }
227
+ }
228
+ if (typeof cmd.run === "function") result = await cmd.run(context);
229
+ } catch (error) {
230
+ runError = error;
231
+ }
232
+ const cleanupErrors = [];
233
+ if (typeof cmd.cleanup === "function") try {
234
+ await cmd.cleanup(context);
235
+ } catch (error) {
236
+ cleanupErrors.push(error);
237
+ }
238
+ for (const plugin of [...plugins].reverse()) try {
239
+ await plugin.cleanup?.(context);
240
+ } catch (error) {
241
+ cleanupErrors.push(error);
242
+ }
243
+ if (runError) throw runError;
244
+ if (cleanupErrors.length === 1) throw cleanupErrors[0];
245
+ if (cleanupErrors.length > 1) throw new Error("Multiple cleanup errors", { cause: cleanupErrors });
246
+ return { result };
247
+ }
248
+ async function resolveSubCommand(cmd, rawArgs, parent) {
249
+ const subCommands = await resolveValue(cmd.subCommands);
250
+ if (subCommands && Object.keys(subCommands).length > 0) {
251
+ const subCommandArgIndex = findSubCommandIndex(rawArgs, await resolveValue(cmd.args || {}));
252
+ const subCommandName = rawArgs[subCommandArgIndex];
253
+ const subCommand = await _findSubCommand(subCommands, subCommandName);
254
+ if (subCommand) return resolveSubCommand(subCommand, rawArgs.slice(subCommandArgIndex + 1), cmd);
255
+ }
256
+ return [cmd, parent];
257
+ }
258
+ async function _findSubCommand(subCommands, name) {
259
+ if (name in subCommands) return resolveValue(subCommands[name]);
260
+ for (const sub of Object.values(subCommands)) {
261
+ const resolved = await resolveValue(sub);
262
+ const meta = await resolveValue(resolved?.meta);
263
+ if (meta?.alias) {
264
+ if (toArray(meta.alias).includes(name)) return resolved;
265
+ }
266
+ }
267
+ }
268
+ function findSubCommandIndex(rawArgs, argsDef) {
269
+ for (let i = 0; i < rawArgs.length; i++) {
270
+ const arg = rawArgs[i];
271
+ if (arg === "--") return -1;
272
+ if (arg.startsWith("-")) {
273
+ if (!arg.includes("=") && _isValueFlag(arg, argsDef)) i++;
274
+ continue;
275
+ }
276
+ return i;
277
+ }
278
+ return -1;
279
+ }
280
+ function _isValueFlag(flag, argsDef) {
281
+ const name = flag.replace(/^-{1,2}/, "");
282
+ const normalized = camelCase(name);
283
+ for (const [key, def] of Object.entries(argsDef)) {
284
+ if (def.type !== "string" && def.type !== "enum") continue;
285
+ if (normalized === camelCase(key)) return true;
286
+ if ((Array.isArray(def.alias) ? def.alias : def.alias ? [def.alias] : []).includes(name)) return true;
287
+ }
288
+ return false;
289
+ }
290
+ //#endregion
291
+ //#region src/usage.ts
292
+ async function showUsage(cmd, parent) {
293
+ try {
294
+ console.log(await renderUsage(cmd, parent) + "\n");
295
+ } catch (error) {
296
+ console.error(error);
297
+ }
298
+ }
299
+ const negativePrefixRe = /^no[-A-Z]/;
300
+ async function renderUsage(cmd, parent) {
301
+ const cmdMeta = await resolveValue(cmd.meta || {});
302
+ const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
303
+ const parentMeta = await resolveValue(parent?.meta || {});
304
+ const commandName = `${parentMeta.name ? `${parentMeta.name} ` : ""}` + (cmdMeta.name || process.argv[1]);
305
+ const argLines = [];
306
+ const posLines = [];
307
+ const commandsLines = [];
308
+ const usageLine = [];
309
+ for (const arg of cmdArgs) if (arg.type === "positional") {
310
+ const name = arg.name.toUpperCase();
311
+ const isRequired = arg.required !== false && arg.default === void 0;
312
+ posLines.push([cyan(name + renderValueHint(arg)), renderDescription(arg, isRequired)]);
313
+ usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
314
+ } else {
315
+ const isRequired = arg.required === true && arg.default === void 0;
316
+ const argStr = [...(arg.alias || []).map((a) => `-${a}`), `--${arg.name}`].join(", ") + renderValueHint(arg);
317
+ argLines.push([cyan(argStr), renderDescription(arg, isRequired)]);
318
+ /**
319
+ * print negative boolean arg variant usage when
320
+ * - enabled by default or has `negativeDescription`
321
+ * - not prefixed with `no-` or `no[A-Z]`
322
+ */
323
+ if (arg.type === "boolean" && (arg.default === true || arg.negativeDescription) && !negativePrefixRe.test(arg.name)) {
324
+ const negativeArgStr = [...(arg.alias || []).map((a) => `--no-${a}`), `--no-${arg.name}`].join(", ");
325
+ argLines.push([cyan(negativeArgStr), [arg.negativeDescription, isRequired ? gray("(Required)") : ""].filter(Boolean).join(" ")]);
326
+ }
327
+ if (isRequired) usageLine.push(`--${arg.name}` + renderValueHint(arg));
328
+ }
329
+ if (cmd.subCommands) {
330
+ const commandNames = [];
331
+ const subCommands = await resolveValue(cmd.subCommands);
332
+ for (const [name, sub] of Object.entries(subCommands)) {
333
+ const meta = await resolveValue((await resolveValue(sub))?.meta);
334
+ if (meta?.hidden) continue;
335
+ const aliases = toArray(meta?.alias);
336
+ const label = [name, ...aliases].join(", ");
337
+ commandsLines.push([cyan(label), meta?.description || ""]);
338
+ commandNames.push(name, ...aliases);
339
+ }
340
+ usageLine.push(commandNames.join("|"));
341
+ }
342
+ const usageLines = [];
343
+ const version = cmdMeta.version || parentMeta.version;
344
+ usageLines.push(gray(`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`), "");
345
+ const hasOptions = argLines.length > 0 || posLines.length > 0;
346
+ usageLines.push(`${underline(bold("USAGE"))} ${cyan(`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}`)}`, "");
347
+ if (posLines.length > 0) {
348
+ usageLines.push(underline(bold("ARGUMENTS")), "");
349
+ usageLines.push(formatLineColumns(posLines, " "));
350
+ usageLines.push("");
351
+ }
352
+ if (argLines.length > 0) {
353
+ usageLines.push(underline(bold("OPTIONS")), "");
354
+ usageLines.push(formatLineColumns(argLines, " "));
355
+ usageLines.push("");
356
+ }
357
+ if (commandsLines.length > 0) {
358
+ usageLines.push(underline(bold("COMMANDS")), "");
359
+ usageLines.push(formatLineColumns(commandsLines, " "));
360
+ usageLines.push("", `Use ${cyan(`${commandName} <command> --help`)} for more information about a command.`);
361
+ }
362
+ return usageLines.filter((l) => typeof l === "string").join("\n");
363
+ }
364
+ function renderValueHint(arg) {
365
+ const valueHint = arg.valueHint ? `=<${arg.valueHint}>` : "";
366
+ const fallbackValueHint = valueHint || `=<${snakeCase(arg.name)}>`;
367
+ if (!arg.type || arg.type === "positional" || arg.type === "boolean") return valueHint;
368
+ if (arg.type === "enum" && arg.options?.length) return `=<${arg.options.join("|")}>`;
369
+ return fallbackValueHint;
370
+ }
371
+ function renderDescription(arg, required) {
372
+ const requiredHint = required ? gray("(Required)") : "";
373
+ const defaultHint = arg.default === void 0 ? "" : gray(`(Default: ${arg.default})`);
374
+ return [
375
+ arg.description,
376
+ requiredHint,
377
+ defaultHint
378
+ ].filter(Boolean).join(" ");
379
+ }
380
+ //#endregion
381
+ //#region src/main.ts
382
+ async function runMain(cmd, opts = {}) {
383
+ const rawArgs = opts.rawArgs || process.argv.slice(2);
384
+ const showUsage$1 = opts.showUsage || showUsage;
385
+ try {
386
+ const builtinFlags = await _resolveBuiltinFlags(cmd);
387
+ if (builtinFlags.help.length > 0 && rawArgs.some((arg) => builtinFlags.help.includes(arg))) {
388
+ await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
389
+ process.exit(0);
390
+ } else if (rawArgs.length === 1 && builtinFlags.version.includes(rawArgs[0])) {
391
+ const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
392
+ if (!meta?.version) throw new CLIError("No version specified", "E_NO_VERSION");
393
+ console.log(meta.version);
394
+ } else await runCommand(cmd, { rawArgs });
395
+ } catch (error) {
396
+ if (error instanceof CLIError) {
397
+ await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
398
+ console.error(error.message);
399
+ } else console.error(error, "\n");
400
+ process.exit(1);
401
+ }
402
+ }
403
+ function createMain(cmd) {
404
+ return (opts = {}) => runMain(cmd, opts);
405
+ }
406
+ async function _resolveBuiltinFlags(cmd) {
407
+ const argsDef = await resolveValue(cmd.args || {});
408
+ const userNames = /* @__PURE__ */ new Set();
409
+ const userAliases = /* @__PURE__ */ new Set();
410
+ for (const [name, def] of Object.entries(argsDef)) {
411
+ userNames.add(name);
412
+ for (const alias of toArray(def.alias)) userAliases.add(alias);
413
+ }
414
+ return {
415
+ help: _getBuiltinFlags("help", "h", userNames, userAliases),
416
+ version: _getBuiltinFlags("version", "v", userNames, userAliases)
417
+ };
418
+ }
419
+ function _getBuiltinFlags(long, short, userNames, userAliases) {
420
+ if (userNames.has(long) || userAliases.has(long)) return [];
421
+ if (userNames.has(short) || userAliases.has(short)) return [`--${long}`];
422
+ return [`--${long}`, `-${short}`];
423
+ }
424
+ //#endregion
425
+ export { createMain, defineCittyPlugin, defineCommand, parseArgs, renderUsage, runCommand, runMain, showUsage };
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "citty",
3
+ "version": "0.2.2",
4
+ "description": "Elegant CLI Builder",
5
+ "license": "MIT",
6
+ "repository": "unjs/citty",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "types": "./dist/index.d.mts",
13
+ "exports": {
14
+ ".": "./dist/index.mjs"
15
+ },
16
+ "scripts": {
17
+ "build": "obuild",
18
+ "dev": "vitest dev",
19
+ "lint": "oxlint . && oxfmt --check",
20
+ "fmt": "oxlint . --fix && oxfmt",
21
+ "prepack": "pnpm run build",
22
+ "play": "node ./playground/cli.ts",
23
+ "release": "pnpm test && pnpm build && changelogen --release --push && npm publish",
24
+ "test": "pnpm lint && pnpm test:types && vitest run --coverage",
25
+ "test:types": "tsgo --noEmit"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^25.5.0",
29
+ "@typescript/native-preview": "^7.0.0-dev.20260401.1",
30
+ "@vitest/coverage-v8": "^4.1.2",
31
+ "automd": "^0.4.3",
32
+ "changelogen": "^0.6.2",
33
+ "eslint-config-unjs": "^0.6.2",
34
+ "obuild": "^0.4.32",
35
+ "oxfmt": "^0.43.0",
36
+ "oxlint": "^1.58.0",
37
+ "scule": "^1.3.0",
38
+ "typescript": "^6.0.2",
39
+ "vitest": "^4.1.2"
40
+ },
41
+ "packageManager": "pnpm@10.33.0"
42
+ }