@maizzle/framework 6.0.0-rc.0 → 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 +29 -9
- 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 +25 -1
- 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 +10 -3
- package/dist/render/createRenderer.d.mts.map +1 -1
- package/dist/render/createRenderer.mjs +147 -10
- package/dist/render/createRenderer.mjs.map +1 -1
- package/dist/render/index.mjs +9 -3
- package/dist/render/index.mjs.map +1 -1
- package/dist/serve.d.mts.map +1 -1
- package/dist/serve.mjs +159 -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 +459 -17
- 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 +0,0 @@
|
|
|
1
|
-
var t=Object.defineProperty;var o=(e,l)=>t(e,"name",{value:l,configurable:!0});var n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}o(f,"getDefaultExportFromCjs");export{n as c,f as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var o=(e,t)=>l(e,"name",{value:t,configurable:!0});var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}o(getDefaultExportFromCjs,"getDefaultExportFromCjs"),exports.commonjsGlobal=commonjsGlobal,exports.getDefaultExportFromCjs=getDefaultExportFromCjs;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./lib/index";
|
|
File without changes
|
|
File without changes
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const fetch: typeof globalThis.fetch;
|
|
2
|
-
export declare const Blob: typeof globalThis.Blob;
|
|
3
|
-
export declare const File: typeof globalThis.File;
|
|
4
|
-
export declare const FormData: typeof globalThis.FormData;
|
|
5
|
-
export declare const Headers: typeof globalThis.Headers;
|
|
6
|
-
export declare const Request: typeof globalThis.Request;
|
|
7
|
-
export declare const Response: typeof globalThis.Response;
|
|
8
|
-
export declare const AbortController: typeof globalThis.AbortController;
|
|
9
|
-
|
|
10
|
-
export default fetch;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const fetch: typeof globalThis.fetch;
|
|
2
|
-
export declare const Blob: typeof globalThis.Blob;
|
|
3
|
-
export declare const File: typeof globalThis.File;
|
|
4
|
-
export declare const FormData: typeof globalThis.FormData;
|
|
5
|
-
export declare const Headers: typeof globalThis.Headers;
|
|
6
|
-
export declare const Request: typeof globalThis.Request;
|
|
7
|
-
export declare const Response: typeof globalThis.Response;
|
|
8
|
-
export declare const AbortController: typeof globalThis.AbortController;
|
|
9
|
-
|
|
10
|
-
export default fetch;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const fetch: typeof globalThis.fetch;
|
|
2
|
-
export declare const Blob: typeof globalThis.Blob;
|
|
3
|
-
export declare const File: typeof globalThis.File;
|
|
4
|
-
export declare const FormData: typeof globalThis.FormData;
|
|
5
|
-
export declare const Headers: typeof globalThis.Headers;
|
|
6
|
-
export declare const Request: typeof globalThis.Request;
|
|
7
|
-
export declare const Response: typeof globalThis.Response;
|
|
8
|
-
export declare const AbortController: typeof globalThis.AbortController;
|
|
9
|
-
|
|
10
|
-
export default fetch;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type * as http from "node:http";
|
|
2
|
-
import type * as https from "node:https";
|
|
3
|
-
import type * as undici from "undici";
|
|
4
|
-
|
|
5
|
-
export type ProxyOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* HTTP(s) Proxy URL
|
|
8
|
-
*
|
|
9
|
-
* Default is read from `https_proxy`, `http_proxy`, `HTTPS_PROXY` or `HTTP_PROXY` environment variables
|
|
10
|
-
* */
|
|
11
|
-
url?: string;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* List of hosts to skip proxy for (comma separated or array of strings)
|
|
15
|
-
*
|
|
16
|
-
* Default is read from `no_proxy` or `NO_PROXY` environment variables
|
|
17
|
-
*
|
|
18
|
-
* Hots starting with a leading dot, like `.foo.com` are also matched against domain and all its subdomains like `bar.foo.com`
|
|
19
|
-
*/
|
|
20
|
-
noProxy?: string | string[];
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export declare const createProxy: (opts?: ProxyOptions) => {
|
|
24
|
-
agent: http.Agent | https.Agent | undefined;
|
|
25
|
-
dispatcher: undici.Dispatcher | undefined;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export declare const createFetch: (
|
|
29
|
-
proxyOptions?: ProxyOptions,
|
|
30
|
-
) => typeof globalThis.fetch;
|
|
31
|
-
|
|
32
|
-
export declare const fetch: typeof globalThis.fetch;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./lib/index";
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "node-fetch-native",
|
|
3
|
-
"version": "1.6.7",
|
|
4
|
-
"description": "better fetch for Node.js. Works on any JavaScript runtime!",
|
|
5
|
-
"repository": "unjs/node-fetch-native",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"browser": "./dist/native.mjs",
|
|
11
|
-
"bun": "./dist/native.mjs",
|
|
12
|
-
"deno": "./dist/native.mjs",
|
|
13
|
-
"edge-light": "./dist/native.mjs",
|
|
14
|
-
"edge-routine": "./dist/native.mjs",
|
|
15
|
-
"lagon": "./dist/native.mjs",
|
|
16
|
-
"netlify": "./dist/native.mjs",
|
|
17
|
-
"react-native": "./dist/native.mjs",
|
|
18
|
-
"wintercg": "./dist/native.mjs",
|
|
19
|
-
"worker": "./dist/native.mjs",
|
|
20
|
-
"workerd": "./dist/native.mjs",
|
|
21
|
-
"node": {
|
|
22
|
-
"import": {
|
|
23
|
-
"types": "./lib/index.d.mts",
|
|
24
|
-
"default": "./dist/index.mjs"
|
|
25
|
-
},
|
|
26
|
-
"require": {
|
|
27
|
-
"types": "./lib/index.d.cts",
|
|
28
|
-
"default": "./lib/index.cjs"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"types": "./lib/index.d.mts",
|
|
32
|
-
"import": "./dist/native.mjs",
|
|
33
|
-
"require": "./dist/native.cjs",
|
|
34
|
-
"default": "./dist/native.mjs"
|
|
35
|
-
},
|
|
36
|
-
"./polyfill": {
|
|
37
|
-
"node": {
|
|
38
|
-
"import": {
|
|
39
|
-
"types": "./lib/polyfill.d.mts",
|
|
40
|
-
"default": "./dist/polyfill.mjs"
|
|
41
|
-
},
|
|
42
|
-
"require": {
|
|
43
|
-
"types": "./lib/polyfill.d.cts",
|
|
44
|
-
"default": "./dist/polyfill.cjs"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"types": "./lib/polyfill.d.mts",
|
|
48
|
-
"import": "./lib/empty.mjs",
|
|
49
|
-
"require": "./lib/empty.cjs",
|
|
50
|
-
"default": "./lib/empty.mjs"
|
|
51
|
-
},
|
|
52
|
-
"./node": {
|
|
53
|
-
"import": {
|
|
54
|
-
"types": "./lib/index.d.mts",
|
|
55
|
-
"default": "./dist/node.mjs"
|
|
56
|
-
},
|
|
57
|
-
"require": {
|
|
58
|
-
"types": "./lib/index.d.cts",
|
|
59
|
-
"default": "./dist/node.cjs"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"./native": {
|
|
63
|
-
"import": {
|
|
64
|
-
"types": "./lib/index.d.mts",
|
|
65
|
-
"default": "./dist/native.mjs"
|
|
66
|
-
},
|
|
67
|
-
"require": {
|
|
68
|
-
"types": "./lib/index.d.cts",
|
|
69
|
-
"default": "./lib/native.cjs"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
"./src/index.js": {
|
|
73
|
-
"import": {
|
|
74
|
-
"types": "./lib/index.d.mts",
|
|
75
|
-
"default": "./dist/index.mjs"
|
|
76
|
-
},
|
|
77
|
-
"require": {
|
|
78
|
-
"types": "./lib/index.d.cts",
|
|
79
|
-
"default": "./lib/index.cjs"
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"./proxy": {
|
|
83
|
-
"node": {
|
|
84
|
-
"types": "./lib/proxy.d.ts",
|
|
85
|
-
"default": "./dist/proxy.cjs"
|
|
86
|
-
},
|
|
87
|
-
"default": {
|
|
88
|
-
"import": {
|
|
89
|
-
"types": "./lib/proxy.d.ts",
|
|
90
|
-
"default": "./dist/proxy-stub.mjs"
|
|
91
|
-
},
|
|
92
|
-
"require": {
|
|
93
|
-
"types": "./lib/proxy.d.ts",
|
|
94
|
-
"default": "./dist/proxy-stub.cjs"
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"main": "./lib/index.cjs",
|
|
100
|
-
"module": "./dist/index.mjs",
|
|
101
|
-
"react-native": "./dist/native.mjs",
|
|
102
|
-
"types": "./lib/index.d.mts",
|
|
103
|
-
"files": [
|
|
104
|
-
"dist",
|
|
105
|
-
"lib",
|
|
106
|
-
"index.d.ts",
|
|
107
|
-
"node.d.ts",
|
|
108
|
-
"polyfill.d.ts",
|
|
109
|
-
"proxy.d.ts"
|
|
110
|
-
],
|
|
111
|
-
"scripts": {
|
|
112
|
-
"build": "unbuild",
|
|
113
|
-
"lint": "eslint . && prettier -c src test lib",
|
|
114
|
-
"lint:fix": "eslint --fix . && prettier -w src test lib",
|
|
115
|
-
"prepack": "unbuild",
|
|
116
|
-
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
|
|
117
|
-
"test": "pnpm lint && pnpm build && vitest run --coverage"
|
|
118
|
-
},
|
|
119
|
-
"devDependencies": {
|
|
120
|
-
"@types/node": "^24.1.0",
|
|
121
|
-
"@vitest/coverage-v8": "^3.2.4",
|
|
122
|
-
"abort-controller": "^3.0.0",
|
|
123
|
-
"agent-base": "^7.1.4",
|
|
124
|
-
"changelogen": "^0.6.2",
|
|
125
|
-
"eslint": "^9.32.0",
|
|
126
|
-
"eslint-config-unjs": "^0.5.0",
|
|
127
|
-
"http-proxy-agent": "^7.0.2",
|
|
128
|
-
"https-proxy-agent": "^7.0.6",
|
|
129
|
-
"node-fetch": "^3.3.2",
|
|
130
|
-
"prettier": "^3.6.2",
|
|
131
|
-
"proxy-agent": "^6.5.0",
|
|
132
|
-
"typescript": "^5.9.2",
|
|
133
|
-
"unbuild": "^3.6.0",
|
|
134
|
-
"undici": "^6.21.3",
|
|
135
|
-
"vitest": "^3.2.4"
|
|
136
|
-
},
|
|
137
|
-
"packageManager": "pnpm@10.14.0"
|
|
138
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./lib/proxy";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
# 🌆 citty
|
|
2
|
-
|
|
3
|
-
<!-- automd:badges color=yellow bundlephobia -->
|
|
4
|
-
|
|
5
|
-
[](https://npmjs.com/package/citty)
|
|
6
|
-
[](https://npmjs.com/package/citty)
|
|
7
|
-
[](https://bundlephobia.com/package/citty)
|
|
8
|
-
|
|
9
|
-
<!-- /automd -->
|
|
10
|
-
|
|
11
|
-
Elegant CLI Builder
|
|
12
|
-
|
|
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
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
npx nypm add -D citty
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
```js
|
|
25
|
-
import { defineCommand, runMain } from "citty";
|
|
26
|
-
|
|
27
|
-
const main = defineCommand({
|
|
28
|
-
meta: {
|
|
29
|
-
name: "hello",
|
|
30
|
-
version: "1.0.0",
|
|
31
|
-
description: "My Awesome CLI App",
|
|
32
|
-
},
|
|
33
|
-
args: {
|
|
34
|
-
name: {
|
|
35
|
-
type: "positional",
|
|
36
|
-
description: "Your name",
|
|
37
|
-
required: true,
|
|
38
|
-
},
|
|
39
|
-
friendly: {
|
|
40
|
-
type: "boolean",
|
|
41
|
-
description: "Use friendly greeting",
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
setup({ args }) {
|
|
45
|
-
console.log(`now setup ${args.command}`);
|
|
46
|
-
},
|
|
47
|
-
cleanup({ args }) {
|
|
48
|
-
console.log(`now cleanup ${args.command}`);
|
|
49
|
-
},
|
|
50
|
-
run({ args }) {
|
|
51
|
-
console.log(`${args.friendly ? "Hi" : "Greetings"} ${args.name}!`);
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
runMain(main);
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
```sh
|
|
59
|
-
node index.mjs john
|
|
60
|
-
# Greetings john!
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Sub Commands
|
|
64
|
-
|
|
65
|
-
Sub commands can be nested recursively. Use lazy imports for large CLIs to avoid loading all commands at once.
|
|
66
|
-
|
|
67
|
-
```js
|
|
68
|
-
import { defineCommand, runMain } from "citty";
|
|
69
|
-
|
|
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
|
-
});
|
|
79
|
-
|
|
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
|
-
```
|
|
87
|
-
|
|
88
|
-
Subcommands support `meta.alias` (e.g., `["i", "add"]`) and `meta.hidden: true` to hide from help output.
|
|
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
|
-
```
|
|
102
|
-
|
|
103
|
-
`meta`, `args`, and `subCommands` all accept `Resolvable<T>` values — a value, Promise, function, or async function — enabling lazy and dynamic resolution.
|
|
104
|
-
|
|
105
|
-
### Hooks
|
|
106
|
-
|
|
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.
|
|
108
|
-
|
|
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
|
-
```
|
|
123
|
-
|
|
124
|
-
### Plugins
|
|
125
|
-
|
|
126
|
-
Plugins extend commands with reusable `setup` and `cleanup` hooks:
|
|
127
|
-
|
|
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 |
|
|
220
|
-
|
|
221
|
-
## Development
|
|
222
|
-
|
|
223
|
-
- Clone this repository
|
|
224
|
-
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
|
|
225
|
-
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
|
|
226
|
-
- Install dependencies using `pnpm install`
|
|
227
|
-
- Run interactive tests using `pnpm dev`
|
|
228
|
-
|
|
229
|
-
## License
|
|
230
|
-
|
|
231
|
-
Made with 💛 Published under [MIT License](./LICENSE).
|
|
@@ -1,112 +0,0 @@
|
|
|
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 };
|