@maizzle/framework 6.0.0-9 → 6.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/maizzle.mjs +10 -0
- package/dist/build.d.mts +19 -0
- package/dist/build.d.mts.map +1 -0
- package/dist/build.mjs +121 -0
- package/dist/build.mjs.map +1 -0
- package/dist/components/Button.vue +141 -0
- package/dist/components/Divider.vue +105 -0
- package/dist/components/NoWidows.vue +123 -0
- package/dist/components/NotOutlook.vue +17 -0
- package/dist/components/Outlook.vue +74 -0
- package/dist/components/Spacer.vue +36 -0
- package/dist/components/Vml.vue +89 -0
- package/dist/components/WithUrl.vue +190 -0
- package/dist/components/utils.d.mts +5 -0
- package/dist/components/utils.d.mts.map +1 -0
- package/dist/components/utils.mjs +9 -0
- package/dist/components/utils.mjs.map +1 -0
- package/dist/components/utils.ts +6 -0
- package/dist/composables/defineConfig.d.mts +14 -0
- package/dist/composables/defineConfig.d.mts.map +1 -0
- package/dist/composables/defineConfig.mjs +34 -0
- package/dist/composables/defineConfig.mjs.map +1 -0
- package/dist/composables/renderContext.d.mts +19 -0
- package/dist/composables/renderContext.d.mts.map +1 -0
- package/dist/composables/renderContext.mjs +6 -0
- package/dist/composables/renderContext.mjs.map +1 -0
- package/dist/composables/useConfig.d.mts +9 -0
- package/dist/composables/useConfig.d.mts.map +1 -0
- package/dist/composables/useConfig.mjs +13 -0
- package/dist/composables/useConfig.mjs.map +1 -0
- package/dist/composables/useDoctype.d.mts +13 -0
- package/dist/composables/useDoctype.d.mts.map +1 -0
- package/dist/composables/useDoctype.mjs +20 -0
- package/dist/composables/useDoctype.mjs.map +1 -0
- package/dist/composables/useEvent.d.mts +17 -0
- package/dist/composables/useEvent.d.mts.map +1 -0
- package/dist/composables/useEvent.mjs +25 -0
- package/dist/composables/useEvent.mjs.map +1 -0
- package/dist/composables/usePlaintext.d.mts +19 -0
- package/dist/composables/usePlaintext.d.mts.map +1 -0
- package/dist/composables/usePlaintext.mjs +22 -0
- package/dist/composables/usePlaintext.mjs.map +1 -0
- package/dist/config/defaults.d.mts +6 -0
- package/dist/config/defaults.d.mts.map +1 -0
- package/dist/config/defaults.mjs +28 -0
- package/dist/config/defaults.mjs.map +1 -0
- package/dist/config/index.d.mts +15 -0
- package/dist/config/index.d.mts.map +1 -0
- package/dist/config/index.mjs +47 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/events/index.d.mts +91 -0
- package/dist/events/index.d.mts.map +1 -0
- package/dist/events/index.mjs +110 -0
- package/dist/events/index.mjs.map +1 -0
- package/dist/index.d.mts +29 -0
- package/dist/index.mjs +29 -0
- package/dist/plaintext.d.mts +5 -0
- package/dist/plaintext.d.mts.map +1 -0
- package/dist/plaintext.mjs +15 -0
- package/dist/plaintext.mjs.map +1 -0
- package/dist/plugin.d.mts +17 -0
- package/dist/plugin.d.mts.map +1 -0
- package/dist/plugin.mjs +41 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/plugins/postcss/mergeMediaQueries.d.mts +18 -0
- package/dist/plugins/postcss/mergeMediaQueries.d.mts.map +1 -0
- package/dist/plugins/postcss/mergeMediaQueries.mjs +22 -0
- package/dist/plugins/postcss/mergeMediaQueries.mjs.map +1 -0
- package/dist/plugins/postcss/pruneVars.d.mts +8 -0
- package/dist/plugins/postcss/pruneVars.d.mts.map +1 -0
- package/dist/plugins/postcss/pruneVars.mjs +49 -0
- package/dist/plugins/postcss/pruneVars.mjs.map +1 -0
- package/dist/plugins/postcss/removeDeclarations.d.mts +12 -0
- package/dist/plugins/postcss/removeDeclarations.d.mts.map +1 -0
- package/dist/plugins/postcss/removeDeclarations.mjs +45 -0
- package/dist/plugins/postcss/removeDeclarations.mjs.map +1 -0
- package/dist/plugins/postcss/tailwindCleanup.d.mts +18 -0
- package/dist/plugins/postcss/tailwindCleanup.d.mts.map +1 -0
- package/dist/plugins/postcss/tailwindCleanup.mjs +35 -0
- package/dist/plugins/postcss/tailwindCleanup.mjs.map +1 -0
- package/dist/render/createRenderer.d.mts +34 -0
- package/dist/render/createRenderer.d.mts.map +1 -0
- package/dist/render/createRenderer.mjs +149 -0
- package/dist/render/createRenderer.mjs.map +1 -0
- package/dist/render/index.d.mts +26 -0
- package/dist/render/index.d.mts.map +1 -0
- package/dist/render/index.mjs +40 -0
- package/dist/render/index.mjs.map +1 -0
- package/dist/serve.d.mts +25 -0
- package/dist/serve.d.mts.map +1 -0
- package/dist/serve.mjs +402 -0
- package/dist/serve.mjs.map +1 -0
- package/dist/server/compatibility.d.mts +6 -0
- package/dist/server/compatibility.d.mts.map +1 -0
- package/dist/server/compatibility.mjs +83 -0
- package/dist/server/compatibility.mjs.map +1 -0
- package/dist/server/linter.d.mts +6 -0
- package/dist/server/linter.d.mts.map +1 -0
- package/dist/server/linter.mjs +200 -0
- package/dist/server/linter.mjs.map +1 -0
- package/dist/server/ui/App.vue +360 -0
- package/dist/server/ui/components/ui/button/Button.vue +31 -0
- package/dist/server/ui/components/ui/button/index.ts +38 -0
- package/dist/server/ui/components/ui/command/Command.vue +87 -0
- package/dist/server/ui/components/ui/command/CommandDialog.vue +31 -0
- package/dist/server/ui/components/ui/command/CommandEmpty.vue +27 -0
- package/dist/server/ui/components/ui/command/CommandGroup.vue +45 -0
- package/dist/server/ui/components/ui/command/CommandInput.vue +39 -0
- package/dist/server/ui/components/ui/command/CommandItem.vue +76 -0
- package/dist/server/ui/components/ui/command/CommandList.vue +25 -0
- package/dist/server/ui/components/ui/command/CommandSeparator.vue +21 -0
- package/dist/server/ui/components/ui/command/CommandShortcut.vue +17 -0
- package/dist/server/ui/components/ui/command/index.ts +25 -0
- package/dist/server/ui/components/ui/dialog/Dialog.vue +19 -0
- package/dist/server/ui/components/ui/dialog/DialogClose.vue +15 -0
- package/dist/server/ui/components/ui/dialog/DialogContent.vue +53 -0
- package/dist/server/ui/components/ui/dialog/DialogDescription.vue +23 -0
- package/dist/server/ui/components/ui/dialog/DialogFooter.vue +27 -0
- package/dist/server/ui/components/ui/dialog/DialogHeader.vue +17 -0
- package/dist/server/ui/components/ui/dialog/DialogOverlay.vue +21 -0
- package/dist/server/ui/components/ui/dialog/DialogScrollContent.vue +59 -0
- package/dist/server/ui/components/ui/dialog/DialogTitle.vue +23 -0
- package/dist/server/ui/components/ui/dialog/DialogTrigger.vue +15 -0
- package/dist/server/ui/components/ui/dialog/index.ts +10 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenu.vue +19 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +39 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuContent.vue +39 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuGroup.vue +15 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuItem.vue +31 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuLabel.vue +23 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +40 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSeparator.vue +23 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuShortcut.vue +17 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSub.vue +18 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSubContent.vue +27 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +31 -0
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
- package/dist/server/ui/components/ui/dropdown-menu/index.ts +16 -0
- package/dist/server/ui/components/ui/empty/Empty.vue +20 -0
- package/dist/server/ui/components/ui/empty/EmptyContent.vue +20 -0
- package/dist/server/ui/components/ui/empty/EmptyDescription.vue +20 -0
- package/dist/server/ui/components/ui/empty/EmptyHeader.vue +20 -0
- package/dist/server/ui/components/ui/empty/EmptyMedia.vue +21 -0
- package/dist/server/ui/components/ui/empty/EmptyTitle.vue +17 -0
- package/dist/server/ui/components/ui/empty/index.ts +26 -0
- package/dist/server/ui/components/ui/input/Input.vue +33 -0
- package/dist/server/ui/components/ui/input/index.ts +1 -0
- package/dist/server/ui/components/ui/kbd/Kbd.vue +20 -0
- package/dist/server/ui/components/ui/kbd/KbdGroup.vue +17 -0
- package/dist/server/ui/components/ui/kbd/index.ts +2 -0
- package/dist/server/ui/components/ui/resizable/ResizableHandle.vue +30 -0
- package/dist/server/ui/components/ui/resizable/ResizablePanel.vue +21 -0
- package/dist/server/ui/components/ui/resizable/ResizablePanelGroup.vue +25 -0
- package/dist/server/ui/components/ui/resizable/index.ts +3 -0
- package/dist/server/ui/components/ui/scroll-area/ScrollArea.vue +33 -0
- package/dist/server/ui/components/ui/scroll-area/ScrollBar.vue +32 -0
- package/dist/server/ui/components/ui/scroll-area/index.ts +2 -0
- package/dist/server/ui/components/ui/separator/Separator.vue +29 -0
- package/dist/server/ui/components/ui/separator/index.ts +1 -0
- package/dist/server/ui/components/ui/sheet/Sheet.vue +19 -0
- package/dist/server/ui/components/ui/sheet/SheetClose.vue +15 -0
- package/dist/server/ui/components/ui/sheet/SheetContent.vue +62 -0
- package/dist/server/ui/components/ui/sheet/SheetDescription.vue +21 -0
- package/dist/server/ui/components/ui/sheet/SheetFooter.vue +16 -0
- package/dist/server/ui/components/ui/sheet/SheetHeader.vue +15 -0
- package/dist/server/ui/components/ui/sheet/SheetOverlay.vue +21 -0
- package/dist/server/ui/components/ui/sheet/SheetTitle.vue +21 -0
- package/dist/server/ui/components/ui/sheet/SheetTrigger.vue +15 -0
- package/dist/server/ui/components/ui/sheet/index.ts +8 -0
- package/dist/server/ui/components/ui/sidebar/Sidebar.vue +96 -0
- package/dist/server/ui/components/ui/sidebar/SidebarContent.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarFooter.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarGroup.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarGroupAction.vue +27 -0
- package/dist/server/ui/components/ui/sidebar/SidebarGroupContent.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarGroupLabel.vue +25 -0
- package/dist/server/ui/components/ui/sidebar/SidebarHeader.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarInput.vue +31 -0
- package/dist/server/ui/components/ui/sidebar/SidebarInset.vue +21 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenu.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuAction.vue +35 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuBadge.vue +26 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuButton.vue +48 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuButtonChild.vue +36 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuItem.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuSkeleton.vue +35 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuSub.vue +22 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuSubButton.vue +36 -0
- package/dist/server/ui/components/ui/sidebar/SidebarMenuSubItem.vue +18 -0
- package/dist/server/ui/components/ui/sidebar/SidebarProvider.vue +82 -0
- package/dist/server/ui/components/ui/sidebar/SidebarRail.vue +33 -0
- package/dist/server/ui/components/ui/sidebar/SidebarSeparator.vue +19 -0
- package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +28 -0
- package/dist/server/ui/components/ui/sidebar/index.ts +60 -0
- package/dist/server/ui/components/ui/sidebar/utils.ts +19 -0
- package/dist/server/ui/components/ui/skeleton/Skeleton.vue +17 -0
- package/dist/server/ui/components/ui/skeleton/index.ts +1 -0
- package/dist/server/ui/components/ui/tabs/Tabs.vue +24 -0
- package/dist/server/ui/components/ui/tabs/TabsContent.vue +21 -0
- package/dist/server/ui/components/ui/tabs/TabsList.vue +24 -0
- package/dist/server/ui/components/ui/tabs/TabsTrigger.vue +26 -0
- package/dist/server/ui/components/ui/tabs/index.ts +4 -0
- package/dist/server/ui/components/ui/toggle/Toggle.vue +35 -0
- package/dist/server/ui/components/ui/toggle/index.ts +28 -0
- package/dist/server/ui/components/ui/toggle-group/ToggleGroup.vue +49 -0
- package/dist/server/ui/components/ui/toggle-group/ToggleGroupItem.vue +46 -0
- package/dist/server/ui/components/ui/toggle-group/index.ts +2 -0
- package/dist/server/ui/components/ui/tooltip/Tooltip.vue +19 -0
- package/dist/server/ui/components/ui/tooltip/TooltipContent.vue +34 -0
- package/dist/server/ui/components/ui/tooltip/TooltipProvider.vue +14 -0
- package/dist/server/ui/components/ui/tooltip/TooltipTrigger.vue +15 -0
- package/dist/server/ui/components/ui/tooltip/index.ts +4 -0
- package/dist/server/ui/favicon.svg +1 -0
- package/dist/server/ui/index.html +13 -0
- package/dist/server/ui/lib/utils.ts +7 -0
- package/dist/server/ui/logo-gradient.svg +1 -0
- package/dist/server/ui/logo.svg +1 -0
- package/dist/server/ui/main.css +129 -0
- package/dist/server/ui/main.ts +16 -0
- package/dist/server/ui/mark-gradient.svg +1 -0
- package/dist/server/ui/mark.svg +1 -0
- package/dist/server/ui/pages/Home.vue +39 -0
- package/dist/server/ui/pages/Preview.vue +609 -0
- package/dist/server/ui/stripes.svg +174 -0
- package/dist/transformers/addAttributes.d.mts +32 -0
- package/dist/transformers/addAttributes.d.mts.map +1 -0
- package/dist/transformers/addAttributes.mjs +101 -0
- package/dist/transformers/addAttributes.mjs.map +1 -0
- package/dist/transformers/attributeToStyle.d.mts +25 -0
- package/dist/transformers/attributeToStyle.d.mts.map +1 -0
- package/dist/transformers/attributeToStyle.mjs +80 -0
- package/dist/transformers/attributeToStyle.mjs.map +1 -0
- package/dist/transformers/base.d.mts +8 -0
- package/dist/transformers/base.d.mts.map +1 -0
- package/dist/transformers/base.mjs +160 -0
- package/dist/transformers/base.mjs.map +1 -0
- package/dist/transformers/entities.d.mts +8 -0
- package/dist/transformers/entities.d.mts.map +1 -0
- package/dist/transformers/entities.mjs +38 -0
- package/dist/transformers/entities.mjs.map +1 -0
- package/dist/transformers/format.d.mts +15 -0
- package/dist/transformers/format.d.mts.map +1 -0
- package/dist/transformers/format.mjs +26 -0
- package/dist/transformers/format.mjs.map +1 -0
- package/dist/transformers/index.d.mts +35 -0
- package/dist/transformers/index.d.mts.map +1 -0
- package/dist/transformers/index.mjs +73 -0
- package/dist/transformers/index.mjs.map +1 -0
- package/dist/transformers/inlineCSS.d.mts +30 -0
- package/dist/transformers/inlineCSS.d.mts.map +1 -0
- package/dist/transformers/inlineCSS.mjs +79 -0
- package/dist/transformers/inlineCSS.mjs.map +1 -0
- package/dist/transformers/inlineLink.d.mts +14 -0
- package/dist/transformers/inlineLink.d.mts.map +1 -0
- package/dist/transformers/inlineLink.mjs +76 -0
- package/dist/transformers/inlineLink.mjs.map +1 -0
- package/dist/transformers/minify.d.mts +17 -0
- package/dist/transformers/minify.d.mts.map +1 -0
- package/dist/transformers/minify.mjs +24 -0
- package/dist/transformers/minify.mjs.map +1 -0
- package/dist/transformers/purgeCSS.d.mts +23 -0
- package/dist/transformers/purgeCSS.d.mts.map +1 -0
- package/dist/transformers/purgeCSS.mjs +66 -0
- package/dist/transformers/purgeCSS.mjs.map +1 -0
- package/dist/transformers/removeAttributes.d.mts +31 -0
- package/dist/transformers/removeAttributes.d.mts.map +1 -0
- package/dist/transformers/removeAttributes.mjs +63 -0
- package/dist/transformers/removeAttributes.mjs.map +1 -0
- package/dist/transformers/replaceStrings.d.mts +16 -0
- package/dist/transformers/replaceStrings.d.mts.map +1 -0
- package/dist/transformers/replaceStrings.mjs +19 -0
- package/dist/transformers/replaceStrings.mjs.map +1 -0
- package/dist/transformers/safeClassNames.d.mts +22 -0
- package/dist/transformers/safeClassNames.d.mts.map +1 -0
- package/dist/transformers/safeClassNames.mjs +103 -0
- package/dist/transformers/safeClassNames.mjs.map +1 -0
- package/dist/transformers/shorthandCSS.d.mts +24 -0
- package/dist/transformers/shorthandCSS.d.mts.map +1 -0
- package/dist/transformers/shorthandCSS.mjs +48 -0
- package/dist/transformers/shorthandCSS.mjs.map +1 -0
- package/dist/transformers/tailwindcss.d.mts +20 -0
- package/dist/transformers/tailwindcss.d.mts.map +1 -0
- package/dist/transformers/tailwindcss.mjs +136 -0
- package/dist/transformers/tailwindcss.mjs.map +1 -0
- package/dist/transformers/urlQuery.d.mts +24 -0
- package/dist/transformers/urlQuery.d.mts.map +1 -0
- package/dist/transformers/urlQuery.mjs +65 -0
- package/dist/transformers/urlQuery.mjs.map +1 -0
- package/dist/types/config.d.mts +129 -0
- package/dist/types/config.d.mts.map +1 -0
- package/dist/types/config.mjs +1 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +1 -0
- package/dist/utils/ast/index.d.mts +4 -0
- package/dist/utils/ast/index.mjs +5 -0
- package/dist/utils/ast/parser.d.mts +7 -0
- package/dist/utils/ast/parser.d.mts.map +1 -0
- package/dist/utils/ast/parser.mjs +15 -0
- package/dist/utils/ast/parser.mjs.map +1 -0
- package/dist/utils/ast/serializer.d.mts +7 -0
- package/dist/utils/ast/serializer.d.mts.map +1 -0
- package/dist/utils/ast/serializer.mjs +13 -0
- package/dist/utils/ast/serializer.mjs.map +1 -0
- package/dist/utils/ast/walker.d.mts +7 -0
- package/dist/utils/ast/walker.d.mts.map +1 -0
- package/dist/utils/ast/walker.mjs +12 -0
- package/dist/utils/ast/walker.mjs.map +1 -0
- package/dist/utils/url.d.mts +8 -0
- package/dist/utils/url.d.mts.map +1 -0
- package/dist/utils/url.mjs +32 -0
- package/dist/utils/url.mjs.map +1 -0
- package/node_modules/@clack/core/CHANGELOG.md +257 -0
- package/node_modules/@clack/core/LICENSE +9 -0
- package/node_modules/@clack/core/README.md +22 -0
- package/node_modules/@clack/core/dist/index.cjs +15 -0
- package/node_modules/@clack/core/dist/index.cjs.map +1 -0
- package/node_modules/@clack/core/dist/index.d.cts +211 -0
- package/node_modules/@clack/core/dist/index.d.mts +211 -0
- package/node_modules/@clack/core/dist/index.d.ts +211 -0
- package/node_modules/@clack/core/dist/index.mjs +15 -0
- package/node_modules/@clack/core/dist/index.mjs.map +1 -0
- package/node_modules/@clack/core/package.json +62 -0
- package/node_modules/@clack/prompts/CHANGELOG.md +412 -0
- package/node_modules/@clack/prompts/LICENSE +9 -0
- package/node_modules/@clack/prompts/README.md +207 -0
- package/node_modules/@clack/prompts/dist/index.cjs +87 -0
- package/node_modules/@clack/prompts/dist/index.cjs.map +1 -0
- package/node_modules/@clack/prompts/dist/index.d.cts +165 -0
- package/node_modules/@clack/prompts/dist/index.d.mts +165 -0
- package/node_modules/@clack/prompts/dist/index.d.ts +165 -0
- package/node_modules/@clack/prompts/dist/index.mjs +87 -0
- package/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
- package/node_modules/@clack/prompts/package.json +61 -0
- package/node_modules/@maizzle/cli/LICENSE +21 -0
- package/node_modules/@maizzle/cli/README.md +58 -0
- package/node_modules/@maizzle/cli/dist/commands/make/component.d.mts +4 -0
- package/node_modules/@maizzle/cli/dist/commands/make/component.mjs +31 -0
- package/node_modules/@maizzle/cli/dist/commands/make/config.d.mts +4 -0
- package/node_modules/@maizzle/cli/dist/commands/make/config.mjs +21 -0
- package/node_modules/@maizzle/cli/dist/commands/make/layout.d.mts +4 -0
- package/node_modules/@maizzle/cli/dist/commands/make/layout.mjs +31 -0
- package/node_modules/@maizzle/cli/dist/commands/make/scaffold.d.mts +5 -0
- package/node_modules/@maizzle/cli/dist/commands/make/scaffold.mjs +28 -0
- package/node_modules/@maizzle/cli/dist/commands/make/stubs/component.vue +9 -0
- package/node_modules/@maizzle/cli/dist/commands/make/stubs/config.ts +9 -0
- package/node_modules/@maizzle/cli/dist/commands/make/stubs/layout.vue +39 -0
- package/node_modules/@maizzle/cli/dist/commands/make/stubs/template.vue +8 -0
- package/node_modules/@maizzle/cli/dist/commands/make/template.d.mts +4 -0
- package/node_modules/@maizzle/cli/dist/commands/make/template.mjs +31 -0
- package/node_modules/@maizzle/cli/dist/index.d.mts +8 -0
- package/node_modules/@maizzle/cli/dist/index.mjs +42 -0
- package/node_modules/@maizzle/cli/package.json +59 -0
- package/node_modules/citty/LICENSE +36 -0
- package/node_modules/citty/README.md +134 -0
- package/node_modules/citty/dist/index.cjs +475 -0
- package/node_modules/citty/dist/index.d.cts +80 -0
- package/node_modules/citty/dist/index.d.mts +80 -0
- package/node_modules/citty/dist/index.d.ts +80 -0
- package/node_modules/citty/dist/index.mjs +463 -0
- package/node_modules/citty/package.json +49 -0
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1149 -0
- package/node_modules/commander/esm.mjs +16 -0
- package/node_modules/commander/index.js +24 -0
- package/node_modules/commander/lib/argument.js +149 -0
- package/node_modules/commander/lib/command.js +2662 -0
- package/node_modules/commander/lib/error.js +39 -0
- package/node_modules/commander/lib/help.js +709 -0
- package/node_modules/commander/lib/option.js +367 -0
- package/node_modules/commander/lib/suggestSimilar.js +101 -0
- package/node_modules/commander/package-support.json +16 -0
- package/node_modules/commander/package.json +82 -0
- package/node_modules/commander/typings/esm.d.mts +3 -0
- package/node_modules/commander/typings/index.d.ts +1045 -0
- package/node_modules/consola/LICENSE +47 -0
- package/node_modules/consola/README.md +352 -0
- package/node_modules/consola/basic.d.ts +1 -0
- package/node_modules/consola/browser.d.ts +1 -0
- package/node_modules/consola/core.d.ts +1 -0
- package/node_modules/consola/dist/basic.cjs +32 -0
- package/node_modules/consola/dist/basic.d.cts +23 -0
- package/node_modules/consola/dist/basic.d.mts +21 -0
- package/node_modules/consola/dist/basic.d.ts +23 -0
- package/node_modules/consola/dist/basic.mjs +24 -0
- package/node_modules/consola/dist/browser.cjs +84 -0
- package/node_modules/consola/dist/browser.d.cts +23 -0
- package/node_modules/consola/dist/browser.d.mts +21 -0
- package/node_modules/consola/dist/browser.d.ts +23 -0
- package/node_modules/consola/dist/browser.mjs +76 -0
- package/node_modules/consola/dist/chunks/prompt.cjs +288 -0
- package/node_modules/consola/dist/chunks/prompt.mjs +280 -0
- package/node_modules/consola/dist/core.cjs +517 -0
- package/node_modules/consola/dist/core.d.cts +459 -0
- package/node_modules/consola/dist/core.d.mts +459 -0
- package/node_modules/consola/dist/core.d.ts +459 -0
- package/node_modules/consola/dist/core.mjs +512 -0
- package/node_modules/consola/dist/index.cjs +663 -0
- package/node_modules/consola/dist/index.d.cts +24 -0
- package/node_modules/consola/dist/index.d.mts +22 -0
- package/node_modules/consola/dist/index.d.ts +24 -0
- package/node_modules/consola/dist/index.mjs +651 -0
- package/node_modules/consola/dist/shared/consola.DCGIlDNP.cjs +75 -0
- package/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
- package/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
- package/node_modules/consola/dist/shared/consola.DwRq1yyg.cjs +312 -0
- package/node_modules/consola/dist/utils.cjs +64 -0
- package/node_modules/consola/dist/utils.d.cts +286 -0
- package/node_modules/consola/dist/utils.d.mts +286 -0
- package/node_modules/consola/dist/utils.d.ts +286 -0
- package/node_modules/consola/dist/utils.mjs +54 -0
- package/node_modules/consola/lib/index.cjs +10 -0
- package/node_modules/consola/package.json +136 -0
- package/node_modules/consola/utils.d.ts +1 -0
- package/node_modules/create-maizzle/README.md +86 -0
- package/node_modules/create-maizzle/bin/create-maizzle.mjs +4 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/CHANGELOG.md +340 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/LICENSE +9 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/README.md +22 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.d.mts +349 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.mjs +11 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/dist/index.mjs.map +1 -0
- package/node_modules/create-maizzle/node_modules/@clack/core/package.json +60 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/CHANGELOG.md +576 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/LICENSE +9 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/README.md +270 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.d.mts +391 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.mjs +137 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
- package/node_modules/create-maizzle/node_modules/@clack/prompts/package.json +65 -0
- package/node_modules/create-maizzle/package.json +47 -0
- package/node_modules/create-maizzle/src/index.js +242 -0
- package/node_modules/defu/LICENSE +21 -0
- package/node_modules/defu/README.md +171 -0
- package/node_modules/defu/dist/defu.cjs +77 -0
- package/node_modules/defu/dist/defu.d.cts +31 -0
- package/node_modules/defu/dist/defu.d.mts +29 -0
- package/node_modules/defu/dist/defu.d.ts +31 -0
- package/node_modules/defu/dist/defu.mjs +69 -0
- package/node_modules/defu/lib/defu.cjs +10 -0
- package/node_modules/defu/lib/defu.d.cts +12 -0
- package/node_modules/defu/package.json +48 -0
- package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
- package/node_modules/fast-string-truncated-width/dist/index.js +171 -0
- package/node_modules/fast-string-truncated-width/dist/types.d.ts +22 -0
- package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
- package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
- package/node_modules/fast-string-truncated-width/dist/utils.js +15 -0
- package/node_modules/fast-string-truncated-width/license +21 -0
- package/node_modules/fast-string-truncated-width/package.json +35 -0
- package/node_modules/fast-string-truncated-width/readme.md +60 -0
- package/node_modules/fast-string-width/dist/index.d.ts +4 -0
- package/node_modules/fast-string-width/dist/index.js +14 -0
- package/node_modules/fast-string-width/license +21 -0
- package/node_modules/fast-string-width/package.json +34 -0
- package/node_modules/fast-string-width/readme.md +45 -0
- package/node_modules/fast-wrap-ansi/LICENSE +23 -0
- package/node_modules/fast-wrap-ansi/README.md +26 -0
- package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
- package/node_modules/fast-wrap-ansi/lib/main.js +216 -0
- package/node_modules/fast-wrap-ansi/lib/main.js.map +1 -0
- package/node_modules/fast-wrap-ansi/package.json +51 -0
- package/node_modules/giget/LICENSE +184 -0
- package/node_modules/giget/README.md +248 -0
- package/node_modules/giget/dist/cli.mjs +112 -0
- package/node_modules/giget/dist/index.d.mts +49 -0
- package/node_modules/giget/dist/index.mjs +22 -0
- package/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +468 -0
- package/node_modules/giget/package.json +62 -0
- package/node_modules/node-fetch-native/LICENSE +114 -0
- package/node_modules/node-fetch-native/README.md +225 -0
- package/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +2 -0
- package/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +2 -0
- package/node_modules/node-fetch-native/dist/index.cjs +1 -0
- package/node_modules/node-fetch-native/dist/index.mjs +1 -0
- package/node_modules/node-fetch-native/dist/native.cjs +1 -0
- package/node_modules/node-fetch-native/dist/native.mjs +1 -0
- package/node_modules/node-fetch-native/dist/node.cjs +19 -0
- package/node_modules/node-fetch-native/dist/node.mjs +19 -0
- package/node_modules/node-fetch-native/dist/polyfill.cjs +1 -0
- package/node_modules/node-fetch-native/dist/polyfill.mjs +1 -0
- package/node_modules/node-fetch-native/dist/proxy-stub.cjs +1 -0
- package/node_modules/node-fetch-native/dist/proxy-stub.mjs +1 -0
- package/node_modules/node-fetch-native/dist/proxy.cjs +58 -0
- package/node_modules/node-fetch-native/dist/shared/node-fetch-native.DfbY2q-x.mjs +1 -0
- package/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs +1 -0
- package/node_modules/node-fetch-native/index.d.ts +1 -0
- 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 +11 -0
- package/node_modules/node-fetch-native/lib/index.d.cts +10 -0
- package/node_modules/node-fetch-native/lib/index.d.mts +10 -0
- package/node_modules/node-fetch-native/lib/index.d.ts +10 -0
- package/node_modules/node-fetch-native/lib/native.cjs +11 -0
- package/node_modules/node-fetch-native/lib/polyfill.d.cts +1 -0
- package/node_modules/node-fetch-native/lib/polyfill.d.mts +1 -0
- package/node_modules/node-fetch-native/lib/polyfill.d.ts +1 -0
- package/node_modules/node-fetch-native/lib/proxy.d.ts +32 -0
- package/node_modules/node-fetch-native/node.d.ts +1 -0
- package/node_modules/node-fetch-native/package.json +138 -0
- package/node_modules/node-fetch-native/polyfill.d.ts +1 -0
- package/node_modules/node-fetch-native/proxy.d.ts +1 -0
- package/node_modules/nypm/LICENSE +21 -0
- package/node_modules/nypm/README.md +152 -0
- package/node_modules/nypm/dist/cli.d.mts +1 -0
- package/node_modules/nypm/dist/cli.mjs +460 -0
- package/node_modules/nypm/dist/index.d.mts +209 -0
- package/node_modules/nypm/dist/index.mjs +423 -0
- package/node_modules/nypm/node_modules/citty/LICENSE +21 -0
- package/node_modules/nypm/node_modules/citty/README.md +231 -0
- package/node_modules/nypm/node_modules/citty/dist/THIRD-PARTY-LICENSES.md +33 -0
- package/node_modules/nypm/node_modules/citty/dist/_chunks/libs/scule.mjs +70 -0
- package/node_modules/nypm/node_modules/citty/dist/index.d.mts +112 -0
- package/node_modules/nypm/node_modules/citty/dist/index.mjs +425 -0
- package/node_modules/nypm/node_modules/citty/package.json +42 -0
- package/node_modules/nypm/package.json +54 -0
- package/node_modules/pathe/LICENSE +70 -0
- package/node_modules/pathe/README.md +73 -0
- package/node_modules/pathe/dist/index.cjs +39 -0
- package/node_modules/pathe/dist/index.d.cts +47 -0
- package/node_modules/pathe/dist/index.d.mts +47 -0
- package/node_modules/pathe/dist/index.d.ts +47 -0
- package/node_modules/pathe/dist/index.mjs +19 -0
- package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +266 -0
- package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +249 -0
- package/node_modules/pathe/dist/utils.cjs +82 -0
- package/node_modules/pathe/dist/utils.d.cts +32 -0
- package/node_modules/pathe/dist/utils.d.mts +32 -0
- package/node_modules/pathe/dist/utils.d.ts +32 -0
- package/node_modules/pathe/dist/utils.mjs +77 -0
- package/node_modules/pathe/package.json +61 -0
- package/node_modules/pathe/utils.d.ts +1 -0
- package/node_modules/picocolors/LICENSE +15 -0
- package/node_modules/picocolors/README.md +21 -0
- package/node_modules/picocolors/package.json +25 -0
- package/node_modules/picocolors/picocolors.browser.js +4 -0
- package/node_modules/picocolors/picocolors.d.ts +5 -0
- package/node_modules/picocolors/picocolors.js +75 -0
- package/node_modules/picocolors/types.d.ts +51 -0
- package/node_modules/sisteransi/license +21 -0
- package/node_modules/sisteransi/package.json +34 -0
- package/node_modules/sisteransi/readme.md +113 -0
- package/node_modules/sisteransi/src/index.js +58 -0
- package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
- package/node_modules/tinyexec/LICENSE +21 -0
- package/node_modules/tinyexec/README.md +269 -0
- package/node_modules/tinyexec/dist/LICENSES.txt +83 -0
- package/node_modules/tinyexec/dist/main.d.mts +71 -0
- package/node_modules/tinyexec/dist/main.mjs +642 -0
- package/node_modules/tinyexec/package.json +62 -0
- package/package.json +74 -73
- package/CHANGELOG.md +0 -770
- package/bin/maizzle +0 -5
- package/src/commands/build.js +0 -348
- package/src/commands/serve.js +0 -3
- package/src/generators/plaintext.js +0 -222
- package/src/generators/render.js +0 -129
- package/src/index.js +0 -49
- package/src/posthtml/defaultComponentsConfig.js +0 -19
- package/src/posthtml/defaultConfig.js +0 -14
- package/src/posthtml/index.js +0 -102
- package/src/posthtml/plugins/combineMediaQueries.js +0 -42
- package/src/posthtml/plugins/envAttributes.js +0 -32
- package/src/posthtml/plugins/envTags.js +0 -33
- package/src/posthtml/plugins/expandLinkTag.js +0 -59
- package/src/posthtml/plugins/postcss/compileCss.js +0 -125
- package/src/posthtml/plugins/removeRawStyleAttributes.js +0 -30
- package/src/server/client.js +0 -182
- package/src/server/index.js +0 -464
- package/src/server/routes/hmr.js +0 -26
- package/src/server/routes/index.js +0 -77
- package/src/server/views/404.html +0 -59
- package/src/server/views/error.html +0 -83
- package/src/server/views/index.html +0 -172
- package/src/server/websockets.js +0 -27
- package/src/transformers/addAttributes.js +0 -29
- package/src/transformers/attributeToStyle.js +0 -90
- package/src/transformers/baseUrl.js +0 -154
- package/src/transformers/core.js +0 -32
- package/src/transformers/filters/defaultFilters.js +0 -146
- package/src/transformers/filters/index.js +0 -18
- package/src/transformers/index.js +0 -259
- package/src/transformers/inline.js +0 -306
- package/src/transformers/markdown.js +0 -26
- package/src/transformers/minify.js +0 -27
- package/src/transformers/posthtmlMso.js +0 -14
- package/src/transformers/prettify.js +0 -29
- package/src/transformers/preventWidows.js +0 -37
- package/src/transformers/purge.js +0 -56
- package/src/transformers/removeAttributes.js +0 -55
- package/src/transformers/replaceStrings.js +0 -37
- package/src/transformers/safeClassNames.js +0 -29
- package/src/transformers/shorthandCss.js +0 -20
- package/src/transformers/sixHex.js +0 -30
- package/src/transformers/template.js +0 -26
- package/src/transformers/urlParameters.js +0 -20
- package/src/transformers/useAttributeSizes.js +0 -63
- package/src/utils/getConfigByFilePath.js +0 -143
- package/src/utils/node.js +0 -68
- package/src/utils/string.js +0 -186
- package/types/build.d.ts +0 -166
- package/types/config.d.ts +0 -638
- package/types/css/combineMediaQueries.d.ts +0 -90
- package/types/css/inline.d.ts +0 -218
- package/types/css/purge.d.ts +0 -125
- package/types/events.d.ts +0 -153
- package/types/index.d.ts +0 -232
- package/types/markdown.d.ts +0 -33
- package/types/minify.d.ts +0 -138
- package/types/plaintext.d.ts +0 -56
- package/types/posthtml.d.ts +0 -162
- package/types/render.d.ts +0 -13
- package/types/urlParameters.d.ts +0 -40
- package/types/widowWords.d.ts +0 -38
package/bin/maizzle
DELETED
package/src/commands/build.js
DELETED
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readFile,
|
|
3
|
-
writeFile,
|
|
4
|
-
copyFile,
|
|
5
|
-
lstat,
|
|
6
|
-
mkdir,
|
|
7
|
-
rm,
|
|
8
|
-
cp,
|
|
9
|
-
} from 'node:fs/promises'
|
|
10
|
-
import path from 'pathe'
|
|
11
|
-
import fg from 'fast-glob'
|
|
12
|
-
import { defu as merge } from 'defu'
|
|
13
|
-
|
|
14
|
-
import get from 'lodash/get.js'
|
|
15
|
-
import isEmpty from 'lodash-es/isEmpty.js'
|
|
16
|
-
|
|
17
|
-
import ora from 'ora'
|
|
18
|
-
import pico from 'picocolors'
|
|
19
|
-
import cliTable from 'cli-table3'
|
|
20
|
-
|
|
21
|
-
import { render } from '../generators/render.js'
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
formatTime,
|
|
25
|
-
getRootDirectories,
|
|
26
|
-
getFileExtensionsFromPattern,
|
|
27
|
-
} from '../utils/string.js'
|
|
28
|
-
|
|
29
|
-
import { getColorizedFileSize } from '../utils/node.js'
|
|
30
|
-
|
|
31
|
-
import {
|
|
32
|
-
generatePlaintext,
|
|
33
|
-
handlePlaintextTags,
|
|
34
|
-
writePlaintextFile
|
|
35
|
-
} from '../generators/plaintext.js'
|
|
36
|
-
|
|
37
|
-
import { readFileConfig } from '../utils/getConfigByFilePath.js'
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Ensures that a directory exists, creating it if needed.
|
|
41
|
-
*
|
|
42
|
-
* @param {string} filePath - The path to the file to check.
|
|
43
|
-
*/
|
|
44
|
-
async function ensureDirectoryExistence(filePath) {
|
|
45
|
-
const dirname = path.dirname(filePath)
|
|
46
|
-
await mkdir(dirname, { recursive: true })
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Copy a file from source to target.
|
|
51
|
-
*
|
|
52
|
-
* @param {string} source - The source file path.
|
|
53
|
-
* @param {string} target - The target file path.
|
|
54
|
-
*/
|
|
55
|
-
async function copyFileAsync(source, target) {
|
|
56
|
-
await ensureDirectoryExistence(target)
|
|
57
|
-
await copyFile(source, target)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Compile templates and output to the build directory.
|
|
62
|
-
* Returns a promise containing an object with files output and the config object.
|
|
63
|
-
*
|
|
64
|
-
* @param {object|string} config - The Maizzle config object, or path to a config file.
|
|
65
|
-
* @returns {Promise<object>} The build output, containing the files and config.
|
|
66
|
-
*/
|
|
67
|
-
export default async (config = {}) => {
|
|
68
|
-
const spinner = ora()
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
const startTime = Date.now()
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Read the config file for this environment,
|
|
75
|
-
* merging it with the default config.
|
|
76
|
-
*/
|
|
77
|
-
config = await readFileConfig(config).catch(() => { throw new Error('Could not compute config') })
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Support customizing the spinner
|
|
81
|
-
*/
|
|
82
|
-
const spinnerConfig = get(config, 'build.spinner')
|
|
83
|
-
|
|
84
|
-
if (spinnerConfig === false) {
|
|
85
|
-
// Show only 'Building...' text
|
|
86
|
-
spinner.isEnabled = false
|
|
87
|
-
} else {
|
|
88
|
-
spinner.spinner = get(config, 'build.spinner', 'circleHalves')
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
spinner.start('Building...')
|
|
92
|
-
|
|
93
|
-
// Run beforeCreate event
|
|
94
|
-
if (typeof config.beforeCreate === 'function') {
|
|
95
|
-
await config.beforeCreate({ config })
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const buildOutputPath = get(config, 'build.output.path', 'build_local')
|
|
99
|
-
|
|
100
|
-
// Remove output directory
|
|
101
|
-
await rm(buildOutputPath, { recursive: true, force: true })
|
|
102
|
-
|
|
103
|
-
const table = new cliTable({
|
|
104
|
-
head: ['File name', 'File size', 'Build time'].map(item => pico.bold(item)),
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Check that templates to be built, actually exist
|
|
109
|
-
*/
|
|
110
|
-
const contentPaths = get(config, 'build.content', ['emails/**/*.html'])
|
|
111
|
-
|
|
112
|
-
const templateFolders = Array.isArray(contentPaths) ? contentPaths : [contentPaths]
|
|
113
|
-
const templatePaths = await fg.glob([...new Set(templateFolders)])
|
|
114
|
-
|
|
115
|
-
// If there are no templates to build, throw error
|
|
116
|
-
if (templatePaths.length === 0) {
|
|
117
|
-
throw new Error(`No templates found in ${pico.inverse(templateFolders)}`)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Copy source directories to destination
|
|
122
|
-
*
|
|
123
|
-
* Copies each `build.content` path to the `build.output.path` directory.
|
|
124
|
-
*/
|
|
125
|
-
let from = get(config, 'build.output.from', ['emails'])
|
|
126
|
-
|
|
127
|
-
const globPathsToCopy = contentPaths.map(glob => {
|
|
128
|
-
// Keep negated paths as they are
|
|
129
|
-
if (glob.startsWith('!')) {
|
|
130
|
-
return glob
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Keep single-file sources as they are
|
|
134
|
-
if (!/\*/.test(glob)) {
|
|
135
|
-
return glob
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Update non-negated paths to target all files, avoiding duplication
|
|
139
|
-
return glob.replace(/\/\*\*\/\*\.\{.*?\}$|\/\*\*\/\*\.[^/]*$|\/*\.[^/]*$/, '/**/*')
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
try {
|
|
143
|
-
from = Array.isArray(from) ? from : [from]
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Copy files from source to destination
|
|
147
|
-
*
|
|
148
|
-
* The array/set conversion is to remove duplicates
|
|
149
|
-
*/
|
|
150
|
-
for (const file of await fg(Array.from(new Set(globPathsToCopy)))) {
|
|
151
|
-
let relativePath
|
|
152
|
-
for (const dir of from) {
|
|
153
|
-
if (file.startsWith(dir)) {
|
|
154
|
-
relativePath = path.relative(dir, file)
|
|
155
|
-
break
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (!relativePath) {
|
|
159
|
-
relativePath = path.relative('.', file)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const targetPath = path.join(buildOutputPath, relativePath)
|
|
163
|
-
await copyFileAsync(file, targetPath)
|
|
164
|
-
}
|
|
165
|
-
} catch (error) {
|
|
166
|
-
console.error('Error while processing pattern:', error)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Get a list of files to render, from the output directory
|
|
171
|
-
*
|
|
172
|
-
* Uses all file extensions from non-negated glob paths in `build.content`
|
|
173
|
-
* to determine which files to render from the output directory.
|
|
174
|
-
*/
|
|
175
|
-
const outputExtensions = new Set()
|
|
176
|
-
|
|
177
|
-
for (const pattern of contentPaths) {
|
|
178
|
-
getFileExtensionsFromPattern(pattern).map(ext => outputExtensions.add(ext))
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Create a list of templates to compile
|
|
183
|
-
*/
|
|
184
|
-
const extensions = outputExtensions.size > 1
|
|
185
|
-
? `{${[...outputExtensions].join(',')}}`
|
|
186
|
-
: [...outputExtensions][0] || 'html'
|
|
187
|
-
|
|
188
|
-
const templatesToCompile = await fg.glob(
|
|
189
|
-
path.join(
|
|
190
|
-
buildOutputPath,
|
|
191
|
-
`**/*.${extensions}`
|
|
192
|
-
)
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Render templates
|
|
197
|
-
*/
|
|
198
|
-
for await (const templatePath of templatesToCompile) {
|
|
199
|
-
const templateBuildStartTime = Date.now()
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Add the current template path to the config
|
|
203
|
-
*
|
|
204
|
-
* Can be used in events like `beforeRender` to determine
|
|
205
|
-
* which template file is being rendered.
|
|
206
|
-
*/
|
|
207
|
-
config.build.current = {
|
|
208
|
-
path: path.parse(templatePath),
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const html = await readFile(templatePath, 'utf8')
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Render the markup.
|
|
215
|
-
*
|
|
216
|
-
* Merging a custom `components` object to make sure that file extensions from both
|
|
217
|
-
* `build.content` * and * `components.fileExtension` are used when scanning for
|
|
218
|
-
* component files.
|
|
219
|
-
*/
|
|
220
|
-
const userComponentFileExtensions = get(config, 'components.fileExtension', ['html'])
|
|
221
|
-
|
|
222
|
-
const rendered = await render(html, merge(
|
|
223
|
-
{
|
|
224
|
-
components: {
|
|
225
|
-
fileExtension: [
|
|
226
|
-
...outputExtensions,
|
|
227
|
-
...(new Set([].concat(userComponentFileExtensions))),
|
|
228
|
-
],
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
config
|
|
232
|
-
))
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Generate plaintext
|
|
236
|
-
*
|
|
237
|
-
* We do this first so that we can remove the <plaintext>
|
|
238
|
-
* tags from the markup before outputting the file.
|
|
239
|
-
*/
|
|
240
|
-
const plaintextConfig = get(rendered.config, 'plaintext')
|
|
241
|
-
|
|
242
|
-
if (Boolean(plaintextConfig) || !isEmpty(plaintextConfig)) {
|
|
243
|
-
const posthtmlOptions = get(rendered.config, 'posthtml.options', {})
|
|
244
|
-
|
|
245
|
-
await writePlaintextFile(
|
|
246
|
-
await generatePlaintext(rendered.html, merge(plaintextConfig, posthtmlOptions)),
|
|
247
|
-
rendered.config
|
|
248
|
-
).catch(error => {
|
|
249
|
-
throw new Error(`Error writing plaintext file: ${error}`)
|
|
250
|
-
})
|
|
251
|
-
|
|
252
|
-
rendered.html = await handlePlaintextTags(rendered.html, posthtmlOptions)
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Determine output path, creating directories if needed
|
|
257
|
-
*
|
|
258
|
-
* Prioritize `permalink` path from Front Matter,
|
|
259
|
-
* fallback to the current template path.
|
|
260
|
-
*
|
|
261
|
-
* We do this before generating plaintext, so that
|
|
262
|
-
* any paths will already have been created.
|
|
263
|
-
*/
|
|
264
|
-
const outputPathFromConfig = get(rendered.config, 'permalink', templatePath)
|
|
265
|
-
const parsedOutputPath = path.parse(outputPathFromConfig)
|
|
266
|
-
// This keeps original file extension if no output extension is set
|
|
267
|
-
const extension = get(rendered.config, 'build.output.extension', parsedOutputPath.ext.slice(1))
|
|
268
|
-
const outputPath = `${parsedOutputPath.dir}/${parsedOutputPath.name}.${extension}`
|
|
269
|
-
|
|
270
|
-
const pathExists = await lstat(path.dirname(outputPath)).catch(() => false)
|
|
271
|
-
|
|
272
|
-
if (!pathExists) {
|
|
273
|
-
await mkdir(path.dirname(outputPath), { recursive: true })
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Write the rendered HTML to disk, creating directories if needed
|
|
278
|
-
*/
|
|
279
|
-
await writeFile(outputPath, rendered.html)
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Remove original file if its path is different
|
|
283
|
-
* from the final destination path.
|
|
284
|
-
*/
|
|
285
|
-
if (outputPath !== templatePath) {
|
|
286
|
-
await rm(templatePath)
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Add file to CLI table for build summary logging
|
|
291
|
-
*/
|
|
292
|
-
table.push([
|
|
293
|
-
path.relative(get(rendered.config, 'build.output.path'), outputPath),
|
|
294
|
-
getColorizedFileSize(rendered.html),
|
|
295
|
-
formatTime(Date.now() - templateBuildStartTime)
|
|
296
|
-
])
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Copy static files
|
|
301
|
-
*/
|
|
302
|
-
let staticFiles = get(config, 'build.static', [])
|
|
303
|
-
|
|
304
|
-
if (!Array.isArray(staticFiles)) {
|
|
305
|
-
staticFiles = [staticFiles]
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
for (const definition of staticFiles) {
|
|
309
|
-
const staticSourcePaths = getRootDirectories([...new Set(definition.source)])
|
|
310
|
-
|
|
311
|
-
for await (const rootDir of staticSourcePaths) {
|
|
312
|
-
await cp(rootDir, path.join(buildOutputPath, definition.destination), { recursive: true })
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
const allOutputFiles = await fg.glob(path.join(buildOutputPath, '**/*'))
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Run `afterBuild` event
|
|
320
|
-
*/
|
|
321
|
-
if (typeof config.afterBuild === 'function') {
|
|
322
|
-
await config.afterBuild({
|
|
323
|
-
config,
|
|
324
|
-
files: allOutputFiles,
|
|
325
|
-
})
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Log a build summary if enabled in the config
|
|
330
|
-
*/
|
|
331
|
-
|
|
332
|
-
spinner.clear()
|
|
333
|
-
|
|
334
|
-
if (config.build.summary) {
|
|
335
|
-
console.log(table.toString() + '\n')
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
spinner.succeed(`Built ${table.length} template${table.length > 1 ? 's' : ''} in ${formatTime(Date.now() - startTime)}`)
|
|
339
|
-
|
|
340
|
-
return {
|
|
341
|
-
files: allOutputFiles,
|
|
342
|
-
config
|
|
343
|
-
}
|
|
344
|
-
} catch (error) {
|
|
345
|
-
spinner.fail('Build failed')
|
|
346
|
-
throw error
|
|
347
|
-
}
|
|
348
|
-
}
|
package/src/commands/serve.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import path from 'pathe'
|
|
2
|
-
import posthtml from 'posthtml'
|
|
3
|
-
import get from 'lodash-es/get.js'
|
|
4
|
-
import { defu as merge } from 'defu'
|
|
5
|
-
import { stripHtml } from 'string-strip-html'
|
|
6
|
-
import { writeFile, lstat, mkdir } from 'node:fs/promises'
|
|
7
|
-
import { getPosthtmlOptions } from '../posthtml/defaultConfig.js'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Removes HTML tags from a given HTML string based on
|
|
11
|
-
* a specified tag name or an array of tag names.
|
|
12
|
-
*
|
|
13
|
-
* @param {Object} options - The options object.
|
|
14
|
-
* @param {string|string[]} [options.tag='not-plaintext'] - The tag name or an array of tag names to remove from the HTML.
|
|
15
|
-
* @param {string} [options.html=''] - The HTML string from which to remove the tags.
|
|
16
|
-
* @param {Object} [options.config={}] - PostHTML options.
|
|
17
|
-
* @returns {string} - The HTML string with the specified tags removed.
|
|
18
|
-
*/
|
|
19
|
-
const removeTags = ({ tag = 'not-plaintext', html = '', config = {} }) => {
|
|
20
|
-
/**
|
|
21
|
-
* If the HTML string is empty, return it as is
|
|
22
|
-
*/
|
|
23
|
-
if (!html) {
|
|
24
|
-
return html
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const posthtmlPlugin = () => tree => {
|
|
28
|
-
const process = node => {
|
|
29
|
-
if (!node.tag) {
|
|
30
|
-
return node
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* If the tag is a string and it matches the node tag, remove it
|
|
35
|
-
*/
|
|
36
|
-
if (node.tag === tag) {
|
|
37
|
-
return {
|
|
38
|
-
tag: false,
|
|
39
|
-
content: ['']
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return node
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return tree.walk(process)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const posthtmlOptions = merge(config, getPosthtmlOptions())
|
|
50
|
-
|
|
51
|
-
return posthtml([posthtmlPlugin()]).process(html, { ...posthtmlOptions }).then(res => res.html)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Handles custom <plaintext> tags and replaces their content based on the tag name.
|
|
56
|
-
*
|
|
57
|
-
* @param {Object} options - The options object.
|
|
58
|
-
* @param {string} [options.html=''] - The HTML string containing custom tags to be processed.
|
|
59
|
-
* @param {Object} [options.config={}] - PostHTML options.
|
|
60
|
-
* @returns {string} - The modified HTML string after processing custom tags.
|
|
61
|
-
*/
|
|
62
|
-
export async function handlePlaintextTags(html = '', config = {}) {
|
|
63
|
-
/**
|
|
64
|
-
* If the HTML string is empty, return early
|
|
65
|
-
*/
|
|
66
|
-
if (!html) {
|
|
67
|
-
return html
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const posthtmlPlugin = () => tree => {
|
|
71
|
-
const process = node => {
|
|
72
|
-
/**
|
|
73
|
-
* Remove <plaintext> tags and their content from the HTML
|
|
74
|
-
*/
|
|
75
|
-
if (node.tag === 'plaintext') {
|
|
76
|
-
return {
|
|
77
|
-
tag: false,
|
|
78
|
-
content: ['']
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Replace <not-plaintext> tags with their content
|
|
84
|
-
*/
|
|
85
|
-
if (node.tag === 'not-plaintext') {
|
|
86
|
-
return {
|
|
87
|
-
tag: false,
|
|
88
|
-
content: tree.render(node.content)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return node
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return tree.walk(process)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const posthtmlOptions = merge(config, getPosthtmlOptions())
|
|
99
|
-
|
|
100
|
-
return posthtml([posthtmlPlugin()]).process(html, { ...posthtmlOptions }).then(res => res.html)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Generate a plaintext representation from the provided HTML.
|
|
105
|
-
*
|
|
106
|
-
* @param {Object} options - The options object.
|
|
107
|
-
* @param {string} [options.html=''] - The HTML string to convert to plaintext.
|
|
108
|
-
* @param {Object} [options.config={}] - Configuration object.
|
|
109
|
-
* @returns {Promise<string>|void} - The generated plaintext as a string.
|
|
110
|
-
*/
|
|
111
|
-
export async function generatePlaintext(html = '', config = {}) {
|
|
112
|
-
const { posthtml: posthtmlOptions, ...stripOptions } = config
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Remove <not-plaintext> tags and their content from the HTML.
|
|
116
|
-
* `config` is an object containing PostHTML options.
|
|
117
|
-
*/
|
|
118
|
-
html = await removeTags({ tag: 'not-plaintext', html, config: posthtmlOptions })
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Return the plaintext representation from the stripped HTML.
|
|
122
|
-
* The `dumpLinkHrefsNearby` option is enabled by default.
|
|
123
|
-
*/
|
|
124
|
-
return stripHtml(
|
|
125
|
-
html,
|
|
126
|
-
merge(
|
|
127
|
-
stripOptions,
|
|
128
|
-
{
|
|
129
|
-
dumpLinkHrefsNearby: {
|
|
130
|
-
enabled: true,
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
)
|
|
134
|
-
).result
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export async function writePlaintextFile(plaintext = '', config = {}) {
|
|
138
|
-
if (!plaintext) {
|
|
139
|
-
throw new Error('Missing plaintext content.')
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (typeof plaintext !== 'string') {
|
|
143
|
-
throw new Error('Plaintext content must be a string.')
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Get plaintext output path config, i.e `config.plaintext.destination.path`
|
|
148
|
-
*
|
|
149
|
-
* Fall back to template's build output path and extension, for example:
|
|
150
|
-
* `config.build.output.path`
|
|
151
|
-
*/
|
|
152
|
-
const plaintextConfig = get(config, 'plaintext')
|
|
153
|
-
let plaintextOutputPath = get(plaintextConfig, 'output.path', '')
|
|
154
|
-
const plaintextExtension = get(plaintextConfig, 'output.extension', 'txt')
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* If `plaintext: true` (either from Front Matter or from config),
|
|
158
|
-
* output plaintext file in the same location as the HTML file.
|
|
159
|
-
*/
|
|
160
|
-
if (plaintextConfig === true) {
|
|
161
|
-
plaintextOutputPath = ''
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* If `plaintext: path/to/file.ext` in the FM
|
|
166
|
-
* Can't work if set in config.js as file path, because it would be the same for all templates
|
|
167
|
-
* We check later if it's a dir path, won't work if it's a file path
|
|
168
|
-
*/
|
|
169
|
-
if (typeof plaintextConfig === 'string') {
|
|
170
|
-
plaintextOutputPath = plaintextConfig
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// No need to handle if it's an object, since we already set it to that initially
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* If the template has a `permalink` key set in the FM, always output plaintext file there
|
|
177
|
-
*/
|
|
178
|
-
if (typeof config.permalink === 'string') {
|
|
179
|
-
plaintextOutputPath = config.permalink
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* If `plaintextOutputPath` is a file path, output file there.
|
|
184
|
-
*
|
|
185
|
-
* The file will be output relative to the project root, and the extension
|
|
186
|
-
* doesn't matter, it will be replaced with `plaintextExtension`.
|
|
187
|
-
*/
|
|
188
|
-
if (path.extname(plaintextOutputPath)) {
|
|
189
|
-
// Ensure the target directory exists
|
|
190
|
-
await lstat(plaintextOutputPath).catch(async () => {
|
|
191
|
-
await mkdir(path.dirname(plaintextOutputPath), { recursive: true })
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
// Ensure correct extension is used
|
|
195
|
-
plaintextOutputPath = path.join(
|
|
196
|
-
path.dirname(plaintextOutputPath),
|
|
197
|
-
path.basename(plaintextOutputPath, path.extname(plaintextOutputPath)) + '.' + plaintextExtension
|
|
198
|
-
)
|
|
199
|
-
|
|
200
|
-
return writeFile(plaintextOutputPath, plaintext)
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* If `plaintextOutputPath` is a directory path, output file there using the Template's name.
|
|
205
|
-
*
|
|
206
|
-
* The file will be output relative to the `build.output.path` directory.
|
|
207
|
-
*/
|
|
208
|
-
const templateFileName = get(config, 'build.current.path.name')
|
|
209
|
-
|
|
210
|
-
plaintextOutputPath = path.join(
|
|
211
|
-
get(config, 'build.current.path.dir'),
|
|
212
|
-
plaintextOutputPath,
|
|
213
|
-
templateFileName + '.' + plaintextExtension
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
// Ensure the target directory exists
|
|
217
|
-
await lstat(path.dirname(plaintextOutputPath)).catch(async () => {
|
|
218
|
-
await mkdir(path.dirname(plaintextOutputPath), { recursive: true })
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
return writeFile(plaintextOutputPath, plaintext)
|
|
222
|
-
}
|
package/src/generators/render.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { parse } from 'pathe'
|
|
2
|
-
import posthtml from 'posthtml'
|
|
3
|
-
import { cwd } from 'node:process'
|
|
4
|
-
import { defu as merge } from 'defu'
|
|
5
|
-
import expressions from 'posthtml-expressions'
|
|
6
|
-
import { parseFrontMatter } from '../utils/node.js'
|
|
7
|
-
import { getPosthtmlOptions } from '../posthtml/defaultConfig.js'
|
|
8
|
-
import { process as compilePostHTML } from '../posthtml/index.js'
|
|
9
|
-
import { run as useTransformers } from '../transformers/index.js'
|
|
10
|
-
|
|
11
|
-
export async function render(html = '', config = {}) {
|
|
12
|
-
if (typeof html !== 'string') {
|
|
13
|
-
throw new TypeError(`first argument must be a string, received ${html}`)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (html.length === 0) {
|
|
17
|
-
throw new RangeError('received empty string')
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Parse front matter
|
|
22
|
-
*
|
|
23
|
-
* Parse expressions in front matter and add to config
|
|
24
|
-
* This could be handled by components() but plugins aren't working with it currently
|
|
25
|
-
*/
|
|
26
|
-
let { content, matter } = parseFrontMatter(html)
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Compute template config
|
|
30
|
-
*
|
|
31
|
-
* Merge it with front matter data and set the `cwd` for Tailwind.
|
|
32
|
-
*/
|
|
33
|
-
const { data: matterData } = await posthtml(
|
|
34
|
-
[
|
|
35
|
-
expressions({
|
|
36
|
-
strictMode: false,
|
|
37
|
-
missingLocal: '{local}',
|
|
38
|
-
locals: {
|
|
39
|
-
page: config
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
]
|
|
43
|
-
)
|
|
44
|
-
.process(matter, getPosthtmlOptions())
|
|
45
|
-
.then(({ html }) => parseFrontMatter(`---${html}\n---`))
|
|
46
|
-
|
|
47
|
-
const templateConfig = merge(matterData, config)
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Used for PostCSS `from` to make `@config` work in Tailwind
|
|
51
|
-
*
|
|
52
|
-
* @todo use only when in Node environment
|
|
53
|
-
*/
|
|
54
|
-
templateConfig.cwd = parse(cwd()).base
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Run `beforeRender` event
|
|
58
|
-
*
|
|
59
|
-
* @param {Object} options
|
|
60
|
-
* @param {string} options.html - The HTML to be transformed
|
|
61
|
-
* @param {Object} options.matter - The front matter data
|
|
62
|
-
* @param {Object} options.config - The current template config
|
|
63
|
-
* @returns {string} - The transformed HTML, or the original one if nothing was returned
|
|
64
|
-
*/
|
|
65
|
-
if (typeof templateConfig.beforeRender === 'function') {
|
|
66
|
-
content = await templateConfig.beforeRender(({
|
|
67
|
-
html: content,
|
|
68
|
-
matter: matterData,
|
|
69
|
-
config: templateConfig,
|
|
70
|
-
})) ?? content
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Compile PostHTML
|
|
75
|
-
*/
|
|
76
|
-
const compiled = await compilePostHTML(content, templateConfig)
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Run `afterRender` event
|
|
80
|
-
*
|
|
81
|
-
* @param {Object} options
|
|
82
|
-
* @param {string} options.html - The HTML to be transformed
|
|
83
|
-
* @param {Object} options.matter - The front matter data
|
|
84
|
-
* @param {Object} options.config - The current template config
|
|
85
|
-
* @returns {string} - The transformed HTML, or the original one if nothing was returned
|
|
86
|
-
*/
|
|
87
|
-
if (typeof templateConfig.afterRender === 'function') {
|
|
88
|
-
compiled.html = await templateConfig.afterRender(({
|
|
89
|
-
html: compiled.html,
|
|
90
|
-
matter: matterData,
|
|
91
|
-
config: compiled.config,
|
|
92
|
-
})) ?? compiled.html
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Run Transformers
|
|
97
|
-
*
|
|
98
|
-
* Runs only if `useTransformers` is not explicitly disabled in the config.
|
|
99
|
-
*
|
|
100
|
-
* @param {string} html - The HTML to be transformed
|
|
101
|
-
* @param {Object} config - The current template config
|
|
102
|
-
* @returns {string} - The transformed HTML
|
|
103
|
-
*/
|
|
104
|
-
if (templateConfig.useTransformers !== false) {
|
|
105
|
-
compiled.html = await useTransformers(compiled.html, compiled.config).then(({ html }) => html)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Run `afterTransformers` event
|
|
110
|
-
*
|
|
111
|
-
* @param {Object} options
|
|
112
|
-
* @param {string} options.html - The HTML to be transformed
|
|
113
|
-
* @param {Object} options.matter - The front matter data
|
|
114
|
-
* @param {Object} options.config - The current template config
|
|
115
|
-
* @returns {string} - The transformed HTML, or the original one if nothing was returned
|
|
116
|
-
*/
|
|
117
|
-
if (typeof templateConfig.afterTransformers === 'function') {
|
|
118
|
-
compiled.html = await templateConfig.afterTransformers(({
|
|
119
|
-
html: compiled.html,
|
|
120
|
-
matter: matterData,
|
|
121
|
-
config: compiled.config,
|
|
122
|
-
})) ?? compiled.html
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return {
|
|
126
|
-
config: compiled.config,
|
|
127
|
-
html: compiled.html,
|
|
128
|
-
}
|
|
129
|
-
}
|