@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,517 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const LogLevels = {
|
|
4
|
-
silent: Number.NEGATIVE_INFINITY,
|
|
5
|
-
fatal: 0,
|
|
6
|
-
error: 0,
|
|
7
|
-
warn: 1,
|
|
8
|
-
log: 2,
|
|
9
|
-
info: 3,
|
|
10
|
-
success: 3,
|
|
11
|
-
fail: 3,
|
|
12
|
-
ready: 3,
|
|
13
|
-
start: 3,
|
|
14
|
-
box: 3,
|
|
15
|
-
debug: 4,
|
|
16
|
-
trace: 5,
|
|
17
|
-
verbose: Number.POSITIVE_INFINITY
|
|
18
|
-
};
|
|
19
|
-
const LogTypes = {
|
|
20
|
-
// Silent
|
|
21
|
-
silent: {
|
|
22
|
-
level: -1
|
|
23
|
-
},
|
|
24
|
-
// Level 0
|
|
25
|
-
fatal: {
|
|
26
|
-
level: LogLevels.fatal
|
|
27
|
-
},
|
|
28
|
-
error: {
|
|
29
|
-
level: LogLevels.error
|
|
30
|
-
},
|
|
31
|
-
// Level 1
|
|
32
|
-
warn: {
|
|
33
|
-
level: LogLevels.warn
|
|
34
|
-
},
|
|
35
|
-
// Level 2
|
|
36
|
-
log: {
|
|
37
|
-
level: LogLevels.log
|
|
38
|
-
},
|
|
39
|
-
// Level 3
|
|
40
|
-
info: {
|
|
41
|
-
level: LogLevels.info
|
|
42
|
-
},
|
|
43
|
-
success: {
|
|
44
|
-
level: LogLevels.success
|
|
45
|
-
},
|
|
46
|
-
fail: {
|
|
47
|
-
level: LogLevels.fail
|
|
48
|
-
},
|
|
49
|
-
ready: {
|
|
50
|
-
level: LogLevels.info
|
|
51
|
-
},
|
|
52
|
-
start: {
|
|
53
|
-
level: LogLevels.info
|
|
54
|
-
},
|
|
55
|
-
box: {
|
|
56
|
-
level: LogLevels.info
|
|
57
|
-
},
|
|
58
|
-
// Level 4
|
|
59
|
-
debug: {
|
|
60
|
-
level: LogLevels.debug
|
|
61
|
-
},
|
|
62
|
-
// Level 5
|
|
63
|
-
trace: {
|
|
64
|
-
level: LogLevels.trace
|
|
65
|
-
},
|
|
66
|
-
// Verbose
|
|
67
|
-
verbose: {
|
|
68
|
-
level: LogLevels.verbose
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
function isPlainObject$1(value) {
|
|
73
|
-
if (value === null || typeof value !== "object") {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
const prototype = Object.getPrototypeOf(value);
|
|
77
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
if (Symbol.iterator in value) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
if (Symbol.toStringTag in value) {
|
|
84
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
85
|
-
}
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
90
|
-
if (!isPlainObject$1(defaults)) {
|
|
91
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
92
|
-
}
|
|
93
|
-
const object = Object.assign({}, defaults);
|
|
94
|
-
for (const key in baseObject) {
|
|
95
|
-
if (key === "__proto__" || key === "constructor") {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
const value = baseObject[key];
|
|
99
|
-
if (value === null || value === void 0) {
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
106
|
-
object[key] = [...value, ...object[key]];
|
|
107
|
-
} else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
|
|
108
|
-
object[key] = _defu(
|
|
109
|
-
value,
|
|
110
|
-
object[key],
|
|
111
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
112
|
-
merger
|
|
113
|
-
);
|
|
114
|
-
} else {
|
|
115
|
-
object[key] = value;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return object;
|
|
119
|
-
}
|
|
120
|
-
function createDefu(merger) {
|
|
121
|
-
return (...arguments_) => (
|
|
122
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
123
|
-
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
const defu = createDefu();
|
|
127
|
-
|
|
128
|
-
function isPlainObject(obj) {
|
|
129
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
130
|
-
}
|
|
131
|
-
function isLogObj(arg) {
|
|
132
|
-
if (!isPlainObject(arg)) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
if (!arg.message && !arg.args) {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
if (arg.stack) {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
let paused = false;
|
|
145
|
-
const queue = [];
|
|
146
|
-
class Consola {
|
|
147
|
-
options;
|
|
148
|
-
_lastLog;
|
|
149
|
-
_mockFn;
|
|
150
|
-
/**
|
|
151
|
-
* Creates an instance of Consola with specified options or defaults.
|
|
152
|
-
*
|
|
153
|
-
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
154
|
-
*/
|
|
155
|
-
constructor(options = {}) {
|
|
156
|
-
const types = options.types || LogTypes;
|
|
157
|
-
this.options = defu(
|
|
158
|
-
{
|
|
159
|
-
...options,
|
|
160
|
-
defaults: { ...options.defaults },
|
|
161
|
-
level: _normalizeLogLevel(options.level, types),
|
|
162
|
-
reporters: [...options.reporters || []]
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
types: LogTypes,
|
|
166
|
-
throttle: 1e3,
|
|
167
|
-
throttleMin: 5,
|
|
168
|
-
formatOptions: {
|
|
169
|
-
date: true,
|
|
170
|
-
colors: false,
|
|
171
|
-
compact: true
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
);
|
|
175
|
-
for (const type in types) {
|
|
176
|
-
const defaults = {
|
|
177
|
-
type,
|
|
178
|
-
...this.options.defaults,
|
|
179
|
-
...types[type]
|
|
180
|
-
};
|
|
181
|
-
this[type] = this._wrapLogFn(defaults);
|
|
182
|
-
this[type].raw = this._wrapLogFn(
|
|
183
|
-
defaults,
|
|
184
|
-
true
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
if (this.options.mockFn) {
|
|
188
|
-
this.mockTypes();
|
|
189
|
-
}
|
|
190
|
-
this._lastLog = {};
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Gets the current log level of the Consola instance.
|
|
194
|
-
*
|
|
195
|
-
* @returns {number} The current log level.
|
|
196
|
-
*/
|
|
197
|
-
get level() {
|
|
198
|
-
return this.options.level;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Sets the minimum log level that will be output by the instance.
|
|
202
|
-
*
|
|
203
|
-
* @param {number} level - The new log level to set.
|
|
204
|
-
*/
|
|
205
|
-
set level(level) {
|
|
206
|
-
this.options.level = _normalizeLogLevel(
|
|
207
|
-
level,
|
|
208
|
-
this.options.types,
|
|
209
|
-
this.options.level
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Displays a prompt to the user and returns the response.
|
|
214
|
-
* Throw an error if `prompt` is not supported by the current configuration.
|
|
215
|
-
*
|
|
216
|
-
* @template T
|
|
217
|
-
* @param {string} message - The message to display in the prompt.
|
|
218
|
-
* @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
|
|
219
|
-
* @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
|
|
220
|
-
*/
|
|
221
|
-
prompt(message, opts) {
|
|
222
|
-
if (!this.options.prompt) {
|
|
223
|
-
throw new Error("prompt is not supported!");
|
|
224
|
-
}
|
|
225
|
-
return this.options.prompt(message, opts);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
|
|
229
|
-
*
|
|
230
|
-
* @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
|
|
231
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
232
|
-
*/
|
|
233
|
-
create(options) {
|
|
234
|
-
const instance = new Consola({
|
|
235
|
-
...this.options,
|
|
236
|
-
...options
|
|
237
|
-
});
|
|
238
|
-
if (this._mockFn) {
|
|
239
|
-
instance.mockTypes(this._mockFn);
|
|
240
|
-
}
|
|
241
|
-
return instance;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Creates a new Consola instance with the specified default log object properties.
|
|
245
|
-
*
|
|
246
|
-
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
247
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
248
|
-
*/
|
|
249
|
-
withDefaults(defaults) {
|
|
250
|
-
return this.create({
|
|
251
|
-
...this.options,
|
|
252
|
-
defaults: {
|
|
253
|
-
...this.options.defaults,
|
|
254
|
-
...defaults
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Creates a new Consola instance with a specified tag, which will be included in every log.
|
|
260
|
-
*
|
|
261
|
-
* @param {string} tag - The tag to include in each log of the new instance.
|
|
262
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
263
|
-
*/
|
|
264
|
-
withTag(tag) {
|
|
265
|
-
return this.withDefaults({
|
|
266
|
-
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Adds a custom reporter to the Consola instance.
|
|
271
|
-
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
272
|
-
*
|
|
273
|
-
* @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
|
|
274
|
-
* @returns {Consola} The current Consola instance.
|
|
275
|
-
*/
|
|
276
|
-
addReporter(reporter) {
|
|
277
|
-
this.options.reporters.push(reporter);
|
|
278
|
-
return this;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Removes a custom reporter from the Consola instance.
|
|
282
|
-
* If no reporter is specified, all reporters will be removed.
|
|
283
|
-
*
|
|
284
|
-
* @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
|
|
285
|
-
* @returns {Consola} The current Consola instance.
|
|
286
|
-
*/
|
|
287
|
-
removeReporter(reporter) {
|
|
288
|
-
if (reporter) {
|
|
289
|
-
const i = this.options.reporters.indexOf(reporter);
|
|
290
|
-
if (i !== -1) {
|
|
291
|
-
return this.options.reporters.splice(i, 1);
|
|
292
|
-
}
|
|
293
|
-
} else {
|
|
294
|
-
this.options.reporters.splice(0);
|
|
295
|
-
}
|
|
296
|
-
return this;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Replaces all reporters of the Consola instance with the specified array of reporters.
|
|
300
|
-
*
|
|
301
|
-
* @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
|
|
302
|
-
* @returns {Consola} The current Consola instance.
|
|
303
|
-
*/
|
|
304
|
-
setReporters(reporters) {
|
|
305
|
-
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
306
|
-
return this;
|
|
307
|
-
}
|
|
308
|
-
wrapAll() {
|
|
309
|
-
this.wrapConsole();
|
|
310
|
-
this.wrapStd();
|
|
311
|
-
}
|
|
312
|
-
restoreAll() {
|
|
313
|
-
this.restoreConsole();
|
|
314
|
-
this.restoreStd();
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Overrides console methods with Consola logging methods for consistent logging.
|
|
318
|
-
*/
|
|
319
|
-
wrapConsole() {
|
|
320
|
-
for (const type in this.options.types) {
|
|
321
|
-
if (!console["__" + type]) {
|
|
322
|
-
console["__" + type] = console[type];
|
|
323
|
-
}
|
|
324
|
-
console[type] = this[type].raw;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Restores the original console methods, removing Consola overrides.
|
|
329
|
-
*/
|
|
330
|
-
restoreConsole() {
|
|
331
|
-
for (const type in this.options.types) {
|
|
332
|
-
if (console["__" + type]) {
|
|
333
|
-
console[type] = console["__" + type];
|
|
334
|
-
delete console["__" + type];
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Overrides standard output and error streams to redirect them through Consola.
|
|
340
|
-
*/
|
|
341
|
-
wrapStd() {
|
|
342
|
-
this._wrapStream(this.options.stdout, "log");
|
|
343
|
-
this._wrapStream(this.options.stderr, "log");
|
|
344
|
-
}
|
|
345
|
-
_wrapStream(stream, type) {
|
|
346
|
-
if (!stream) {
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
if (!stream.__write) {
|
|
350
|
-
stream.__write = stream.write;
|
|
351
|
-
}
|
|
352
|
-
stream.write = (data) => {
|
|
353
|
-
this[type].raw(String(data).trim());
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Restores the original standard output and error streams, removing the Consola redirection.
|
|
358
|
-
*/
|
|
359
|
-
restoreStd() {
|
|
360
|
-
this._restoreStream(this.options.stdout);
|
|
361
|
-
this._restoreStream(this.options.stderr);
|
|
362
|
-
}
|
|
363
|
-
_restoreStream(stream) {
|
|
364
|
-
if (!stream) {
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
if (stream.__write) {
|
|
368
|
-
stream.write = stream.__write;
|
|
369
|
-
delete stream.__write;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Pauses logging, queues incoming logs until resumed.
|
|
374
|
-
*/
|
|
375
|
-
pauseLogs() {
|
|
376
|
-
paused = true;
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Resumes logging, processing any queued logs.
|
|
380
|
-
*/
|
|
381
|
-
resumeLogs() {
|
|
382
|
-
paused = false;
|
|
383
|
-
const _queue = queue.splice(0);
|
|
384
|
-
for (const item of _queue) {
|
|
385
|
-
item[0]._logFn(item[1], item[2]);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Replaces logging methods with mocks if a mock function is provided.
|
|
390
|
-
*
|
|
391
|
-
* @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
|
|
392
|
-
*/
|
|
393
|
-
mockTypes(mockFn) {
|
|
394
|
-
const _mockFn = mockFn || this.options.mockFn;
|
|
395
|
-
this._mockFn = _mockFn;
|
|
396
|
-
if (typeof _mockFn !== "function") {
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
for (const type in this.options.types) {
|
|
400
|
-
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
401
|
-
this[type].raw = this[type];
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
_wrapLogFn(defaults, isRaw) {
|
|
405
|
-
return (...args) => {
|
|
406
|
-
if (paused) {
|
|
407
|
-
queue.push([this, defaults, args, isRaw]);
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
return this._logFn(defaults, args, isRaw);
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
_logFn(defaults, args, isRaw) {
|
|
414
|
-
if ((defaults.level || 0) > this.level) {
|
|
415
|
-
return false;
|
|
416
|
-
}
|
|
417
|
-
const logObj = {
|
|
418
|
-
date: /* @__PURE__ */ new Date(),
|
|
419
|
-
args: [],
|
|
420
|
-
...defaults,
|
|
421
|
-
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
422
|
-
};
|
|
423
|
-
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
424
|
-
Object.assign(logObj, args[0]);
|
|
425
|
-
} else {
|
|
426
|
-
logObj.args = [...args];
|
|
427
|
-
}
|
|
428
|
-
if (logObj.message) {
|
|
429
|
-
logObj.args.unshift(logObj.message);
|
|
430
|
-
delete logObj.message;
|
|
431
|
-
}
|
|
432
|
-
if (logObj.additional) {
|
|
433
|
-
if (!Array.isArray(logObj.additional)) {
|
|
434
|
-
logObj.additional = logObj.additional.split("\n");
|
|
435
|
-
}
|
|
436
|
-
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
437
|
-
delete logObj.additional;
|
|
438
|
-
}
|
|
439
|
-
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
440
|
-
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
441
|
-
const resolveLog = (newLog = false) => {
|
|
442
|
-
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
443
|
-
if (this._lastLog.object && repeated > 0) {
|
|
444
|
-
const args2 = [...this._lastLog.object.args];
|
|
445
|
-
if (repeated > 1) {
|
|
446
|
-
args2.push(`(repeated ${repeated} times)`);
|
|
447
|
-
}
|
|
448
|
-
this._log({ ...this._lastLog.object, args: args2 });
|
|
449
|
-
this._lastLog.count = 1;
|
|
450
|
-
}
|
|
451
|
-
if (newLog) {
|
|
452
|
-
this._lastLog.object = logObj;
|
|
453
|
-
this._log(logObj);
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
clearTimeout(this._lastLog.timeout);
|
|
457
|
-
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
458
|
-
this._lastLog.time = logObj.date;
|
|
459
|
-
if (diffTime < this.options.throttle) {
|
|
460
|
-
try {
|
|
461
|
-
const serializedLog = JSON.stringify([
|
|
462
|
-
logObj.type,
|
|
463
|
-
logObj.tag,
|
|
464
|
-
logObj.args
|
|
465
|
-
]);
|
|
466
|
-
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
467
|
-
this._lastLog.serialized = serializedLog;
|
|
468
|
-
if (isSameLog) {
|
|
469
|
-
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
470
|
-
if (this._lastLog.count > this.options.throttleMin) {
|
|
471
|
-
this._lastLog.timeout = setTimeout(
|
|
472
|
-
resolveLog,
|
|
473
|
-
this.options.throttle
|
|
474
|
-
);
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
} catch {
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
resolveLog(true);
|
|
482
|
-
}
|
|
483
|
-
_log(logObj) {
|
|
484
|
-
for (const reporter of this.options.reporters) {
|
|
485
|
-
reporter.log(logObj, {
|
|
486
|
-
options: this.options
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
492
|
-
if (input === void 0) {
|
|
493
|
-
return defaultLevel;
|
|
494
|
-
}
|
|
495
|
-
if (typeof input === "number") {
|
|
496
|
-
return input;
|
|
497
|
-
}
|
|
498
|
-
if (types[input] && types[input].level !== void 0) {
|
|
499
|
-
return types[input].level;
|
|
500
|
-
}
|
|
501
|
-
return defaultLevel;
|
|
502
|
-
}
|
|
503
|
-
Consola.prototype.add = Consola.prototype.addReporter;
|
|
504
|
-
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
505
|
-
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
506
|
-
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
507
|
-
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
508
|
-
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
509
|
-
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
510
|
-
function createConsola(options = {}) {
|
|
511
|
-
return new Consola(options);
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
exports.Consola = Consola;
|
|
515
|
-
exports.LogLevels = LogLevels;
|
|
516
|
-
exports.LogTypes = LogTypes;
|
|
517
|
-
exports.createConsola = createConsola;
|