@maizzle/framework 6.0.0-rc.1 → 6.0.0-rc.10
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/bin/maizzle.mjs +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +32 -0
- package/dist/build.mjs +6 -3
- package/dist/build.mjs.map +1 -1
- package/dist/components/Body.vue +111 -0
- package/dist/components/Button.vue +68 -14
- package/dist/components/CodeBlock.vue +68 -0
- package/dist/components/CodeInline.vue +49 -0
- package/dist/components/Column.vue +86 -0
- package/dist/components/Container.vue +48 -0
- package/dist/components/Divider.vue +28 -0
- package/dist/components/Head.vue +30 -0
- package/dist/components/Heading.vue +28 -0
- package/dist/components/Html.vue +104 -0
- package/dist/components/Image.vue +70 -0
- package/dist/components/Layout.vue +93 -0
- package/dist/components/Link.vue +26 -0
- package/dist/components/Markdown.vue +89 -0
- package/dist/components/Outlook.vue +36 -0
- package/dist/components/Overlap.vue +80 -0
- package/dist/components/Preheader.vue +20 -0
- package/dist/components/Row.vue +91 -0
- package/dist/components/Section.vue +83 -0
- package/dist/components/Spacer.vue +50 -7
- package/dist/components/Text.vue +29 -0
- package/dist/components/Vml.vue +165 -13
- package/dist/composables/renderContext.d.mts +5 -0
- package/dist/composables/renderContext.d.mts.map +1 -1
- package/dist/composables/renderContext.mjs.map +1 -1
- package/dist/composables/usePreviewText.d.mts +24 -0
- package/dist/composables/usePreviewText.d.mts.map +1 -0
- package/dist/composables/usePreviewText.mjs +29 -0
- package/dist/composables/usePreviewText.mjs.map +1 -0
- package/dist/config/index.mjs +7 -0
- package/dist/config/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.mjs +3 -1
- package/dist/node_modules/picomatch/index.mjs +13 -0
- package/dist/node_modules/picomatch/index.mjs.map +1 -0
- package/dist/node_modules/picomatch/lib/constants.mjs +174 -0
- package/dist/node_modules/picomatch/lib/constants.mjs.map +1 -0
- package/dist/node_modules/picomatch/lib/parse.mjs +1067 -0
- package/dist/node_modules/picomatch/lib/parse.mjs.map +1 -0
- package/dist/node_modules/picomatch/lib/picomatch.mjs +304 -0
- package/dist/node_modules/picomatch/lib/picomatch.mjs.map +1 -0
- package/dist/node_modules/picomatch/lib/scan.mjs +296 -0
- package/dist/node_modules/picomatch/lib/scan.mjs.map +1 -0
- package/dist/node_modules/picomatch/lib/utils.mjs +53 -0
- package/dist/node_modules/picomatch/lib/utils.mjs.map +1 -0
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +24 -7
- package/dist/plugin.mjs.map +1 -1
- package/dist/plugins/postcss/tailwindCleanup.d.mts.map +1 -1
- package/dist/plugins/postcss/tailwindCleanup.mjs +44 -13
- package/dist/plugins/postcss/tailwindCleanup.mjs.map +1 -1
- package/dist/render/createRenderer.d.mts +8 -3
- package/dist/render/createRenderer.d.mts.map +1 -1
- package/dist/render/createRenderer.mjs +146 -10
- package/dist/render/createRenderer.mjs.map +1 -1
- package/dist/render/index.mjs +6 -3
- package/dist/render/index.mjs.map +1 -1
- package/dist/serve.d.mts.map +1 -1
- package/dist/serve.mjs +157 -63
- package/dist/serve.mjs.map +1 -1
- package/dist/server/compatibility.d.mts +1 -2
- package/dist/server/compatibility.d.mts.map +1 -1
- package/dist/server/compatibility.mjs +30 -16
- package/dist/server/compatibility.mjs.map +1 -1
- package/dist/server/email.d.mts +17 -0
- package/dist/server/email.d.mts.map +1 -0
- package/dist/server/email.mjs +41 -0
- package/dist/server/email.mjs.map +1 -0
- package/dist/server/linter.d.mts +1 -2
- package/dist/server/linter.d.mts.map +1 -1
- package/dist/server/linter.mjs +60 -71
- package/dist/server/linter.mjs.map +1 -1
- package/dist/server/ui/App.vue +205 -69
- package/dist/server/ui/components/ui/checkbox/Checkbox.vue +35 -0
- package/dist/server/ui/components/ui/checkbox/index.ts +1 -0
- package/dist/server/ui/components/ui/command/CommandDialog.vue +1 -1
- package/dist/server/ui/components/ui/command/CommandInput.vue +19 -1
- package/dist/server/ui/components/ui/command/CommandItem.vue +1 -1
- package/dist/server/ui/components/ui/command/CommandList.vue +1 -1
- package/dist/server/ui/components/ui/command/CommandShortcut.vue +1 -1
- package/dist/server/ui/components/ui/dialog/DialogOverlay.vue +9 -1
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/dist/server/ui/components/ui/scroll-area/ScrollBar.vue +1 -1
- package/dist/server/ui/components/ui/sheet/SheetContent.vue +1 -1
- package/dist/server/ui/components/ui/sheet/SheetOverlay.vue +9 -1
- package/dist/server/ui/components/ui/sidebar/Sidebar.vue +8 -1
- package/dist/server/ui/components/ui/sidebar/SidebarProvider.vue +1 -1
- package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +5 -4
- package/dist/server/ui/components/ui/tags-input/TagsInput.vue +26 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputInput.vue +17 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputItem.vue +19 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputItemDelete.vue +22 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputItemText.vue +17 -0
- package/dist/server/ui/components/ui/tags-input/index.ts +5 -0
- package/dist/server/ui/components/ui/toggle/index.ts +3 -3
- package/dist/server/ui/components/ui/toggle-group/ToggleGroup.vue +1 -1
- package/dist/server/ui/components/ui/toggle-group/ToggleGroupItem.vue +2 -2
- package/dist/server/ui/main.css +20 -20
- package/dist/server/ui/pages/Home.vue +12 -5
- package/dist/server/ui/pages/Preview.vue +506 -216
- package/dist/transformers/entities.d.mts.map +1 -1
- package/dist/transformers/entities.mjs +3 -0
- package/dist/transformers/entities.mjs.map +1 -1
- package/dist/transformers/filters/defaults.d.mts +6 -0
- package/dist/transformers/filters/defaults.d.mts.map +1 -0
- package/dist/transformers/filters/defaults.mjs +78 -0
- package/dist/transformers/filters/defaults.mjs.map +1 -0
- package/dist/transformers/filters/index.d.mts +22 -0
- package/dist/transformers/filters/index.d.mts.map +1 -0
- package/dist/transformers/filters/index.mjs +67 -0
- package/dist/transformers/filters/index.mjs.map +1 -0
- package/dist/transformers/index.d.mts +11 -9
- package/dist/transformers/index.d.mts.map +1 -1
- package/dist/transformers/index.mjs +19 -11
- package/dist/transformers/index.mjs.map +1 -1
- package/dist/transformers/inlineCSS.d.mts +1 -14
- package/dist/transformers/inlineCSS.d.mts.map +1 -1
- package/dist/transformers/inlineCSS.mjs +25 -34
- package/dist/transformers/inlineCSS.mjs.map +1 -1
- package/dist/transformers/purgeCSS.d.mts.map +1 -1
- package/dist/transformers/purgeCSS.mjs +67 -1
- package/dist/transformers/purgeCSS.mjs.map +1 -1
- package/dist/transformers/sixHex.d.mts +16 -0
- package/dist/transformers/sixHex.d.mts.map +1 -0
- package/dist/transformers/sixHex.mjs +30 -0
- package/dist/transformers/sixHex.mjs.map +1 -0
- package/dist/transformers/tailwindcss.d.mts +6 -2
- package/dist/transformers/tailwindcss.d.mts.map +1 -1
- package/dist/transformers/tailwindcss.mjs +52 -28
- package/dist/transformers/tailwindcss.mjs.map +1 -1
- package/dist/types/config.d.mts +446 -21
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/utils/ast/serializer.d.mts +3 -2
- package/dist/utils/ast/serializer.d.mts.map +1 -1
- package/dist/utils/ast/serializer.mjs +24 -0
- package/dist/utils/ast/serializer.mjs.map +1 -1
- package/dist/utils/detect.d.mts +5 -0
- package/dist/utils/detect.d.mts.map +1 -0
- package/dist/utils/detect.mjs +11 -0
- package/dist/utils/detect.mjs.map +1 -0
- package/node_modules/@clack/core/CHANGELOG.md +87 -4
- package/node_modules/@clack/core/README.md +1 -1
- package/node_modules/@clack/core/dist/index.d.mts +186 -48
- package/node_modules/@clack/core/dist/index.mjs +10 -14
- package/node_modules/@clack/core/dist/index.mjs.map +1 -1
- package/node_modules/@clack/core/package.json +7 -9
- package/node_modules/@clack/prompts/CHANGELOG.md +171 -7
- package/node_modules/@clack/prompts/README.md +66 -3
- package/node_modules/@clack/prompts/dist/index.d.mts +302 -76
- package/node_modules/@clack/prompts/dist/index.mjs +134 -84
- package/node_modules/@clack/prompts/dist/index.mjs.map +1 -1
- package/node_modules/@clack/prompts/package.json +14 -10
- package/node_modules/citty/LICENSE +0 -15
- package/node_modules/citty/README.md +166 -69
- package/node_modules/citty/dist/index.d.mts +88 -56
- package/node_modules/citty/dist/index.mjs +399 -437
- package/node_modules/citty/package.json +28 -35
- package/node_modules/giget/README.md +59 -11
- package/node_modules/giget/dist/THIRD-PARTY-LICENSES.md +205 -0
- package/node_modules/giget/dist/_chunks/giget.mjs +508 -0
- package/node_modules/giget/dist/_chunks/libs/citty.mjs +269 -0
- package/node_modules/giget/dist/_chunks/libs/nypm.d.mts +1 -0
- package/node_modules/giget/dist/_chunks/libs/nypm.mjs +669 -0
- package/node_modules/giget/dist/_chunks/libs/tar.mjs +2931 -0
- package/node_modules/giget/dist/_chunks/rolldown-runtime.mjs +14 -0
- package/node_modules/giget/dist/cli.d.mts +1 -0
- package/node_modules/giget/dist/cli.mjs +89 -111
- package/node_modules/giget/dist/index.d.mts +46 -35
- package/node_modules/giget/dist/index.mjs +2 -22
- package/node_modules/giget/package.json +32 -45
- package/node_modules/maizzle/README.md +140 -0
- package/node_modules/maizzle/bin/maizzle.mjs +5 -0
- package/node_modules/maizzle/dist/commands/new.d.mts +7 -0
- package/node_modules/maizzle/dist/commands/new.mjs +278 -0
- package/node_modules/{@maizzle/cli → maizzle}/dist/index.d.mts +1 -1
- package/node_modules/maizzle/dist/index.mjs +44 -0
- package/node_modules/{commander → maizzle/node_modules/commander}/Readme.md +94 -67
- package/node_modules/{commander → maizzle/node_modules/commander}/lib/argument.js +5 -4
- package/node_modules/{commander → maizzle/node_modules/commander}/lib/command.js +154 -39
- package/node_modules/{commander → maizzle/node_modules/commander}/lib/help.js +77 -39
- package/node_modules/{commander → maizzle/node_modules/commander}/lib/option.js +16 -3
- package/node_modules/{commander → maizzle/node_modules/commander}/package-support.json +4 -1
- package/node_modules/{commander → maizzle/node_modules/commander}/package.json +8 -8
- package/node_modules/{commander → maizzle/node_modules/commander}/typings/index.d.ts +71 -3
- package/node_modules/{@maizzle/cli → maizzle}/package.json +13 -11
- package/node_modules/tinyexec/README.md +49 -3
- package/node_modules/tinyexec/dist/main.d.mts +25 -14
- package/node_modules/tinyexec/dist/main.mjs +148 -100
- package/node_modules/tinyexec/package.json +9 -8
- package/package.json +9 -4
- package/dist/server/ui/components/ui/resizable/ResizableHandle.vue +0 -30
- package/dist/server/ui/components/ui/resizable/ResizablePanel.vue +0 -21
- package/dist/server/ui/components/ui/resizable/ResizablePanelGroup.vue +0 -25
- package/dist/server/ui/components/ui/resizable/index.ts +0 -3
- package/node_modules/@clack/core/dist/index.cjs +0 -15
- package/node_modules/@clack/core/dist/index.cjs.map +0 -1
- package/node_modules/@clack/core/dist/index.d.cts +0 -211
- package/node_modules/@clack/core/dist/index.d.ts +0 -211
- package/node_modules/@clack/prompts/dist/index.cjs +0 -87
- package/node_modules/@clack/prompts/dist/index.cjs.map +0 -1
- package/node_modules/@clack/prompts/dist/index.d.cts +0 -165
- package/node_modules/@clack/prompts/dist/index.d.ts +0 -165
- package/node_modules/@maizzle/cli/README.md +0 -58
- package/node_modules/@maizzle/cli/dist/index.mjs +0 -42
- package/node_modules/citty/dist/index.cjs +0 -475
- package/node_modules/citty/dist/index.d.cts +0 -80
- package/node_modules/citty/dist/index.d.ts +0 -80
- package/node_modules/consola/LICENSE +0 -47
- package/node_modules/consola/README.md +0 -352
- package/node_modules/consola/basic.d.ts +0 -1
- package/node_modules/consola/browser.d.ts +0 -1
- package/node_modules/consola/core.d.ts +0 -1
- package/node_modules/consola/dist/basic.cjs +0 -32
- package/node_modules/consola/dist/basic.d.cts +0 -23
- package/node_modules/consola/dist/basic.d.mts +0 -21
- package/node_modules/consola/dist/basic.d.ts +0 -23
- package/node_modules/consola/dist/basic.mjs +0 -24
- package/node_modules/consola/dist/browser.cjs +0 -84
- package/node_modules/consola/dist/browser.d.cts +0 -23
- package/node_modules/consola/dist/browser.d.mts +0 -21
- package/node_modules/consola/dist/browser.d.ts +0 -23
- package/node_modules/consola/dist/browser.mjs +0 -76
- package/node_modules/consola/dist/chunks/prompt.cjs +0 -288
- package/node_modules/consola/dist/chunks/prompt.mjs +0 -280
- package/node_modules/consola/dist/core.cjs +0 -517
- package/node_modules/consola/dist/core.d.cts +0 -459
- package/node_modules/consola/dist/core.d.mts +0 -459
- package/node_modules/consola/dist/core.d.ts +0 -459
- package/node_modules/consola/dist/core.mjs +0 -512
- package/node_modules/consola/dist/index.cjs +0 -663
- package/node_modules/consola/dist/index.d.cts +0 -24
- package/node_modules/consola/dist/index.d.mts +0 -22
- package/node_modules/consola/dist/index.d.ts +0 -24
- package/node_modules/consola/dist/index.mjs +0 -651
- package/node_modules/consola/dist/shared/consola.DCGIlDNP.cjs +0 -75
- package/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +0 -72
- package/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +0 -288
- package/node_modules/consola/dist/shared/consola.DwRq1yyg.cjs +0 -312
- package/node_modules/consola/dist/utils.cjs +0 -64
- package/node_modules/consola/dist/utils.d.cts +0 -286
- package/node_modules/consola/dist/utils.d.mts +0 -286
- package/node_modules/consola/dist/utils.d.ts +0 -286
- package/node_modules/consola/dist/utils.mjs +0 -54
- package/node_modules/consola/lib/index.cjs +0 -10
- package/node_modules/consola/package.json +0 -136
- package/node_modules/consola/utils.d.ts +0 -1
- package/node_modules/create-maizzle/README.md +0 -86
- package/node_modules/create-maizzle/bin/create-maizzle.mjs +0 -4
- package/node_modules/create-maizzle/node_modules/@clack/core/CHANGELOG.md +0 -340
- package/node_modules/create-maizzle/node_modules/@clack/core/LICENSE +0 -9
- package/node_modules/create-maizzle/node_modules/@clack/core/README.md +0 -22
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.d.mts +0 -349
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.mjs +0 -11
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.mjs.map +0 -1
- package/node_modules/create-maizzle/node_modules/@clack/core/package.json +0 -60
- package/node_modules/create-maizzle/node_modules/@clack/prompts/CHANGELOG.md +0 -576
- package/node_modules/create-maizzle/node_modules/@clack/prompts/LICENSE +0 -9
- package/node_modules/create-maizzle/node_modules/@clack/prompts/README.md +0 -270
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.d.mts +0 -391
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.mjs +0 -137
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.mjs.map +0 -1
- package/node_modules/create-maizzle/node_modules/@clack/prompts/package.json +0 -65
- package/node_modules/create-maizzle/package.json +0 -47
- package/node_modules/create-maizzle/src/index.js +0 -242
- package/node_modules/defu/LICENSE +0 -21
- package/node_modules/defu/README.md +0 -171
- package/node_modules/defu/dist/defu.cjs +0 -77
- package/node_modules/defu/dist/defu.d.cts +0 -31
- package/node_modules/defu/dist/defu.d.mts +0 -29
- package/node_modules/defu/dist/defu.d.ts +0 -31
- package/node_modules/defu/dist/defu.mjs +0 -69
- package/node_modules/defu/lib/defu.cjs +0 -10
- package/node_modules/defu/lib/defu.d.cts +0 -12
- package/node_modules/defu/package.json +0 -48
- package/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +0 -468
- package/node_modules/node-fetch-native/LICENSE +0 -114
- package/node_modules/node-fetch-native/README.md +0 -225
- package/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +0 -2
- package/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +0 -2
- package/node_modules/node-fetch-native/dist/index.cjs +0 -1
- package/node_modules/node-fetch-native/dist/index.mjs +0 -1
- package/node_modules/node-fetch-native/dist/native.cjs +0 -1
- package/node_modules/node-fetch-native/dist/native.mjs +0 -1
- package/node_modules/node-fetch-native/dist/node.cjs +0 -19
- package/node_modules/node-fetch-native/dist/node.mjs +0 -19
- package/node_modules/node-fetch-native/dist/polyfill.cjs +0 -1
- package/node_modules/node-fetch-native/dist/polyfill.mjs +0 -1
- package/node_modules/node-fetch-native/dist/proxy-stub.cjs +0 -1
- package/node_modules/node-fetch-native/dist/proxy-stub.mjs +0 -1
- package/node_modules/node-fetch-native/dist/proxy.cjs +0 -58
- package/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs +0 -1
- package/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs +0 -1
- package/node_modules/node-fetch-native/index.d.ts +0 -1
- package/node_modules/node-fetch-native/lib/empty.cjs +0 -0
- package/node_modules/node-fetch-native/lib/empty.mjs +0 -0
- package/node_modules/node-fetch-native/lib/index.cjs +0 -11
- package/node_modules/node-fetch-native/lib/index.d.cts +0 -10
- package/node_modules/node-fetch-native/lib/index.d.mts +0 -10
- package/node_modules/node-fetch-native/lib/index.d.ts +0 -10
- package/node_modules/node-fetch-native/lib/native.cjs +0 -11
- package/node_modules/node-fetch-native/lib/polyfill.d.cts +0 -1
- package/node_modules/node-fetch-native/lib/polyfill.d.mts +0 -1
- package/node_modules/node-fetch-native/lib/polyfill.d.ts +0 -1
- package/node_modules/node-fetch-native/lib/proxy.d.ts +0 -32
- package/node_modules/node-fetch-native/node.d.ts +0 -1
- package/node_modules/node-fetch-native/package.json +0 -138
- package/node_modules/node-fetch-native/polyfill.d.ts +0 -1
- package/node_modules/node-fetch-native/proxy.d.ts +0 -1
- package/node_modules/nypm/node_modules/citty/LICENSE +0 -21
- package/node_modules/nypm/node_modules/citty/README.md +0 -231
- package/node_modules/nypm/node_modules/citty/dist/index.d.mts +0 -112
- package/node_modules/nypm/node_modules/citty/dist/index.mjs +0 -425
- package/node_modules/nypm/node_modules/citty/package.json +0 -42
- /package/node_modules/{nypm/node_modules/citty → citty}/dist/THIRD-PARTY-LICENSES.md +0 -0
- /package/node_modules/{nypm/node_modules/citty → citty}/dist/_chunks/libs/scule.mjs +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/LICENSE +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/component.d.mts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/component.mjs +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/config.d.mts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/config.mjs +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/layout.d.mts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/layout.mjs +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/scaffold.d.mts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/scaffold.mjs +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/stubs/component.vue +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/stubs/config.ts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/stubs/layout.vue +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/stubs/template.vue +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/template.d.mts +0 -0
- /package/node_modules/{@maizzle/cli → maizzle}/dist/commands/make/template.mjs +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/LICENSE +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/esm.mjs +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/index.js +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/lib/error.js +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/lib/suggestSimilar.js +0 -0
- /package/node_modules/{commander → maizzle/node_modules/commander}/typings/esm.d.mts +0 -0
|
@@ -1,50 +1,27 @@
|
|
|
1
1
|
# 🌆 citty
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
-
[![bundle][bundle-src]][bundle-href]
|
|
6
|
-
[![Codecov][codecov-src]][codecov-href]
|
|
7
|
-
[![License][license-src]][license-href]
|
|
3
|
+
<!-- automd:badges color=yellow bundlephobia -->
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
[](https://npmjs.com/package/citty)
|
|
6
|
+
[](https://npmjs.com/package/citty)
|
|
7
|
+
[](https://bundlephobia.com/package/citty)
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
- Smart value parsing with typecast, boolean shortcuts and unknown flag handling
|
|
13
|
-
- Nested sub-commands
|
|
14
|
-
- Lazy and Async commands
|
|
15
|
-
- Plugable and composable API
|
|
16
|
-
- Auto generated usage and help
|
|
9
|
+
<!-- /automd -->
|
|
17
10
|
|
|
18
|
-
|
|
11
|
+
Elegant CLI Builder
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
- Zero dependency, fast and lightweight (based on native [`util.parseArgs`](https://nodejs.org/api/util.html#utilparseargsconfig))
|
|
14
|
+
- Smart value parsing with typecast and boolean shortcuts
|
|
15
|
+
- Nested sub-commands with lazy and async loading
|
|
16
|
+
- Pluggable and composable API with auto generated usage
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
## Usage
|
|
23
19
|
|
|
24
20
|
```sh
|
|
25
|
-
|
|
26
|
-
npm install citty
|
|
27
|
-
|
|
28
|
-
# yarn
|
|
29
|
-
yarn add citty
|
|
30
|
-
|
|
31
|
-
# pnpm
|
|
32
|
-
pnpm install citty
|
|
21
|
+
npx nypm add -D citty
|
|
33
22
|
```
|
|
34
23
|
|
|
35
|
-
Import:
|
|
36
|
-
|
|
37
24
|
```js
|
|
38
|
-
// ESM
|
|
39
|
-
import { defineCommand, runMain } from "citty";
|
|
40
|
-
|
|
41
|
-
// CommonJS
|
|
42
|
-
const { defineCommand, runMain } = require("citty");
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Define main command to run:
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
25
|
import { defineCommand, runMain } from "citty";
|
|
49
26
|
|
|
50
27
|
const main = defineCommand({
|
|
@@ -64,6 +41,12 @@ const main = defineCommand({
|
|
|
64
41
|
description: "Use friendly greeting",
|
|
65
42
|
},
|
|
66
43
|
},
|
|
44
|
+
setup({ args }) {
|
|
45
|
+
console.log(`now setup ${args.command}`);
|
|
46
|
+
},
|
|
47
|
+
cleanup({ args }) {
|
|
48
|
+
console.log(`now cleanup ${args.command}`);
|
|
49
|
+
},
|
|
67
50
|
run({ args }) {
|
|
68
51
|
console.log(`${args.friendly ? "Hi" : "Greetings"} ${args.name}!`);
|
|
69
52
|
},
|
|
@@ -72,35 +55,168 @@ const main = defineCommand({
|
|
|
72
55
|
runMain(main);
|
|
73
56
|
```
|
|
74
57
|
|
|
75
|
-
|
|
58
|
+
```sh
|
|
59
|
+
node index.mjs john
|
|
60
|
+
# Greetings john!
|
|
61
|
+
```
|
|
76
62
|
|
|
77
|
-
###
|
|
63
|
+
### Sub Commands
|
|
78
64
|
|
|
79
|
-
|
|
65
|
+
Sub commands can be nested recursively. Use lazy imports for large CLIs to avoid loading all commands at once.
|
|
80
66
|
|
|
81
|
-
|
|
67
|
+
```js
|
|
68
|
+
import { defineCommand, runMain } from "citty";
|
|
82
69
|
|
|
83
|
-
|
|
70
|
+
const sub = defineCommand({
|
|
71
|
+
meta: { name: "sub", description: "Sub command" },
|
|
72
|
+
args: {
|
|
73
|
+
name: { type: "positional", description: "Your name", required: true },
|
|
74
|
+
},
|
|
75
|
+
run({ args }) {
|
|
76
|
+
console.log(`Hello ${args.name}!`);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
84
79
|
|
|
85
|
-
|
|
80
|
+
const main = defineCommand({
|
|
81
|
+
meta: { name: "hello", version: "1.0.0", description: "My Awesome CLI App" },
|
|
82
|
+
subCommands: { sub },
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
runMain(main);
|
|
86
|
+
```
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
Subcommands support `meta.alias` (e.g., `["i", "add"]`) and `meta.hidden: true` to hide from help output.
|
|
88
89
|
|
|
89
|
-
###
|
|
90
|
+
### Lazy Commands
|
|
91
|
+
|
|
92
|
+
For large CLIs, lazy load sub commands so only the executed command is imported:
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
const main = defineCommand({
|
|
96
|
+
meta: { name: "hello", version: "1.0.0", description: "My Awesome CLI App" },
|
|
97
|
+
subCommands: {
|
|
98
|
+
sub: () => import("./sub.mjs").then((m) => m.default),
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
```
|
|
90
102
|
|
|
91
|
-
|
|
103
|
+
`meta`, `args`, and `subCommands` all accept `Resolvable<T>` values — a value, Promise, function, or async function — enabling lazy and dynamic resolution.
|
|
92
104
|
|
|
93
|
-
###
|
|
105
|
+
### Hooks
|
|
94
106
|
|
|
95
|
-
|
|
107
|
+
Commands support `setup` and `cleanup` functions called before and after `run()`. Only the executed command's hooks run. `cleanup` always runs, even if `run()` throws.
|
|
96
108
|
|
|
97
|
-
|
|
109
|
+
```js
|
|
110
|
+
const main = defineCommand({
|
|
111
|
+
meta: { name: "hello", version: "1.0.0", description: "My Awesome CLI App" },
|
|
112
|
+
setup() {
|
|
113
|
+
console.log("Setting up...");
|
|
114
|
+
},
|
|
115
|
+
cleanup() {
|
|
116
|
+
console.log("Cleaning up...");
|
|
117
|
+
},
|
|
118
|
+
run() {
|
|
119
|
+
console.log("Hello World!");
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
```
|
|
98
123
|
|
|
99
|
-
|
|
124
|
+
### Plugins
|
|
100
125
|
|
|
101
|
-
|
|
126
|
+
Plugins extend commands with reusable `setup` and `cleanup` hooks:
|
|
102
127
|
|
|
103
|
-
|
|
128
|
+
```js
|
|
129
|
+
import { defineCommand, defineCittyPlugin, runMain } from "citty";
|
|
130
|
+
|
|
131
|
+
const logger = defineCittyPlugin({
|
|
132
|
+
name: "logger",
|
|
133
|
+
setup({ args }) {
|
|
134
|
+
console.log("Logger setup, args:", args);
|
|
135
|
+
},
|
|
136
|
+
cleanup() {
|
|
137
|
+
console.log("Logger cleanup");
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const main = defineCommand({
|
|
142
|
+
meta: { name: "hello", description: "My CLI App" },
|
|
143
|
+
plugins: [logger],
|
|
144
|
+
run() {
|
|
145
|
+
console.log("Hello!");
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
runMain(main);
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Plugin `setup` hooks run before the command's `setup` (in order), `cleanup` hooks run after (in reverse). Plugins can be async or factory functions.
|
|
153
|
+
|
|
154
|
+
## Arguments
|
|
155
|
+
|
|
156
|
+
### Argument Types
|
|
157
|
+
|
|
158
|
+
| Type | Description | Example |
|
|
159
|
+
| ------------ | ---------------------------------------- | --------------------------- |
|
|
160
|
+
| `positional` | Unnamed positional args | `cli <name>` |
|
|
161
|
+
| `string` | Named string options | `--name value` |
|
|
162
|
+
| `boolean` | Boolean flags, supports `--no-` negation | `--verbose` |
|
|
163
|
+
| `enum` | Constrained to `options` array | `--level=info\|warn\|error` |
|
|
164
|
+
|
|
165
|
+
### Common Options
|
|
166
|
+
|
|
167
|
+
| Option | Description |
|
|
168
|
+
| ------------- | ------------------------------------------------------------- |
|
|
169
|
+
| `description` | Help text shown in usage output |
|
|
170
|
+
| `required` | Whether the argument is required |
|
|
171
|
+
| `default` | Default value when not provided |
|
|
172
|
+
| `alias` | Short aliases (e.g., `["f"]`). Not for `positional` |
|
|
173
|
+
| `valueHint` | Display hint in help (e.g., `"host"` renders `--name=<host>`) |
|
|
174
|
+
|
|
175
|
+
### Example
|
|
176
|
+
|
|
177
|
+
```js
|
|
178
|
+
const main = defineCommand({
|
|
179
|
+
args: {
|
|
180
|
+
name: { type: "positional", description: "Your name", required: true },
|
|
181
|
+
friendly: { type: "boolean", description: "Use friendly greeting", alias: ["f"] },
|
|
182
|
+
greeting: { type: "string", description: "Custom greeting", default: "Hello" },
|
|
183
|
+
level: {
|
|
184
|
+
type: "enum",
|
|
185
|
+
description: "Log level",
|
|
186
|
+
options: ["debug", "info", "warn", "error"],
|
|
187
|
+
default: "info",
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
run({ args }) {
|
|
191
|
+
console.log(`${args.greeting} ${args.name}! (level: ${args.level})`);
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Boolean Negation
|
|
197
|
+
|
|
198
|
+
Boolean args support `--no-` prefix. The negative variant appears in help when `default: true` or `negativeDescription` is set.
|
|
199
|
+
|
|
200
|
+
### Case-Agnostic Access
|
|
201
|
+
|
|
202
|
+
Kebab-case args can be accessed as camelCase: `args["output-dir"]` and `args.outputDir` both work.
|
|
203
|
+
|
|
204
|
+
## Built-in Flags
|
|
205
|
+
|
|
206
|
+
`--help` / `-h` and `--version` / `-v` are handled automatically. Disabled if your command defines args with the same names or aliases.
|
|
207
|
+
|
|
208
|
+
## API
|
|
209
|
+
|
|
210
|
+
| Function | Description |
|
|
211
|
+
| ----------------------------- | -------------------------------------------------------------------------- |
|
|
212
|
+
| `defineCommand(def)` | Type helper for defining commands |
|
|
213
|
+
| `runMain(cmd, opts?)` | Run a command with usage support and graceful error handling |
|
|
214
|
+
| `createMain(cmd)` | Create a wrapper that calls `runMain` when invoked |
|
|
215
|
+
| `runCommand(cmd, opts)` | Parse args and run command/sub-commands; access `result` from return value |
|
|
216
|
+
| `parseArgs(rawArgs, argsDef)` | Parse input arguments and apply defaults |
|
|
217
|
+
| `renderUsage(cmd, parent?)` | Render command usage to a string |
|
|
218
|
+
| `showUsage(cmd, parent?)` | Render usage and print to console |
|
|
219
|
+
| `defineCittyPlugin(def)` | Type helper for defining plugins |
|
|
104
220
|
|
|
105
221
|
## Development
|
|
106
222
|
|
|
@@ -113,22 +229,3 @@ Renders usage and prints to the console
|
|
|
113
229
|
## License
|
|
114
230
|
|
|
115
231
|
Made with 💛 Published under [MIT License](./LICENSE).
|
|
116
|
-
|
|
117
|
-
Argument parser is based on [lukeed/mri](https://github.com/lukeed/mri) by Luke Edwards ([@lukeed](https://github.com/lukeed)).
|
|
118
|
-
|
|
119
|
-
<!-- Badges -->
|
|
120
|
-
|
|
121
|
-
<!-- Badges -->
|
|
122
|
-
|
|
123
|
-
[npm-version-src]: https://img.shields.io/npm/v/citty?style=flat&colorA=18181B&colorB=F0DB4F
|
|
124
|
-
[npm-version-href]: https://npmjs.com/package/citty
|
|
125
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/citty?style=flat&colorA=18181B&colorB=F0DB4F
|
|
126
|
-
[npm-downloads-href]: https://npmjs.com/package/citty
|
|
127
|
-
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/citty/main?style=flat&colorA=18181B&colorB=F0DB4F
|
|
128
|
-
[codecov-href]: https://codecov.io/gh/unjs/citty
|
|
129
|
-
[bundle-src]: https://img.shields.io/bundlephobia/minzip/citty?style=flat&colorA=18181B&colorB=F0DB4F
|
|
130
|
-
[bundle-href]: https://bundlephobia.com/result?p=citty
|
|
131
|
-
[license-src]: https://img.shields.io/github/license/unjs/citty.svg?style=flat&colorA=18181B&colorB=F0DB4F
|
|
132
|
-
[license-href]: https://github.com/unjs/citty/blob/main/LICENSE
|
|
133
|
-
[jsdocs-src]: https://img.shields.io/badge/jsDocs.io-reference-18181B?style=flat&colorA=18181B&colorB=F0DB4F
|
|
134
|
-
[jsdocs-href]: https://www.jsdocs.io/package/citty
|
|
@@ -1,80 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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[];
|
|
9
11
|
};
|
|
10
|
-
type BooleanArgDef = _ArgDef<"boolean", boolean
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type
|
|
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;
|
|
14
19
|
type ArgsDef = Record<string, ArgDef>;
|
|
15
20
|
type Arg = ArgDef & {
|
|
16
|
-
|
|
17
|
-
|
|
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[];
|
|
18
43
|
};
|
|
19
|
-
type
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}[keyof T], string> & Record<{
|
|
26
|
-
[K in keyof T]: T[K] extends {
|
|
27
|
-
type: "string";
|
|
28
|
-
} ? K : never;
|
|
29
|
-
}[keyof T], string> & Record<{
|
|
30
|
-
[K in keyof T]: T[K] extends {
|
|
31
|
-
type: "boolean";
|
|
32
|
-
} ? K : never;
|
|
33
|
-
}[keyof T], boolean> & Record<string, string | boolean | string[]>;
|
|
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[]>;
|
|
34
50
|
interface CommandMeta {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
name?: string;
|
|
52
|
+
version?: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
hidden?: boolean;
|
|
55
|
+
alias?: string | string[];
|
|
38
56
|
}
|
|
39
57
|
type SubCommandsDef = Record<string, Resolvable<CommandDef<any>>>;
|
|
40
58
|
type CommandDef<T extends ArgsDef = ArgsDef> = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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>;
|
|
47
67
|
};
|
|
48
68
|
type CommandContext<T extends ArgsDef = ArgsDef> = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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>;
|
|
54
79
|
};
|
|
55
80
|
type Awaitable<T> = () => T | Promise<T>;
|
|
56
81
|
type Resolvable<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
|
|
57
|
-
|
|
58
|
-
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/command.d.ts
|
|
84
|
+
declare function defineCommand<const T extends ArgsDef = ArgsDef>(def: CommandDef<T>): CommandDef<T>;
|
|
59
85
|
interface RunCommandOptions {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
86
|
+
rawArgs: string[];
|
|
87
|
+
data?: any;
|
|
88
|
+
showUsage?: boolean;
|
|
63
89
|
}
|
|
64
90
|
declare function runCommand<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, opts: RunCommandOptions): Promise<{
|
|
65
|
-
|
|
91
|
+
result: unknown;
|
|
66
92
|
}>;
|
|
67
|
-
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/usage.d.ts
|
|
68
95
|
declare function showUsage<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, parent?: CommandDef<T>): Promise<void>;
|
|
69
96
|
declare function renderUsage<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, parent?: CommandDef<T>): Promise<string>;
|
|
70
|
-
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/main.d.ts
|
|
71
99
|
interface RunMainOptions {
|
|
72
|
-
|
|
73
|
-
|
|
100
|
+
rawArgs?: string[];
|
|
101
|
+
showUsage?: typeof showUsage;
|
|
74
102
|
}
|
|
75
103
|
declare function runMain<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>, opts?: RunMainOptions): Promise<void>;
|
|
76
104
|
declare function createMain<T extends ArgsDef = ArgsDef>(cmd: CommandDef<T>): (opts?: RunMainOptions) => Promise<void>;
|
|
77
|
-
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/args.d.ts
|
|
78
107
|
declare function parseArgs<T extends ArgsDef = ArgsDef>(rawArgs: string[], argsDef: ArgsDef): ParsedArgs<T>;
|
|
79
|
-
|
|
80
|
-
|
|
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 };
|