@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/src/server/index.js
DELETED
|
@@ -1,464 +0,0 @@
|
|
|
1
|
-
import path from 'pathe'
|
|
2
|
-
import fs from 'node:fs/promises'
|
|
3
|
-
import { createServer } from 'node:http'
|
|
4
|
-
import { cwd, exit } from 'node:process'
|
|
5
|
-
|
|
6
|
-
import { fileURLToPath } from 'node:url'
|
|
7
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
8
|
-
|
|
9
|
-
import ora from 'ora'
|
|
10
|
-
import fg from 'fast-glob'
|
|
11
|
-
import express from 'express'
|
|
12
|
-
import pico from 'picocolors'
|
|
13
|
-
import get from 'lodash-es/get.js'
|
|
14
|
-
import * as chokidar from 'chokidar'
|
|
15
|
-
import { isBinary } from 'istextorbinary'
|
|
16
|
-
|
|
17
|
-
import WebSocket, { WebSocketServer } from 'ws'
|
|
18
|
-
import { initWebSockets } from './websockets.js'
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
getLocalIP,
|
|
22
|
-
getColorizedFileSize,
|
|
23
|
-
} from '../utils/node.js'
|
|
24
|
-
import { injectScript, formatTime } from '../utils/string.js'
|
|
25
|
-
|
|
26
|
-
import { render } from '../generators/render.js'
|
|
27
|
-
import { readFileConfig } from '../utils/getConfigByFilePath.js'
|
|
28
|
-
import defaultComponentsConfig from '../posthtml/defaultComponentsConfig.js'
|
|
29
|
-
|
|
30
|
-
// Routes
|
|
31
|
-
import hmrRoute from './routes/hmr.js'
|
|
32
|
-
import indexRoute from './routes/index.js'
|
|
33
|
-
|
|
34
|
-
const app = express()
|
|
35
|
-
const wss = new WebSocketServer({ noServer: true })
|
|
36
|
-
|
|
37
|
-
// Register routes
|
|
38
|
-
app.use(indexRoute)
|
|
39
|
-
app.use(hmrRoute)
|
|
40
|
-
|
|
41
|
-
let viewing = ''
|
|
42
|
-
const spinner = ora()
|
|
43
|
-
let templatePaths = []
|
|
44
|
-
const serverStartTime = Date.now()
|
|
45
|
-
|
|
46
|
-
function getTemplateFolders(config) {
|
|
47
|
-
return Array.isArray(get(config, 'build.content'))
|
|
48
|
-
? config.build.content
|
|
49
|
-
: [config.build.content]
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function getTemplatePaths(templateFolders) {
|
|
53
|
-
return await fg.glob([...new Set(templateFolders)])
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async function getUpdatedRoutes(_app, config) {
|
|
57
|
-
return getTemplatePaths(getTemplateFolders(config))
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function renderUpdatedFile(file, config) {
|
|
61
|
-
try {
|
|
62
|
-
const startTime = Date.now()
|
|
63
|
-
spinner.start('Building...')
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Add current template path info to the config
|
|
67
|
-
*
|
|
68
|
-
* Can be used in events like `beforeRender` to determine
|
|
69
|
-
* which template file is being rendered.
|
|
70
|
-
*/
|
|
71
|
-
config.build.current = {
|
|
72
|
-
path: path.parse(file),
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Read the file
|
|
76
|
-
const fileContent = await fs.readFile(file, 'utf8')
|
|
77
|
-
|
|
78
|
-
// Set a `dev` flag on the config
|
|
79
|
-
config._dev = true
|
|
80
|
-
|
|
81
|
-
// Render the file with PostHTML
|
|
82
|
-
let { html } = await render(fileContent, config)
|
|
83
|
-
|
|
84
|
-
// Update console message
|
|
85
|
-
const shouldReportFileSize = get(config, 'server.reportFileSize', false)
|
|
86
|
-
|
|
87
|
-
spinner.succeed(
|
|
88
|
-
`Done in ${formatTime(Date.now() - startTime)}`
|
|
89
|
-
+ `${pico.gray(` [${path.relative(cwd(), file)}]`)}`
|
|
90
|
-
+ `${shouldReportFileSize ? ' · ' + getColorizedFileSize(html) : ''}`
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Inject HMR script
|
|
95
|
-
*/
|
|
96
|
-
html = injectScript(html, '<script src="/hmr.js"></script>')
|
|
97
|
-
|
|
98
|
-
// Notify connected websocket clients about the change
|
|
99
|
-
wss.clients.forEach(client => {
|
|
100
|
-
if (client.readyState === WebSocket.OPEN) {
|
|
101
|
-
client.send(JSON.stringify({
|
|
102
|
-
type: 'change',
|
|
103
|
-
content: html,
|
|
104
|
-
scrollSync: get(config, 'server.scrollSync', false),
|
|
105
|
-
hmr: get(config, 'server.hmr', true),
|
|
106
|
-
}))
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
} catch (error) {
|
|
110
|
-
spinner.fail('Failed to render template.')
|
|
111
|
-
throw error
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export default async (config = {}) => {
|
|
116
|
-
// Read the Maizzle config file
|
|
117
|
-
config = await readFileConfig(config).catch(() => { throw new Error('Could not compute config') })
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Dev server settings
|
|
121
|
-
*/
|
|
122
|
-
spinner.spinner = get(config, 'server.spinner', 'circleHalves')
|
|
123
|
-
spinner.start('Starting server...')
|
|
124
|
-
|
|
125
|
-
const shouldScroll = get(config, 'server.scrollSync', false)
|
|
126
|
-
const useHmr = get(config, 'server.hmr', true)
|
|
127
|
-
|
|
128
|
-
// Add static assets root prefix so user doesn't have to
|
|
129
|
-
if (!config.baseURL) {
|
|
130
|
-
config.baseURL = '/'
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Initialize WebSocket server
|
|
135
|
-
* Used to send messages between the server and the browser
|
|
136
|
-
*/
|
|
137
|
-
initWebSockets(wss, { shouldScroll, useHmr })
|
|
138
|
-
|
|
139
|
-
// Register routes
|
|
140
|
-
templatePaths = await getUpdatedRoutes(app, config)
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Store template paths on the request object
|
|
144
|
-
*
|
|
145
|
-
* We use it in the index view to list all templates.
|
|
146
|
-
* */
|
|
147
|
-
app.request.templatePaths = templatePaths
|
|
148
|
-
|
|
149
|
-
app.request.maizzleConfig = config
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Create route pattern
|
|
153
|
-
* Only allow files with the following extensions
|
|
154
|
-
*/
|
|
155
|
-
const extensions = [
|
|
156
|
-
...new Set(templatePaths
|
|
157
|
-
.filter(p => !isBinary(p)) // exclude binary files from routes
|
|
158
|
-
.map(p => path.extname(p).slice(1).toLowerCase())
|
|
159
|
-
)
|
|
160
|
-
].join('|')
|
|
161
|
-
|
|
162
|
-
const routePattern = Array.isArray(getTemplateFolders(config))
|
|
163
|
-
? `*/:file.(${extensions})`
|
|
164
|
-
: `:file.(${extensions})`
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Loop over the source folders and create route for each file
|
|
168
|
-
*/
|
|
169
|
-
templatePaths.forEach(() => {
|
|
170
|
-
app.get(routePattern, async (req, res, next) => {
|
|
171
|
-
// Run beforeCreate event
|
|
172
|
-
if (typeof config.beforeCreate === 'function') {
|
|
173
|
-
await config.beforeCreate({ config })
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
try {
|
|
177
|
-
const filePath = templatePaths.find(t => t.endsWith(decodeURI(req.url.slice(1))))
|
|
178
|
-
|
|
179
|
-
// Set the file being viewed
|
|
180
|
-
viewing = filePath
|
|
181
|
-
|
|
182
|
-
// Add current template path info to the config
|
|
183
|
-
config.build.current = {
|
|
184
|
-
path: path.parse(filePath),
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// Read the file
|
|
188
|
-
const fileContent = await fs.readFile(filePath, 'utf8')
|
|
189
|
-
|
|
190
|
-
// Set a `dev` flag on the config
|
|
191
|
-
config._dev = true
|
|
192
|
-
|
|
193
|
-
// Render the file with PostHTML
|
|
194
|
-
let { html } = await render(fileContent, config)
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Inject HMR script
|
|
198
|
-
*/
|
|
199
|
-
html = injectScript(html, '<script src="/hmr.js"></script>')
|
|
200
|
-
|
|
201
|
-
res.send(html)
|
|
202
|
-
} catch (error) {
|
|
203
|
-
spinner.fail(`Failed to render template: ${req.url}\n`)
|
|
204
|
-
next(error)
|
|
205
|
-
}
|
|
206
|
-
})
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Components watcher
|
|
211
|
-
*
|
|
212
|
-
* Watches for changes in the configured Templates and Components paths
|
|
213
|
-
*/
|
|
214
|
-
let isWatcherReady = false
|
|
215
|
-
chokidar
|
|
216
|
-
.watch(
|
|
217
|
-
[
|
|
218
|
-
...templatePaths,
|
|
219
|
-
...get(config, 'components.folders', defaultComponentsConfig.folders)
|
|
220
|
-
],
|
|
221
|
-
{
|
|
222
|
-
ignoreInitial: true,
|
|
223
|
-
awaitWriteFinish: {
|
|
224
|
-
stabilityThreshold: 150,
|
|
225
|
-
pollInterval: 25,
|
|
226
|
-
},
|
|
227
|
-
}
|
|
228
|
-
)
|
|
229
|
-
.on('change', async () => {
|
|
230
|
-
if (viewing) {
|
|
231
|
-
await renderUpdatedFile(viewing, config)
|
|
232
|
-
}
|
|
233
|
-
})
|
|
234
|
-
.on('ready', () => {
|
|
235
|
-
/**
|
|
236
|
-
* `add` fires immediately when the watcher is created,
|
|
237
|
-
* so we use this trick to detect new files added
|
|
238
|
-
* after it has started.
|
|
239
|
-
*/
|
|
240
|
-
isWatcherReady = true
|
|
241
|
-
})
|
|
242
|
-
.on('add', async () => {
|
|
243
|
-
if (isWatcherReady) {
|
|
244
|
-
templatePaths = await getUpdatedRoutes(app, config)
|
|
245
|
-
app.request.templatePaths = templatePaths
|
|
246
|
-
}
|
|
247
|
-
})
|
|
248
|
-
.on('unlink', async () => {
|
|
249
|
-
if (isWatcherReady) {
|
|
250
|
-
templatePaths = await getUpdatedRoutes(app, config)
|
|
251
|
-
app.request.templatePaths = templatePaths
|
|
252
|
-
}
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
let staticFiles = get(config, 'build.static', [])
|
|
256
|
-
|
|
257
|
-
if (!Array.isArray(staticFiles)) {
|
|
258
|
-
staticFiles = [staticFiles]
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
const staticFilesSourcePaths = staticFiles.flatMap((definition) => definition.source)
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Global watcher
|
|
265
|
-
*
|
|
266
|
-
* Watch for changes in the config files, Tailwind CSS config, CSS files,
|
|
267
|
-
* configured static assets, and user-defined watch paths.
|
|
268
|
-
*/
|
|
269
|
-
const globalWatchedPaths = new Set([
|
|
270
|
-
'config*.{js,cjs,ts}',
|
|
271
|
-
'maizzle.config*.{js,cjs,ts}',
|
|
272
|
-
'tailwind*.config.{js,ts}',
|
|
273
|
-
'**/*.css',
|
|
274
|
-
...staticFilesSourcePaths,
|
|
275
|
-
...get(config, 'server.watch', []),
|
|
276
|
-
])
|
|
277
|
-
|
|
278
|
-
async function globalPathsHandler(file, eventType) {
|
|
279
|
-
// Update express.static to serve new files
|
|
280
|
-
if (eventType === 'add') {
|
|
281
|
-
app.use(express.static(path.dirname(file)))
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// Stop serving deleted files
|
|
285
|
-
if (eventType === 'unlink') {
|
|
286
|
-
app._router.stack = app._router.stack.filter(
|
|
287
|
-
layer => layer.regexp.source !== path.dirname(file).replace(/\\/g, '/')
|
|
288
|
-
)
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Not viewing a component in the browser, no need to rebuild
|
|
292
|
-
if (!viewing) {
|
|
293
|
-
return
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
try {
|
|
297
|
-
const startTime = Date.now()
|
|
298
|
-
spinner.start('Building...')
|
|
299
|
-
|
|
300
|
-
// Read the Maizzle config file
|
|
301
|
-
config = await readFileConfig()
|
|
302
|
-
|
|
303
|
-
// Add static assets root prefix so user doesn't have to
|
|
304
|
-
if (!config.baseURL) {
|
|
305
|
-
config.baseURL = '/'
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// Run beforeCreate event
|
|
309
|
-
if (typeof config.beforeCreate === 'function') {
|
|
310
|
-
await config.beforeCreate({ config })
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// Read the file
|
|
314
|
-
const filePath = templatePaths.find(t => t.endsWith(viewing))
|
|
315
|
-
const fileContent = await fs.readFile(path.normalize(filePath), 'utf8')
|
|
316
|
-
|
|
317
|
-
// Set a `dev` flag on the config
|
|
318
|
-
config._dev = true
|
|
319
|
-
|
|
320
|
-
// Render the file with PostHTML
|
|
321
|
-
let { html } = await render(fileContent, config)
|
|
322
|
-
|
|
323
|
-
// Update console message
|
|
324
|
-
const shouldReportFileSize = get(config, 'server.reportFileSize', false)
|
|
325
|
-
|
|
326
|
-
spinner.succeed(
|
|
327
|
-
`Done in ${formatTime(Date.now() - startTime)}`
|
|
328
|
-
+ `${pico.gray(` [${path.relative(cwd(), filePath)}]`)}`
|
|
329
|
-
+ `${shouldReportFileSize ? ' · ' + getColorizedFileSize(html) : ''}`
|
|
330
|
-
)
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Inject HMR script
|
|
334
|
-
*/
|
|
335
|
-
html = injectScript(html, '<script src="/hmr.js"></script>')
|
|
336
|
-
|
|
337
|
-
// Notify connected websocket clients about the change
|
|
338
|
-
wss.clients.forEach(client => {
|
|
339
|
-
if (client.readyState === WebSocket.OPEN) {
|
|
340
|
-
client.send(JSON.stringify({
|
|
341
|
-
type: eventType,
|
|
342
|
-
content: html,
|
|
343
|
-
scrollSync: get(config, 'server.scrollSync', false),
|
|
344
|
-
hmr: get(config, 'server.hmr', true),
|
|
345
|
-
}))
|
|
346
|
-
}
|
|
347
|
-
})
|
|
348
|
-
} catch (error) {
|
|
349
|
-
spinner.fail(`Failed to render template: ${file}`)
|
|
350
|
-
throw error
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
chokidar
|
|
355
|
-
.watch([...globalWatchedPaths], {
|
|
356
|
-
ignored: [
|
|
357
|
-
'node_modules',
|
|
358
|
-
get(config, 'build.output.path', 'build_production'),
|
|
359
|
-
],
|
|
360
|
-
ignoreInitial: true,
|
|
361
|
-
awaitWriteFinish: {
|
|
362
|
-
stabilityThreshold: 150,
|
|
363
|
-
pollInterval: 25,
|
|
364
|
-
},
|
|
365
|
-
})
|
|
366
|
-
.on('change', async file => await globalPathsHandler(file, 'change'))
|
|
367
|
-
.on('add', async file => await globalPathsHandler(file, 'add'))
|
|
368
|
-
.on('unlink', async file => await globalPathsHandler(file, 'unlink'))
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Serve all folders in the cwd as static files
|
|
372
|
-
*/
|
|
373
|
-
const srcFoldersList = await fg.glob(
|
|
374
|
-
[
|
|
375
|
-
'**/*/',
|
|
376
|
-
...staticFilesSourcePaths,
|
|
377
|
-
], {
|
|
378
|
-
onlyFiles: false,
|
|
379
|
-
ignore: [
|
|
380
|
-
'node_modules',
|
|
381
|
-
`${get(config, 'build.output.path', 'build_*')}/**`,
|
|
382
|
-
]
|
|
383
|
-
})
|
|
384
|
-
|
|
385
|
-
srcFoldersList.forEach(folder => {
|
|
386
|
-
app.use(express.static(path.join(config.cwd, folder)))
|
|
387
|
-
})
|
|
388
|
-
|
|
389
|
-
// Error-handling middleware
|
|
390
|
-
app.use(async (req, res) => {
|
|
391
|
-
const view = await fs.readFile(path.join(__dirname, 'views', '404.html'), 'utf8')
|
|
392
|
-
const { html } = await render(view, {
|
|
393
|
-
url: req.url,
|
|
394
|
-
})
|
|
395
|
-
|
|
396
|
-
res.status(404).send(html)
|
|
397
|
-
})
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Start the server
|
|
401
|
-
*/
|
|
402
|
-
let retryCount = 0
|
|
403
|
-
const port = get(config, 'server.port', 3000)
|
|
404
|
-
const maxRetries = get(config, 'server.maxRetries', 10)
|
|
405
|
-
|
|
406
|
-
function startServer(port) {
|
|
407
|
-
const server = createServer(app)
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Handle WebSocket upgrades
|
|
411
|
-
* Attaches the WebSocket server to the Express server.
|
|
412
|
-
*/
|
|
413
|
-
server.on('upgrade', (request, socket, head) => {
|
|
414
|
-
wss.handleUpgrade(request, socket, head, ws => {
|
|
415
|
-
wss.emit('connection', ws, request)
|
|
416
|
-
})
|
|
417
|
-
})
|
|
418
|
-
|
|
419
|
-
server.listen(port, async () => {
|
|
420
|
-
const { version } = JSON.parse(
|
|
421
|
-
await fs.readFile(
|
|
422
|
-
new URL('../../package.json', import.meta.url)
|
|
423
|
-
)
|
|
424
|
-
)
|
|
425
|
-
|
|
426
|
-
spinner.stopAndPersist({
|
|
427
|
-
text: `\n${pico.bgBlue(` Maizzle v${version} `)} ready in ${pico.bold(formatTime(Date.now() - serverStartTime))}`
|
|
428
|
-
+ '\n\n'
|
|
429
|
-
+ ` → Local: http://localhost:${port}`
|
|
430
|
-
+ '\n'
|
|
431
|
-
+ ` → Network: http://${getLocalIP()}:${port}\n`
|
|
432
|
-
})
|
|
433
|
-
})
|
|
434
|
-
|
|
435
|
-
server.on('error', error => {
|
|
436
|
-
try {
|
|
437
|
-
if (error.code === 'EADDRINUSE') {
|
|
438
|
-
server.close()
|
|
439
|
-
retryPort()
|
|
440
|
-
}
|
|
441
|
-
} catch (error) {
|
|
442
|
-
spinner.fail(error.message)
|
|
443
|
-
exit(1)
|
|
444
|
-
}
|
|
445
|
-
})
|
|
446
|
-
|
|
447
|
-
return server
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
function retryPort() {
|
|
451
|
-
retryCount++
|
|
452
|
-
|
|
453
|
-
if (retryCount <= maxRetries) {
|
|
454
|
-
const nextPort = port + retryCount
|
|
455
|
-
startServer(nextPort)
|
|
456
|
-
} else {
|
|
457
|
-
spinner.fail(`Exceeded maximum number of retries (${maxRetries}). Unable to find a free port.`)
|
|
458
|
-
|
|
459
|
-
exit(1)
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
startServer(port)
|
|
464
|
-
}
|
package/src/server/routes/hmr.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import express from 'express'
|
|
2
|
-
import fs from 'node:fs/promises'
|
|
3
|
-
import { dirname, join } from 'pathe'
|
|
4
|
-
import { fileURLToPath } from 'node:url'
|
|
5
|
-
import { createRequire } from 'node:module'
|
|
6
|
-
|
|
7
|
-
const router = express.Router()
|
|
8
|
-
const require = createRequire(import.meta.url)
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
10
|
-
|
|
11
|
-
router.get('/hmr.js', async (_req, res) => {
|
|
12
|
-
try {
|
|
13
|
-
const morphdomPath = require.resolve('morphdom/dist/morphdom-umd.js')
|
|
14
|
-
const morphdomScript = await fs.readFile(morphdomPath, 'utf8')
|
|
15
|
-
|
|
16
|
-
const clientScript = await fs.readFile(join(__dirname, '../client.js'), 'utf8')
|
|
17
|
-
|
|
18
|
-
res.setHeader('Content-Type', 'application/javascript')
|
|
19
|
-
res.send(morphdomScript + clientScript)
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.error('Error reading files:', error)
|
|
22
|
-
res.status(500).send('Internal Server Error')
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
export default router
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import path from 'pathe'
|
|
2
|
-
import express from 'express'
|
|
3
|
-
const route = express.Router()
|
|
4
|
-
import posthtml from 'posthtml'
|
|
5
|
-
import fs from 'node:fs/promises'
|
|
6
|
-
import { fileURLToPath } from 'node:url'
|
|
7
|
-
import expressions from 'posthtml-expressions'
|
|
8
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
9
|
-
|
|
10
|
-
function groupFilesByDirectories(globs, files) {
|
|
11
|
-
const result = {}
|
|
12
|
-
let current = {}
|
|
13
|
-
|
|
14
|
-
globs.forEach(glob => {
|
|
15
|
-
// biome-ignore lint: needs to be escaped
|
|
16
|
-
const rootPath = glob.split(/[\*\!\{\}]/)[0].replace(/\/+$/, '')
|
|
17
|
-
|
|
18
|
-
files.forEach(file => {
|
|
19
|
-
if (file.startsWith(rootPath)) {
|
|
20
|
-
const relativePath = file.slice(rootPath.length + 1)
|
|
21
|
-
const parts = relativePath.split('/')
|
|
22
|
-
current = result[rootPath] = result[rootPath] || {}
|
|
23
|
-
|
|
24
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
25
|
-
current = current[parts[i]] = current[parts[i]] || {}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const fileName = parts[parts.length - 1]
|
|
29
|
-
current[fileName] = {
|
|
30
|
-
name: fileName,
|
|
31
|
-
href: encodeURI(file),
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
return result
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function flattenPaths(paths, parentPath = '', currentDepth = 0) {
|
|
41
|
-
const flatArray = []
|
|
42
|
-
|
|
43
|
-
for (const [key, value] of Object.entries(paths)) {
|
|
44
|
-
const fullPath = parentPath ? `${parentPath}/${key}` : key
|
|
45
|
-
|
|
46
|
-
if (value && typeof value === 'object' && !value.name) {
|
|
47
|
-
// If it's a folder, add it with the current depth and recurse into its contents
|
|
48
|
-
flatArray.push({ name: key, path: fullPath, depth: currentDepth, type: 'folder' })
|
|
49
|
-
flatArray.push(...flattenPaths(value, fullPath, currentDepth + 1))
|
|
50
|
-
} else if (value && typeof value === 'object' && value.name) {
|
|
51
|
-
// If it's a file, add it with the current depth
|
|
52
|
-
flatArray.push({ name: value.name, href: value.href, path: fullPath, depth: currentDepth, type: 'file' })
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return flatArray
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
route.get(['/', '/index.html'], async (req, res) => {
|
|
60
|
-
const view = await fs.readFile(path.join(__dirname, '../views', 'index.html'), 'utf8')
|
|
61
|
-
|
|
62
|
-
const content = new Set(req.maizzleConfig.build.content)
|
|
63
|
-
|
|
64
|
-
const groupedByDir = groupFilesByDirectories(content, req.templatePaths)
|
|
65
|
-
|
|
66
|
-
const { html } = await posthtml()
|
|
67
|
-
.use(expressions({
|
|
68
|
-
locals: {
|
|
69
|
-
paths: flattenPaths(groupedByDir)
|
|
70
|
-
}
|
|
71
|
-
}))
|
|
72
|
-
.process(view)
|
|
73
|
-
|
|
74
|
-
res.send(html)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
export default route
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>404 - Template not found</title>
|
|
7
|
-
<style>
|
|
8
|
-
html, body {
|
|
9
|
-
font-family: Helvetica, Arial, sans-serif;
|
|
10
|
-
margin: 0;
|
|
11
|
-
padding: 0;
|
|
12
|
-
box-sizing: border-box;
|
|
13
|
-
height: 100%;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.container {
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
height: 100vh;
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
position: relative;
|
|
23
|
-
z-index: 1;
|
|
24
|
-
padding: 24px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.error-code {
|
|
28
|
-
font-size: 25rem;
|
|
29
|
-
font-weight: 700;
|
|
30
|
-
color: #f1f5f9;
|
|
31
|
-
position: fixed;
|
|
32
|
-
top: -1.5rem;
|
|
33
|
-
left: -3rem;
|
|
34
|
-
user-select: none;
|
|
35
|
-
}
|
|
36
|
-
</style>
|
|
37
|
-
</head>
|
|
38
|
-
<body>
|
|
39
|
-
<span class="error-code">404</span>
|
|
40
|
-
|
|
41
|
-
<div class="container">
|
|
42
|
-
<div style="text-align: center;">
|
|
43
|
-
<h1 style="font-size: 3rem; color: #0F172A; margin: 2.25rem 0">
|
|
44
|
-
Template Not Found
|
|
45
|
-
</h1>
|
|
46
|
-
<p style="margin: 0 0 2.25rem; font-size: 1.25rem; line-height: 1.5; color: #64748B;">
|
|
47
|
-
The Template you are looking for was not found:
|
|
48
|
-
</p>
|
|
49
|
-
<p style="margin: 1rem 0 0; font-size: 1rem; line-height: 1.5; font-weight: 600; color: #334155;">
|
|
50
|
-
{{ page.url }}
|
|
51
|
-
</p>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<div style="position: fixed; bottom: 0; right: 0; pointer-events: none; user-select: none;">
|
|
56
|
-
<svg width="883" height="536" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="a" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="1100" height="536"><path fill="#D9D9D9" d="M0 .955h1100V536H0z"/></mask><g mask="url(#a)" stroke="#94A3B8" stroke-miterlimit="10"><path d="M1056.93 92.587c0-50.03-43.95-90.587-98.168-90.587-54.22 0-98.174 40.557-98.174 90.587v483.125c0 50.029 43.954 90.586 98.174 90.586 54.218 0 98.168-40.557 98.168-90.586V92.587ZM646.241 92.587C646.241 42.556 602.287 2 548.067 2c-54.219 0-98.173 40.557-98.173 90.587v483.125c0 50.029 43.954 90.586 98.173 90.586 54.22 0 98.174-40.557 98.174-90.586V92.587Z"/><path d="M1036.18 148.383c33.41-39.402 25.88-96.336-16.82-127.164C976.657-9.61 914.955-2.66 881.544 36.742L471.586 520.215c-33.411 39.402-25.879 96.336 16.824 127.164 42.702 30.829 104.404 23.879 137.815-15.523l409.955-483.473ZM625.093 148.396c33.411-39.403 25.878-96.336-16.824-127.164C565.567-9.597 503.865-2.647 470.454 36.755L60.495 520.228c-33.41 39.402-25.878 96.336 16.825 127.164 42.702 30.829 104.404 23.879 137.815-15.523l409.958-483.473Z"/></g></svg>
|
|
57
|
-
</div>
|
|
58
|
-
</body>
|
|
59
|
-
</html>
|