@maizzle/framework 6.0.0-rc.2 → 6.0.0-rc.21
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/README.md +3 -3
- package/bin/maizzle.mjs +1 -1
- package/dist/build.d.ts +20 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +163 -0
- package/dist/build.js.map +1 -0
- package/dist/components/Body.vue +128 -0
- package/dist/components/Button.vue +148 -52
- package/dist/components/CodeBlock.vue +69 -0
- package/dist/components/CodeInline.vue +49 -0
- package/dist/components/Column.vue +108 -0
- package/dist/components/Container.vue +123 -0
- package/dist/components/Font.vue +96 -0
- package/dist/components/Head.vue +30 -0
- package/dist/components/Heading.vue +28 -0
- package/dist/components/Hr.vue +33 -0
- package/dist/components/Html.vue +137 -0
- package/dist/components/Img.vue +70 -0
- package/dist/components/Layout.vue +143 -0
- package/dist/components/Link.vue +26 -0
- package/dist/components/Markdown.vue +89 -0
- package/dist/components/MarkdownLayout.vue +39 -0
- package/dist/components/NotPlaintext.vue +14 -0
- package/dist/components/Outlook.vue +74 -11
- package/dist/components/OutlookBg.vue +241 -0
- package/dist/components/Overlap.vue +156 -0
- package/dist/components/Plaintext.vue +14 -0
- package/dist/components/Preheader.vue +15 -0
- package/dist/components/QrCode.vue +157 -0
- package/dist/components/Raw.vue +28 -0
- package/dist/components/Row.vue +184 -0
- package/dist/components/Section.vue +124 -0
- package/dist/components/Spacer.vue +70 -21
- package/dist/components/Tailwind.vue +43 -0
- package/dist/components/Text.vue +29 -0
- package/dist/components/utils.d.ts +28 -0
- package/dist/components/utils.d.ts.map +1 -0
- package/dist/components/utils.js +50 -0
- package/dist/components/utils.js.map +1 -0
- package/dist/components/utils.ts +51 -0
- package/dist/composables/{defineConfig.d.mts → defineConfig.d.ts} +2 -2
- package/dist/composables/defineConfig.d.ts.map +1 -0
- package/dist/composables/{defineConfig.mjs → defineConfig.js} +4 -5
- package/dist/composables/defineConfig.js.map +1 -0
- package/dist/composables/renderContext.d.ts +37 -0
- package/dist/composables/renderContext.d.ts.map +1 -0
- package/dist/composables/{renderContext.mjs → renderContext.js} +2 -2
- package/dist/composables/renderContext.js.map +1 -0
- package/dist/composables/useBaseUrl.d.ts +19 -0
- package/dist/composables/useBaseUrl.d.ts.map +1 -0
- package/dist/composables/useBaseUrl.js +26 -0
- package/dist/composables/useBaseUrl.js.map +1 -0
- package/dist/composables/{useConfig.d.mts → useConfig.d.ts} +2 -2
- package/dist/composables/useConfig.d.ts.map +1 -0
- package/dist/composables/{useConfig.mjs → useConfig.js} +2 -3
- package/dist/composables/useConfig.js.map +1 -0
- package/dist/composables/useCurrentTemplate.d.ts +31 -0
- package/dist/composables/useCurrentTemplate.d.ts.map +1 -0
- package/dist/composables/useCurrentTemplate.js +35 -0
- package/dist/composables/useCurrentTemplate.js.map +1 -0
- package/dist/composables/{useDoctype.d.mts → useDoctype.d.ts} +1 -1
- package/dist/composables/useDoctype.d.ts.map +1 -0
- package/dist/composables/{useDoctype.mjs → useDoctype.js} +3 -4
- package/dist/composables/useDoctype.js.map +1 -0
- package/dist/composables/{useEvent.d.mts → useEvent.d.ts} +3 -3
- package/dist/composables/useEvent.d.ts.map +1 -0
- package/dist/composables/{useEvent.mjs → useEvent.js} +4 -5
- package/dist/composables/useEvent.js.map +1 -0
- package/dist/composables/useFont.d.ts +50 -0
- package/dist/composables/useFont.d.ts.map +1 -0
- package/dist/composables/useFont.js +92 -0
- package/dist/composables/useFont.js.map +1 -0
- package/dist/composables/useOutlookFallback.d.ts +21 -0
- package/dist/composables/useOutlookFallback.d.ts.map +1 -0
- package/dist/composables/useOutlookFallback.js +29 -0
- package/dist/composables/useOutlookFallback.js.map +1 -0
- package/dist/composables/{usePlaintext.d.mts → usePlaintext.d.ts} +3 -1
- package/dist/composables/usePlaintext.d.ts.map +1 -0
- package/dist/composables/{usePlaintext.mjs → usePlaintext.js} +4 -4
- package/dist/composables/usePlaintext.js.map +1 -0
- package/dist/composables/usePreheader.d.ts +24 -0
- package/dist/composables/usePreheader.d.ts.map +1 -0
- package/dist/composables/usePreheader.js +28 -0
- package/dist/composables/usePreheader.js.map +1 -0
- package/dist/composables/useTransformers.d.ts +34 -0
- package/dist/composables/useTransformers.d.ts.map +1 -0
- package/dist/composables/useTransformers.js +48 -0
- package/dist/composables/useTransformers.js.map +1 -0
- package/dist/composables/useUrlQuery.d.ts +19 -0
- package/dist/composables/useUrlQuery.d.ts.map +1 -0
- package/dist/composables/useUrlQuery.js +26 -0
- package/dist/composables/useUrlQuery.js.map +1 -0
- package/dist/config/{defaults.d.mts → defaults.d.ts} +2 -2
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/{defaults.mjs → defaults.js} +10 -6
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/{index.d.mts → index.d.ts} +4 -4
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/{index.mjs → index.js} +12 -10
- package/dist/config/index.js.map +1 -0
- package/dist/events/{index.d.mts → index.d.ts} +30 -12
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/{index.mjs → index.js} +26 -13
- package/dist/events/index.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +38 -0
- package/dist/{plaintext.d.mts → plaintext.d.ts} +1 -1
- package/dist/plaintext.d.ts.map +1 -0
- package/dist/{plaintext.mjs → plaintext.js} +4 -5
- package/dist/plaintext.js.map +1 -0
- package/dist/{plugin.d.mts → plugin.d.ts} +2 -2
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +57 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugins/postcss/{mergeMediaQueries.d.mts → mergeMediaQueries.d.ts} +2 -2
- package/dist/plugins/postcss/mergeMediaQueries.d.ts.map +1 -0
- package/dist/plugins/postcss/{mergeMediaQueries.mjs → mergeMediaQueries.js} +2 -3
- package/dist/plugins/postcss/mergeMediaQueries.js.map +1 -0
- package/dist/plugins/postcss/{pruneVars.d.mts → pruneVars.d.ts} +1 -1
- package/dist/plugins/postcss/pruneVars.d.ts.map +1 -0
- package/dist/plugins/postcss/{pruneVars.mjs → pruneVars.js} +2 -2
- package/dist/plugins/postcss/pruneVars.js.map +1 -0
- package/dist/plugins/postcss/quoteFontFamilies.d.ts +13 -0
- package/dist/plugins/postcss/quoteFontFamilies.d.ts.map +1 -0
- package/dist/plugins/postcss/quoteFontFamilies.js +84 -0
- package/dist/plugins/postcss/quoteFontFamilies.js.map +1 -0
- package/dist/plugins/postcss/{removeDeclarations.d.mts → removeDeclarations.d.ts} +1 -1
- package/dist/plugins/postcss/removeDeclarations.d.ts.map +1 -0
- package/dist/plugins/postcss/{removeDeclarations.mjs → removeDeclarations.js} +2 -2
- package/dist/plugins/postcss/removeDeclarations.js.map +1 -0
- package/dist/plugins/postcss/resolveMaizzleImports.d.ts +16 -0
- package/dist/plugins/postcss/resolveMaizzleImports.d.ts.map +1 -0
- package/dist/plugins/postcss/resolveMaizzleImports.js +39 -0
- package/dist/plugins/postcss/resolveMaizzleImports.js.map +1 -0
- package/dist/plugins/postcss/resolveProps.d.ts +8 -0
- package/dist/plugins/postcss/resolveProps.d.ts.map +1 -0
- package/dist/plugins/postcss/resolveProps.js +144 -0
- package/dist/plugins/postcss/resolveProps.js.map +1 -0
- package/dist/plugins/postcss/{tailwindCleanup.d.mts → tailwindCleanup.d.ts} +2 -2
- package/dist/plugins/postcss/tailwindCleanup.d.ts.map +1 -0
- package/dist/plugins/postcss/tailwindCleanup.js +68 -0
- package/dist/plugins/postcss/tailwindCleanup.js.map +1 -0
- package/dist/prepare.d.ts +17 -0
- package/dist/prepare.d.ts.map +1 -0
- package/dist/prepare.js +44 -0
- package/dist/prepare.js.map +1 -0
- package/dist/render/active.d.ts +8 -0
- package/dist/render/active.d.ts.map +1 -0
- package/dist/render/active.js +12 -0
- package/dist/render/active.js.map +1 -0
- package/dist/render/{createRenderer.d.mts → createRenderer.d.ts} +15 -7
- package/dist/render/createRenderer.d.ts.map +1 -0
- package/dist/render/createRenderer.js +320 -0
- package/dist/render/createRenderer.js.map +1 -0
- package/dist/render/index.d.ts +18 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +53 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/injectFonts.d.ts +15 -0
- package/dist/render/injectFonts.d.ts.map +1 -0
- package/dist/render/injectFonts.js +45 -0
- package/dist/render/injectFonts.js.map +1 -0
- package/dist/render/plugins/codeBlockExtract.d.ts +14 -0
- package/dist/render/plugins/codeBlockExtract.d.ts.map +1 -0
- package/dist/render/plugins/codeBlockExtract.js +34 -0
- package/dist/render/plugins/codeBlockExtract.js.map +1 -0
- package/dist/render/plugins/markdownExtract.d.ts +12 -0
- package/dist/render/plugins/markdownExtract.d.ts.map +1 -0
- package/dist/render/plugins/markdownExtract.js +49 -0
- package/dist/render/plugins/markdownExtract.js.map +1 -0
- package/dist/render/plugins/rawExtract.d.ts +14 -0
- package/dist/render/plugins/rawExtract.d.ts.map +1 -0
- package/dist/render/plugins/rawExtract.js +34 -0
- package/dist/render/plugins/rawExtract.js.map +1 -0
- package/dist/render/plugins/rowSourceLocation.d.ts +18 -0
- package/dist/render/plugins/rowSourceLocation.d.ts.map +1 -0
- package/dist/render/plugins/rowSourceLocation.js +45 -0
- package/dist/render/plugins/rowSourceLocation.js.map +1 -0
- package/dist/{serve.d.mts → serve.d.ts} +4 -2
- package/dist/serve.d.ts.map +1 -0
- package/dist/{serve.mjs → serve.js} +203 -78
- package/dist/serve.js.map +1 -0
- package/dist/server/compatibility.d.ts +59 -0
- package/dist/server/compatibility.d.ts.map +1 -0
- package/dist/server/compatibility.js +911 -0
- package/dist/server/compatibility.js.map +1 -0
- package/dist/server/email.d.ts +17 -0
- package/dist/server/email.d.ts.map +1 -0
- package/dist/server/email.js +40 -0
- package/dist/server/email.js.map +1 -0
- package/dist/server/linter.d.ts +20 -0
- package/dist/server/linter.d.ts.map +1 -0
- package/dist/server/linter.js +339 -0
- package/dist/server/linter.js.map +1 -0
- package/dist/server/sfc-utils.d.ts +21 -0
- package/dist/server/sfc-utils.d.ts.map +1 -0
- package/dist/server/sfc-utils.js +198 -0
- package/dist/server/sfc-utils.js.map +1 -0
- package/dist/server/ui/App.vue +253 -77
- package/dist/server/ui/components/SidebarClose.vue +12 -0
- package/dist/server/ui/components/ui/checkbox/Checkbox.vue +35 -0
- package/dist/server/ui/components/ui/checkbox/index.ts +1 -0
- package/dist/server/ui/components/ui/command/Command.vue +5 -1
- package/dist/server/ui/components/ui/command/CommandDialog.vue +1 -1
- package/dist/server/ui/components/ui/command/CommandInput.vue +19 -1
- package/dist/server/ui/components/ui/command/CommandItem.vue +1 -1
- package/dist/server/ui/components/ui/command/CommandList.vue +1 -1
- package/dist/server/ui/components/ui/command/CommandShortcut.vue +1 -1
- package/dist/server/ui/components/ui/dialog/DialogOverlay.vue +9 -1
- package/dist/server/ui/components/ui/dropdown-menu/DropdownMenuItem.vue +1 -1
- package/dist/server/ui/components/ui/input/Input.vue +1 -1
- package/dist/server/ui/components/ui/scroll-area/ScrollBar.vue +1 -1
- package/dist/server/ui/components/ui/sheet/SheetContent.vue +1 -1
- package/dist/server/ui/components/ui/sheet/SheetOverlay.vue +9 -1
- package/dist/server/ui/components/ui/sidebar/Sidebar.vue +8 -1
- package/dist/server/ui/components/ui/sidebar/SidebarProvider.vue +1 -1
- package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +5 -4
- package/dist/server/ui/components/ui/tags-input/TagsInput.vue +26 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputInput.vue +17 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputItem.vue +19 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputItemDelete.vue +22 -0
- package/dist/server/ui/components/ui/tags-input/TagsInputItemText.vue +17 -0
- package/dist/server/ui/components/ui/tags-input/index.ts +5 -0
- package/dist/server/ui/components/ui/toggle/index.ts +3 -3
- package/dist/server/ui/components/ui/toggle-group/ToggleGroup.vue +1 -1
- package/dist/server/ui/components/ui/toggle-group/ToggleGroupItem.vue +2 -2
- package/dist/server/ui/lib/emulated-dark-mode.ts +131 -0
- package/dist/server/ui/main.css +20 -20
- package/dist/server/ui/pages/Home.vue +12 -5
- package/dist/server/ui/pages/Preview.vue +716 -276
- package/dist/tests/render/_helpers.d.ts +6 -0
- package/dist/tests/render/_helpers.d.ts.map +1 -0
- package/dist/tests/render/_helpers.js +16 -0
- package/dist/tests/render/_helpers.js.map +1 -0
- package/dist/transformers/{addAttributes.d.mts → addAttributes.d.ts} +2 -2
- package/dist/transformers/addAttributes.d.ts.map +1 -0
- package/dist/transformers/{addAttributes.mjs → addAttributes.js} +16 -13
- package/dist/transformers/addAttributes.js.map +1 -0
- package/dist/transformers/attributeToStyle.d.ts +38 -0
- package/dist/transformers/attributeToStyle.d.ts.map +1 -0
- package/dist/transformers/attributeToStyle.js +94 -0
- package/dist/transformers/attributeToStyle.js.map +1 -0
- package/dist/transformers/base.d.ts +71 -0
- package/dist/transformers/base.d.ts.map +1 -0
- package/dist/transformers/{base.mjs → base.js} +56 -30
- package/dist/transformers/base.js.map +1 -0
- package/dist/transformers/columnWidth.d.ts +31 -0
- package/dist/transformers/columnWidth.d.ts.map +1 -0
- package/dist/transformers/columnWidth.js +546 -0
- package/dist/transformers/columnWidth.js.map +1 -0
- package/dist/transformers/entities.d.ts +37 -0
- package/dist/transformers/entities.d.ts.map +1 -0
- package/dist/transformers/entities.js +73 -0
- package/dist/transformers/entities.js.map +1 -0
- package/dist/transformers/filters/defaults.d.ts +6 -0
- package/dist/transformers/filters/defaults.d.ts.map +1 -0
- package/dist/transformers/filters/defaults.js +78 -0
- package/dist/transformers/filters/defaults.js.map +1 -0
- package/dist/transformers/filters/index.d.ts +43 -0
- package/dist/transformers/filters/index.d.ts.map +1 -0
- package/dist/transformers/filters/index.js +89 -0
- package/dist/transformers/filters/index.js.map +1 -0
- package/dist/transformers/format.d.ts +22 -0
- package/dist/transformers/format.d.ts.map +1 -0
- package/dist/transformers/format.js +30 -0
- package/dist/transformers/format.js.map +1 -0
- package/dist/transformers/{index.d.mts → index.d.ts} +14 -11
- package/dist/transformers/index.d.ts.map +1 -0
- package/dist/transformers/index.js +133 -0
- package/dist/transformers/index.js.map +1 -0
- package/dist/transformers/inlineCss.d.ts +84 -0
- package/dist/transformers/inlineCss.d.ts.map +1 -0
- package/dist/transformers/inlineCss.js +91 -0
- package/dist/transformers/inlineCss.js.map +1 -0
- package/dist/transformers/inlineLink.d.ts +35 -0
- package/dist/transformers/inlineLink.d.ts.map +1 -0
- package/dist/transformers/{inlineLink.mjs → inlineLink.js} +34 -10
- package/dist/transformers/inlineLink.js.map +1 -0
- package/dist/transformers/minify.d.ts +21 -0
- package/dist/transformers/minify.d.ts.map +1 -0
- package/dist/transformers/minify.js +25 -0
- package/dist/transformers/minify.js.map +1 -0
- package/dist/transformers/msoPlaceholders.d.ts +28 -0
- package/dist/transformers/msoPlaceholders.d.ts.map +1 -0
- package/dist/transformers/msoPlaceholders.js +88 -0
- package/dist/transformers/msoPlaceholders.js.map +1 -0
- package/dist/transformers/purgeCss.d.ts +43 -0
- package/dist/transformers/purgeCss.d.ts.map +1 -0
- package/dist/transformers/purgeCss.js +181 -0
- package/dist/transformers/purgeCss.js.map +1 -0
- package/dist/transformers/removeAttributes.d.ts +54 -0
- package/dist/transformers/removeAttributes.d.ts.map +1 -0
- package/dist/transformers/removeAttributes.js +70 -0
- package/dist/transformers/removeAttributes.js.map +1 -0
- package/dist/transformers/{replaceStrings.d.mts → replaceStrings.d.ts} +2 -2
- package/dist/transformers/replaceStrings.d.ts.map +1 -0
- package/dist/transformers/{replaceStrings.mjs → replaceStrings.js} +2 -2
- package/dist/transformers/replaceStrings.js.map +1 -0
- package/dist/transformers/{safeClassNames.d.mts → safeClassNames.d.ts} +2 -2
- package/dist/transformers/safeClassNames.d.ts.map +1 -0
- package/dist/transformers/{safeClassNames.mjs → safeClassNames.js} +4 -5
- package/dist/transformers/safeClassNames.js.map +1 -0
- package/dist/transformers/shorthandCss.d.ts +47 -0
- package/dist/transformers/shorthandCss.d.ts.map +1 -0
- package/dist/transformers/shorthandCss.js +61 -0
- package/dist/transformers/shorthandCss.js.map +1 -0
- package/dist/transformers/sixHex.d.ts +25 -0
- package/dist/transformers/sixHex.d.ts.map +1 -0
- package/dist/transformers/sixHex.js +42 -0
- package/dist/transformers/sixHex.js.map +1 -0
- package/dist/transformers/tailwindComponent.d.ts +16 -0
- package/dist/transformers/tailwindComponent.d.ts.map +1 -0
- package/dist/transformers/tailwindComponent.js +92 -0
- package/dist/transformers/tailwindComponent.js.map +1 -0
- package/dist/transformers/{tailwindcss.d.mts → tailwindcss.d.ts} +8 -4
- package/dist/transformers/tailwindcss.d.ts.map +1 -0
- package/dist/transformers/tailwindcss.js +97 -0
- package/dist/transformers/tailwindcss.js.map +1 -0
- package/dist/transformers/urlQuery.d.ts +36 -0
- package/dist/transformers/urlQuery.d.ts.map +1 -0
- package/dist/transformers/urlQuery.js +77 -0
- package/dist/transformers/urlQuery.js.map +1 -0
- package/dist/types/config.d.ts +737 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/ast/index.d.ts +4 -0
- package/dist/utils/ast/index.js +4 -0
- package/dist/utils/ast/{parser.d.mts → parser.d.ts} +1 -1
- package/dist/utils/ast/parser.d.ts.map +1 -0
- package/dist/utils/ast/{parser.mjs → parser.js} +2 -3
- package/dist/utils/ast/parser.js.map +1 -0
- package/dist/utils/ast/serializer.d.ts +8 -0
- package/dist/utils/ast/serializer.d.ts.map +1 -0
- package/dist/utils/ast/serializer.js +36 -0
- package/dist/utils/ast/serializer.js.map +1 -0
- package/dist/utils/ast/{walker.d.mts → walker.d.ts} +1 -1
- package/dist/utils/ast/walker.d.ts.map +1 -0
- package/dist/utils/ast/{walker.mjs → walker.js} +2 -2
- package/dist/utils/ast/walker.js.map +1 -0
- package/dist/utils/compileTailwindCss.d.ts +16 -0
- package/dist/utils/compileTailwindCss.d.ts.map +1 -0
- package/dist/utils/compileTailwindCss.js +54 -0
- package/dist/utils/compileTailwindCss.js.map +1 -0
- package/dist/utils/componentSources.d.ts +50 -0
- package/dist/utils/componentSources.d.ts.map +1 -0
- package/dist/utils/componentSources.js +50 -0
- package/dist/utils/componentSources.js.map +1 -0
- package/dist/utils/decodeStyleEntities.d.ts +15 -0
- package/dist/utils/decodeStyleEntities.d.ts.map +1 -0
- package/dist/utils/decodeStyleEntities.js +18 -0
- package/dist/utils/decodeStyleEntities.js.map +1 -0
- package/dist/utils/detect.d.ts +5 -0
- package/dist/utils/detect.d.ts.map +1 -0
- package/dist/utils/detect.js +10 -0
- package/dist/utils/detect.js.map +1 -0
- package/dist/utils/output-markers.d.ts +29 -0
- package/dist/utils/output-markers.d.ts.map +1 -0
- package/dist/utils/output-markers.js +68 -0
- package/dist/utils/output-markers.js.map +1 -0
- package/dist/utils/{url.d.mts → url.d.ts} +1 -1
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/{url.mjs → url.js} +2 -3
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/watchPaths.d.ts +11 -0
- package/dist/utils/watchPaths.d.ts.map +1 -0
- package/dist/utils/watchPaths.js +19 -0
- package/dist/utils/watchPaths.js.map +1 -0
- package/node_modules/@clack/core/CHANGELOG.md +8 -0
- package/node_modules/@clack/core/dist/index.d.mts +18 -4
- package/node_modules/@clack/core/dist/index.mjs +16 -10
- package/node_modules/@clack/core/dist/index.mjs.map +1 -1
- package/node_modules/@clack/core/package.json +5 -2
- package/node_modules/@clack/prompts/CHANGELOG.md +15 -0
- package/node_modules/@clack/prompts/README.md +107 -2
- package/node_modules/@clack/prompts/dist/index.d.mts +16 -11
- package/node_modules/@clack/prompts/dist/index.mjs +114 -107
- package/node_modules/@clack/prompts/dist/index.mjs.map +1 -1
- package/node_modules/@clack/prompts/package.json +7 -4
- package/node_modules/fast-string-truncated-width/dist/index.js +36 -96
- package/node_modules/fast-string-truncated-width/dist/types.d.ts +0 -3
- package/node_modules/fast-string-truncated-width/dist/utils.d.ts +3 -3
- package/node_modules/fast-string-truncated-width/dist/utils.js +14 -9
- package/node_modules/fast-string-truncated-width/package.json +1 -1
- package/node_modules/fast-string-truncated-width/readme.md +2 -3
- package/node_modules/fast-string-width/package.json +2 -2
- package/node_modules/fast-string-width/readme.md +0 -3
- package/node_modules/fast-wrap-ansi/lib/main.js +4 -1
- package/node_modules/fast-wrap-ansi/lib/main.js.map +1 -1
- package/node_modules/fast-wrap-ansi/package.json +2 -2
- package/node_modules/maizzle/README.md +24 -0
- package/node_modules/maizzle/dist/commands/make/component.mjs +1 -1
- package/node_modules/maizzle/dist/commands/make/config.mjs +1 -1
- package/node_modules/maizzle/dist/commands/make/layout.mjs +3 -3
- package/node_modules/maizzle/dist/commands/make/scaffold.mjs +1 -1
- package/node_modules/maizzle/dist/commands/make/stubs/Layout.vue +146 -0
- package/node_modules/maizzle/dist/commands/make/stubs/component.vue +2 -4
- package/node_modules/maizzle/dist/commands/make/stubs/config.ts +1 -5
- package/node_modules/maizzle/dist/commands/make/template.mjs +1 -1
- package/node_modules/maizzle/dist/commands/new.mjs +32 -52
- package/node_modules/maizzle/dist/index.d.mts +1 -0
- package/node_modules/maizzle/dist/index.mjs +30 -7
- package/node_modules/maizzle/package.json +4 -3
- package/node_modules/nypm/dist/cli.mjs +28 -5
- package/node_modules/nypm/dist/index.d.mts +0 -8
- package/node_modules/nypm/dist/index.mjs +27 -4
- package/node_modules/nypm/package.json +12 -12
- package/node_modules/tinyexec/README.md +1 -1
- package/node_modules/tinyexec/dist/main.d.mts +6 -6
- package/node_modules/tinyexec/dist/main.mjs +126 -134
- package/node_modules/tinyexec/package.json +9 -9
- package/package.json +31 -21
- package/dist/build.d.mts +0 -19
- package/dist/build.d.mts.map +0 -1
- package/dist/build.mjs +0 -139
- package/dist/build.mjs.map +0 -1
- package/dist/components/Divider.vue +0 -105
- package/dist/components/Vml.vue +0 -89
- package/dist/components/utils.d.mts +0 -5
- package/dist/components/utils.d.mts.map +0 -1
- package/dist/components/utils.mjs +0 -9
- package/dist/components/utils.mjs.map +0 -1
- package/dist/composables/defineConfig.d.mts.map +0 -1
- package/dist/composables/defineConfig.mjs.map +0 -1
- package/dist/composables/renderContext.d.mts +0 -19
- package/dist/composables/renderContext.d.mts.map +0 -1
- package/dist/composables/renderContext.mjs.map +0 -1
- package/dist/composables/useConfig.d.mts.map +0 -1
- package/dist/composables/useConfig.mjs.map +0 -1
- package/dist/composables/useDoctype.d.mts.map +0 -1
- package/dist/composables/useDoctype.mjs.map +0 -1
- package/dist/composables/useEvent.d.mts.map +0 -1
- package/dist/composables/useEvent.mjs.map +0 -1
- package/dist/composables/usePlaintext.d.mts.map +0 -1
- package/dist/composables/usePlaintext.mjs.map +0 -1
- package/dist/config/defaults.d.mts.map +0 -1
- package/dist/config/defaults.mjs.map +0 -1
- package/dist/config/index.d.mts.map +0 -1
- package/dist/config/index.mjs.map +0 -1
- package/dist/events/index.d.mts.map +0 -1
- package/dist/events/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -29
- package/dist/index.mjs +0 -29
- package/dist/plaintext.d.mts.map +0 -1
- package/dist/plaintext.mjs.map +0 -1
- package/dist/plugin.d.mts.map +0 -1
- package/dist/plugin.mjs +0 -41
- package/dist/plugin.mjs.map +0 -1
- package/dist/plugins/postcss/mergeMediaQueries.d.mts.map +0 -1
- package/dist/plugins/postcss/mergeMediaQueries.mjs.map +0 -1
- package/dist/plugins/postcss/pruneVars.d.mts.map +0 -1
- package/dist/plugins/postcss/pruneVars.mjs.map +0 -1
- package/dist/plugins/postcss/removeDeclarations.d.mts.map +0 -1
- package/dist/plugins/postcss/removeDeclarations.mjs.map +0 -1
- package/dist/plugins/postcss/tailwindCleanup.d.mts.map +0 -1
- package/dist/plugins/postcss/tailwindCleanup.mjs +0 -35
- package/dist/plugins/postcss/tailwindCleanup.mjs.map +0 -1
- package/dist/render/createRenderer.d.mts.map +0 -1
- package/dist/render/createRenderer.mjs +0 -155
- package/dist/render/createRenderer.mjs.map +0 -1
- package/dist/render/index.d.mts +0 -26
- package/dist/render/index.d.mts.map +0 -1
- package/dist/render/index.mjs +0 -44
- package/dist/render/index.mjs.map +0 -1
- package/dist/serve.d.mts.map +0 -1
- package/dist/serve.mjs.map +0 -1
- package/dist/server/compatibility.d.mts +0 -6
- package/dist/server/compatibility.d.mts.map +0 -1
- package/dist/server/compatibility.mjs +0 -83
- package/dist/server/compatibility.mjs.map +0 -1
- package/dist/server/linter.d.mts +0 -6
- package/dist/server/linter.d.mts.map +0 -1
- package/dist/server/linter.mjs +0 -200
- package/dist/server/linter.mjs.map +0 -1
- package/dist/server/ui/components/ui/resizable/ResizableHandle.vue +0 -30
- package/dist/server/ui/components/ui/resizable/ResizablePanel.vue +0 -21
- package/dist/server/ui/components/ui/resizable/ResizablePanelGroup.vue +0 -25
- package/dist/server/ui/components/ui/resizable/index.ts +0 -3
- package/dist/transformers/addAttributes.d.mts.map +0 -1
- package/dist/transformers/addAttributes.mjs.map +0 -1
- package/dist/transformers/attributeToStyle.d.mts +0 -25
- package/dist/transformers/attributeToStyle.d.mts.map +0 -1
- package/dist/transformers/attributeToStyle.mjs +0 -80
- package/dist/transformers/attributeToStyle.mjs.map +0 -1
- package/dist/transformers/base.d.mts +0 -8
- package/dist/transformers/base.d.mts.map +0 -1
- package/dist/transformers/base.mjs.map +0 -1
- package/dist/transformers/entities.d.mts +0 -8
- package/dist/transformers/entities.d.mts.map +0 -1
- package/dist/transformers/entities.mjs +0 -38
- package/dist/transformers/entities.mjs.map +0 -1
- package/dist/transformers/format.d.mts +0 -15
- package/dist/transformers/format.d.mts.map +0 -1
- package/dist/transformers/format.mjs +0 -26
- package/dist/transformers/format.mjs.map +0 -1
- package/dist/transformers/index.d.mts.map +0 -1
- package/dist/transformers/index.mjs +0 -73
- package/dist/transformers/index.mjs.map +0 -1
- package/dist/transformers/inlineCSS.d.mts +0 -30
- package/dist/transformers/inlineCSS.d.mts.map +0 -1
- package/dist/transformers/inlineCSS.mjs +0 -79
- package/dist/transformers/inlineCSS.mjs.map +0 -1
- package/dist/transformers/inlineLink.d.mts +0 -14
- package/dist/transformers/inlineLink.d.mts.map +0 -1
- package/dist/transformers/inlineLink.mjs.map +0 -1
- package/dist/transformers/minify.d.mts +0 -17
- package/dist/transformers/minify.d.mts.map +0 -1
- package/dist/transformers/minify.mjs +0 -24
- package/dist/transformers/minify.mjs.map +0 -1
- package/dist/transformers/purgeCSS.d.mts +0 -23
- package/dist/transformers/purgeCSS.d.mts.map +0 -1
- package/dist/transformers/purgeCSS.mjs +0 -66
- package/dist/transformers/purgeCSS.mjs.map +0 -1
- package/dist/transformers/removeAttributes.d.mts +0 -31
- package/dist/transformers/removeAttributes.d.mts.map +0 -1
- package/dist/transformers/removeAttributes.mjs +0 -63
- package/dist/transformers/removeAttributes.mjs.map +0 -1
- package/dist/transformers/replaceStrings.d.mts.map +0 -1
- package/dist/transformers/replaceStrings.mjs.map +0 -1
- package/dist/transformers/safeClassNames.d.mts.map +0 -1
- package/dist/transformers/safeClassNames.mjs.map +0 -1
- package/dist/transformers/shorthandCSS.d.mts +0 -24
- package/dist/transformers/shorthandCSS.d.mts.map +0 -1
- package/dist/transformers/shorthandCSS.mjs +0 -48
- package/dist/transformers/shorthandCSS.mjs.map +0 -1
- package/dist/transformers/tailwindcss.d.mts.map +0 -1
- package/dist/transformers/tailwindcss.mjs +0 -136
- package/dist/transformers/tailwindcss.mjs.map +0 -1
- package/dist/transformers/urlQuery.d.mts +0 -24
- package/dist/transformers/urlQuery.d.mts.map +0 -1
- package/dist/transformers/urlQuery.mjs +0 -65
- package/dist/transformers/urlQuery.mjs.map +0 -1
- package/dist/types/config.d.mts +0 -149
- package/dist/types/config.d.mts.map +0 -1
- package/dist/types/config.mjs +0 -1
- package/dist/types/index.d.mts +0 -2
- package/dist/types/index.mjs +0 -1
- package/dist/utils/ast/index.d.mts +0 -4
- package/dist/utils/ast/index.mjs +0 -5
- package/dist/utils/ast/parser.d.mts.map +0 -1
- package/dist/utils/ast/parser.mjs.map +0 -1
- package/dist/utils/ast/serializer.d.mts +0 -7
- package/dist/utils/ast/serializer.d.mts.map +0 -1
- package/dist/utils/ast/serializer.mjs +0 -13
- package/dist/utils/ast/serializer.mjs.map +0 -1
- package/dist/utils/ast/walker.d.mts.map +0 -1
- package/dist/utils/ast/walker.mjs.map +0 -1
- package/dist/utils/url.d.mts.map +0 -1
- package/dist/utils/url.mjs.map +0 -1
- package/node_modules/maizzle/dist/commands/make/stubs/layout.vue +0 -39
|
@@ -0,0 +1,911 @@
|
|
|
1
|
+
import { tailwindcss } from "../transformers/tailwindcss.js";
|
|
2
|
+
import { buildComponentMap, findComponentTags, isFrameworkComponent, parseSfcBlocks } from "./sfc-utils.js";
|
|
3
|
+
import { scanLint } from "./linter.js";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { resolve } from "node:path";
|
|
6
|
+
import { Parser } from "htmlparser2";
|
|
7
|
+
import { DomHandler } from "domhandler";
|
|
8
|
+
import safeParser from "postcss-safe-parser";
|
|
9
|
+
import valueParser from "postcss-value-parser";
|
|
10
|
+
//#region src/server/compatibility.ts
|
|
11
|
+
const API_URL = "https://www.caniemail.com/api/data.json";
|
|
12
|
+
const DEFAULT_CLIENTS = new Set([
|
|
13
|
+
"gmail",
|
|
14
|
+
"apple-mail",
|
|
15
|
+
"outlook",
|
|
16
|
+
"yahoo"
|
|
17
|
+
]);
|
|
18
|
+
let indexes = null;
|
|
19
|
+
let initPromise = null;
|
|
20
|
+
function mpush(m, k, v) {
|
|
21
|
+
const arr = m.get(k);
|
|
22
|
+
if (arr) arr.push(v);
|
|
23
|
+
else m.set(k, [v]);
|
|
24
|
+
}
|
|
25
|
+
function emptyIndexes(nicenames, familyNicenames) {
|
|
26
|
+
return {
|
|
27
|
+
nicenames,
|
|
28
|
+
familyNicenames,
|
|
29
|
+
cssProp: /* @__PURE__ */ new Map(),
|
|
30
|
+
cssPropValue: /* @__PURE__ */ new Map(),
|
|
31
|
+
cssAtRule: /* @__PURE__ */ new Map(),
|
|
32
|
+
cssMediaFeature: /* @__PURE__ */ new Map(),
|
|
33
|
+
cssPseudoClass: /* @__PURE__ */ new Map(),
|
|
34
|
+
cssPseudoElement: /* @__PURE__ */ new Map(),
|
|
35
|
+
cssFunction: /* @__PURE__ */ new Map(),
|
|
36
|
+
cssUnit: /* @__PURE__ */ new Map(),
|
|
37
|
+
htmlTag: /* @__PURE__ */ new Map(),
|
|
38
|
+
htmlAttr: /* @__PURE__ */ new Map(),
|
|
39
|
+
htmlInputType: /* @__PURE__ */ new Map(),
|
|
40
|
+
htmlButtonType: /* @__PURE__ */ new Map(),
|
|
41
|
+
imageExt: /* @__PURE__ */ new Map(),
|
|
42
|
+
bySlug: /* @__PURE__ */ new Map()
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function hasAnyNonY(stats) {
|
|
46
|
+
if (!stats) return false;
|
|
47
|
+
for (const family in stats) for (const plat in stats[family]) for (const ver in stats[family][plat]) {
|
|
48
|
+
const v = stripNotes(String(stats[family][plat][ver]).trim());
|
|
49
|
+
if (v && v !== "y") return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
/** Strip `#N` note markers — `"y #1"` → `"y"`. Notes document edge cases but
|
|
54
|
+
* don't change support semantics, so treat `y #1` as fully supported. */
|
|
55
|
+
function stripNotes(v) {
|
|
56
|
+
return v.split(/\s+/).filter((t) => t && !t.startsWith("#")).join(" ");
|
|
57
|
+
}
|
|
58
|
+
function computeSupport(stats, familyNicenames, allowedClients) {
|
|
59
|
+
let nY = 0, nN = 0, nU = 0, nPartial = 0, total = 0;
|
|
60
|
+
const affectedFamilies = /* @__PURE__ */ new Set();
|
|
61
|
+
for (const family in stats) {
|
|
62
|
+
if (allowedClients !== "all" && !allowedClients.has(family)) continue;
|
|
63
|
+
let familyHasNonY = false;
|
|
64
|
+
for (const plat in stats[family]) {
|
|
65
|
+
const versions = Object.keys(stats[family][plat]).sort();
|
|
66
|
+
const latest = versions[versions.length - 1];
|
|
67
|
+
if (!latest) continue;
|
|
68
|
+
total++;
|
|
69
|
+
const v = stripNotes(String(stats[family][plat][latest]).trim());
|
|
70
|
+
if (v === "y") nY++;
|
|
71
|
+
else if (v === "n") {
|
|
72
|
+
nN++;
|
|
73
|
+
familyHasNonY = true;
|
|
74
|
+
} else if (v === "u") {
|
|
75
|
+
nU++;
|
|
76
|
+
familyHasNonY = true;
|
|
77
|
+
} else {
|
|
78
|
+
nPartial++;
|
|
79
|
+
familyHasNonY = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (familyHasNonY) affectedFamilies.add(family);
|
|
83
|
+
}
|
|
84
|
+
if (!total) return null;
|
|
85
|
+
if (nY === total) return null;
|
|
86
|
+
const affected = [...affectedFamilies].map((f) => familyNicenames[f] ?? f).sort();
|
|
87
|
+
if (nN === total) return {
|
|
88
|
+
level: "unsupported",
|
|
89
|
+
affected
|
|
90
|
+
};
|
|
91
|
+
if (nU === total) return {
|
|
92
|
+
level: "unknown",
|
|
93
|
+
affected
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
level: "mitigated",
|
|
97
|
+
affected
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Slugs we never report. Fundamental HTML (every email uses these) plus
|
|
102
|
+
* CSS noise that's not actionable (comments, !important usage).
|
|
103
|
+
*/
|
|
104
|
+
const IGNORED_SLUGS = new Set([
|
|
105
|
+
"html-doctype",
|
|
106
|
+
"html-comments",
|
|
107
|
+
"html-html",
|
|
108
|
+
"html-head",
|
|
109
|
+
"html-body",
|
|
110
|
+
"html-title",
|
|
111
|
+
"html-meta",
|
|
112
|
+
"html-meta-color-scheme",
|
|
113
|
+
"html-style",
|
|
114
|
+
"html-link",
|
|
115
|
+
"html-div",
|
|
116
|
+
"html-span",
|
|
117
|
+
"html-br",
|
|
118
|
+
"html-p",
|
|
119
|
+
"html-a",
|
|
120
|
+
"html-img",
|
|
121
|
+
"html-table",
|
|
122
|
+
"html-tr",
|
|
123
|
+
"html-td",
|
|
124
|
+
"html-th",
|
|
125
|
+
"html-thead",
|
|
126
|
+
"html-tbody",
|
|
127
|
+
"html-tfoot",
|
|
128
|
+
"html-h1-h6",
|
|
129
|
+
"html-lists",
|
|
130
|
+
"html-strong",
|
|
131
|
+
"html-em",
|
|
132
|
+
"html-b",
|
|
133
|
+
"html-i",
|
|
134
|
+
"html-u",
|
|
135
|
+
"html-semantics",
|
|
136
|
+
"html-role",
|
|
137
|
+
"html-hidden",
|
|
138
|
+
"html-width",
|
|
139
|
+
"html-height",
|
|
140
|
+
"css-comments",
|
|
141
|
+
"css-important",
|
|
142
|
+
"css-margin",
|
|
143
|
+
"css-padding",
|
|
144
|
+
"css-border",
|
|
145
|
+
"css-font-size",
|
|
146
|
+
"css-font-weight",
|
|
147
|
+
"css-font",
|
|
148
|
+
"css-font-family",
|
|
149
|
+
"css-line-height",
|
|
150
|
+
"css-letter-spacing",
|
|
151
|
+
"css-text-align",
|
|
152
|
+
"css-text-decoration",
|
|
153
|
+
"css-text-transform",
|
|
154
|
+
"css-color",
|
|
155
|
+
"css-background",
|
|
156
|
+
"css-background-color",
|
|
157
|
+
"css-width",
|
|
158
|
+
"css-height",
|
|
159
|
+
"css-display"
|
|
160
|
+
]);
|
|
161
|
+
function classify(f, idx) {
|
|
162
|
+
const slug = f.slug;
|
|
163
|
+
if (slug === "html-style") {
|
|
164
|
+
idx.htmlStyleInBody = {
|
|
165
|
+
...f,
|
|
166
|
+
title: `${f.title} in <body>`
|
|
167
|
+
};
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (IGNORED_SLUGS.has(slug)) return;
|
|
171
|
+
if (f.category === "css") return classifyCss(f, slug, idx);
|
|
172
|
+
if (f.category === "html") return classifyHtml(f, slug, idx);
|
|
173
|
+
if (f.category === "image") {
|
|
174
|
+
const ext = slug.slice(6);
|
|
175
|
+
if (ext === "base64") return;
|
|
176
|
+
mpush(idx.imageExt, ext, f);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function classifyCss(f, slug, idx) {
|
|
180
|
+
switch (slug) {
|
|
181
|
+
case "css-important":
|
|
182
|
+
idx.cssImportant = f;
|
|
183
|
+
return;
|
|
184
|
+
case "css-variables":
|
|
185
|
+
idx.cssVariables = f;
|
|
186
|
+
return;
|
|
187
|
+
case "css-nesting":
|
|
188
|
+
idx.cssNesting = f;
|
|
189
|
+
return;
|
|
190
|
+
case "css-comments":
|
|
191
|
+
idx.cssComments = f;
|
|
192
|
+
return;
|
|
193
|
+
case "css-modern-color":
|
|
194
|
+
idx.cssModernColor = f;
|
|
195
|
+
return;
|
|
196
|
+
case "css-display-flex":
|
|
197
|
+
mpushPropValue(idx, "display", "flex", f);
|
|
198
|
+
return;
|
|
199
|
+
case "css-display-grid":
|
|
200
|
+
mpushPropValue(idx, "display", "grid", f);
|
|
201
|
+
return;
|
|
202
|
+
case "css-display-none":
|
|
203
|
+
mpushPropValue(idx, "display", "none", f);
|
|
204
|
+
return;
|
|
205
|
+
case "css-rgb":
|
|
206
|
+
mpush(idx.cssFunction, "rgb", f);
|
|
207
|
+
return;
|
|
208
|
+
case "css-rgba":
|
|
209
|
+
mpush(idx.cssFunction, "rgba", f);
|
|
210
|
+
return;
|
|
211
|
+
case "css-linear-gradient":
|
|
212
|
+
mpush(idx.cssFunction, "linear-gradient", f);
|
|
213
|
+
return;
|
|
214
|
+
case "css-radial-gradient":
|
|
215
|
+
mpush(idx.cssFunction, "radial-gradient", f);
|
|
216
|
+
return;
|
|
217
|
+
case "css-conic-gradient":
|
|
218
|
+
mpush(idx.cssFunction, "conic-gradient", f);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (slug.startsWith("css-at-media-") && slug !== "css-at-media") {
|
|
222
|
+
mpush(idx.cssMediaFeature, slug.slice(13), f);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (slug.startsWith("css-at-")) {
|
|
226
|
+
mpush(idx.cssAtRule, slug.slice(7), f);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (slug.startsWith("css-pseudo-class-")) {
|
|
230
|
+
mpush(idx.cssPseudoClass, slug.slice(17), f);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (slug.startsWith("css-pseudo-element-")) {
|
|
234
|
+
mpush(idx.cssPseudoElement, slug.slice(19), f);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (slug.startsWith("css-unit-")) {
|
|
238
|
+
const u = slug.slice(9);
|
|
239
|
+
if (u === "calc") {
|
|
240
|
+
mpush(idx.cssFunction, "calc", f);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (u === "initial") return;
|
|
244
|
+
const unit = u === "percent" ? "%" : u;
|
|
245
|
+
mpush(idx.cssUnit, unit, f);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (slug.startsWith("css-function-")) {
|
|
249
|
+
mpush(idx.cssFunction, slug.slice(13), f);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (slug.startsWith("css-selector-")) return;
|
|
253
|
+
mpush(idx.cssProp, slug.slice(4), f);
|
|
254
|
+
}
|
|
255
|
+
function mpushPropValue(idx, prop, value, f) {
|
|
256
|
+
const arr = idx.cssPropValue.get(prop);
|
|
257
|
+
if (arr) arr.push({
|
|
258
|
+
value,
|
|
259
|
+
feature: f
|
|
260
|
+
});
|
|
261
|
+
else idx.cssPropValue.set(prop, [{
|
|
262
|
+
value,
|
|
263
|
+
feature: f
|
|
264
|
+
}]);
|
|
265
|
+
}
|
|
266
|
+
const HTML_ATTR_SLUGS = new Set([
|
|
267
|
+
"align",
|
|
268
|
+
"background",
|
|
269
|
+
"cellpadding",
|
|
270
|
+
"cellspacing",
|
|
271
|
+
"height",
|
|
272
|
+
"width",
|
|
273
|
+
"valign",
|
|
274
|
+
"target",
|
|
275
|
+
"srcset",
|
|
276
|
+
"lang",
|
|
277
|
+
"dir",
|
|
278
|
+
"role",
|
|
279
|
+
"required",
|
|
280
|
+
"hidden"
|
|
281
|
+
]);
|
|
282
|
+
function classifyHtml(f, slug, idx) {
|
|
283
|
+
switch (slug) {
|
|
284
|
+
case "html-doctype":
|
|
285
|
+
idx.htmlDoctype = f;
|
|
286
|
+
return;
|
|
287
|
+
case "html-comments":
|
|
288
|
+
idx.htmlComments = f;
|
|
289
|
+
return;
|
|
290
|
+
case "html-anchor-links":
|
|
291
|
+
idx.htmlAnchorLinks = f;
|
|
292
|
+
return;
|
|
293
|
+
case "html-mailto-links":
|
|
294
|
+
idx.htmlMailtoLinks = f;
|
|
295
|
+
return;
|
|
296
|
+
case "html-meta-color-scheme":
|
|
297
|
+
idx.htmlMetaColorScheme = f;
|
|
298
|
+
return;
|
|
299
|
+
case "html-semantics":
|
|
300
|
+
idx.htmlSemantics = f;
|
|
301
|
+
return;
|
|
302
|
+
case "html-loading-attribute":
|
|
303
|
+
mpush(idx.htmlAttr, "loading", f);
|
|
304
|
+
return;
|
|
305
|
+
case "html-image-maps":
|
|
306
|
+
mpush(idx.htmlTag, "map", f);
|
|
307
|
+
mpush(idx.htmlTag, "area", f);
|
|
308
|
+
mpush(idx.htmlAttr, "usemap", f);
|
|
309
|
+
return;
|
|
310
|
+
case "html-lists":
|
|
311
|
+
for (const t of [
|
|
312
|
+
"ul",
|
|
313
|
+
"ol",
|
|
314
|
+
"li",
|
|
315
|
+
"dl",
|
|
316
|
+
"dt",
|
|
317
|
+
"dd"
|
|
318
|
+
]) mpush(idx.htmlTag, t, f);
|
|
319
|
+
return;
|
|
320
|
+
case "html-h1-h6":
|
|
321
|
+
for (const t of [
|
|
322
|
+
"h1",
|
|
323
|
+
"h2",
|
|
324
|
+
"h3",
|
|
325
|
+
"h4",
|
|
326
|
+
"h5",
|
|
327
|
+
"h6"
|
|
328
|
+
]) mpush(idx.htmlTag, t, f);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (slug.startsWith("html-input-")) {
|
|
332
|
+
mpush(idx.htmlInputType, slug.slice(11), f);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (slug.startsWith("html-button-")) {
|
|
336
|
+
mpush(idx.htmlButtonType, slug.slice(12), f);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (slug.startsWith("html-aria-")) {
|
|
340
|
+
mpush(idx.htmlAttr, slug.slice(5), f);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const name = slug.slice(5);
|
|
344
|
+
if (HTML_ATTR_SLUGS.has(name)) {
|
|
345
|
+
mpush(idx.htmlAttr, name, f);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
mpush(idx.htmlTag, name, f);
|
|
349
|
+
}
|
|
350
|
+
async function initCompatibility() {
|
|
351
|
+
if (indexes) return indexes;
|
|
352
|
+
if (initPromise) return initPromise;
|
|
353
|
+
initPromise = (async () => {
|
|
354
|
+
try {
|
|
355
|
+
const res = await fetch(API_URL);
|
|
356
|
+
if (!res.ok) return null;
|
|
357
|
+
const data = await res.json();
|
|
358
|
+
const idx = emptyIndexes(data.nicenames?.support ?? {}, data.nicenames?.family ?? {});
|
|
359
|
+
for (const item of data.data ?? []) {
|
|
360
|
+
if (item.slug && item.url) idx.bySlug.set(item.slug, {
|
|
361
|
+
title: item.title,
|
|
362
|
+
url: item.url
|
|
363
|
+
});
|
|
364
|
+
if (!hasAnyNonY(item.stats)) continue;
|
|
365
|
+
classify({
|
|
366
|
+
slug: item.slug,
|
|
367
|
+
title: item.title,
|
|
368
|
+
url: item.url,
|
|
369
|
+
category: item.category,
|
|
370
|
+
stats: item.stats
|
|
371
|
+
}, idx);
|
|
372
|
+
}
|
|
373
|
+
indexes = idx;
|
|
374
|
+
return idx;
|
|
375
|
+
} catch {
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
})();
|
|
379
|
+
return initPromise;
|
|
380
|
+
}
|
|
381
|
+
function collectStreams(filePath, componentMap, visited, out) {
|
|
382
|
+
if (visited.has(filePath)) return;
|
|
383
|
+
visited.add(filePath);
|
|
384
|
+
let source;
|
|
385
|
+
try {
|
|
386
|
+
source = readFileSync(filePath, "utf-8");
|
|
387
|
+
} catch {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const { template, styles } = parseSfcBlocks(source);
|
|
391
|
+
const classes = /* @__PURE__ */ new Set();
|
|
392
|
+
if (template) extractClasses(template.content, classes);
|
|
393
|
+
out.push({
|
|
394
|
+
path: filePath,
|
|
395
|
+
source,
|
|
396
|
+
template,
|
|
397
|
+
styles,
|
|
398
|
+
classes
|
|
399
|
+
});
|
|
400
|
+
if (template) for (const tag of findComponentTags(template.content)) {
|
|
401
|
+
const cp = componentMap.get(tag.toLowerCase());
|
|
402
|
+
if (cp) collectStreams(cp, componentMap, visited, out);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function extractClasses(html, out) {
|
|
406
|
+
const parser = new Parser({ onopentag(_tag, attrs) {
|
|
407
|
+
const c = attrs.class;
|
|
408
|
+
if (!c) return;
|
|
409
|
+
for (const t of c.split(/\s+/)) if (t) out.add(t);
|
|
410
|
+
} }, { decodeEntities: true });
|
|
411
|
+
parser.write(html);
|
|
412
|
+
parser.end();
|
|
413
|
+
}
|
|
414
|
+
function parseWithIndices(html) {
|
|
415
|
+
const handler = new DomHandler(void 0, { withStartIndices: true });
|
|
416
|
+
const parser = new Parser(handler);
|
|
417
|
+
parser.write(html);
|
|
418
|
+
parser.end();
|
|
419
|
+
return handler.dom;
|
|
420
|
+
}
|
|
421
|
+
function findStyleNodes(nodes, out = []) {
|
|
422
|
+
for (const n of nodes) {
|
|
423
|
+
const el = n;
|
|
424
|
+
if (el.name === "style") out.push(el);
|
|
425
|
+
if (el.children?.length) findStyleNodes(el.children, out);
|
|
426
|
+
}
|
|
427
|
+
return out;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Parse each file's template, collect every `<style>` node with its source
|
|
431
|
+
* line (via htmlparser2 start indices), then pass the combined DOM through
|
|
432
|
+
* the framework's real Tailwind pipeline. The pipeline resolves imports
|
|
433
|
+
* (@maizzle/tailwindcss), compiles utilities from class attrs, lowers modern
|
|
434
|
+
* CSS via lightningcss, and resolves static calc() — so what we walk matches
|
|
435
|
+
* what ships.
|
|
436
|
+
*/
|
|
437
|
+
async function compileViaPipeline(streams, config, rootFile) {
|
|
438
|
+
const all = [];
|
|
439
|
+
const tracked = [];
|
|
440
|
+
for (const s of streams) {
|
|
441
|
+
if (!s.template) continue;
|
|
442
|
+
const templateStart = s.source.indexOf(s.template.content);
|
|
443
|
+
const nodes = parseWithIndices(s.template.content);
|
|
444
|
+
for (const styleNode of findStyleNodes(nodes)) {
|
|
445
|
+
const startIdx = styleNode.startIndex ?? 0;
|
|
446
|
+
const line = offsetToLine(s.source, templateStart + startIdx);
|
|
447
|
+
tracked.push({
|
|
448
|
+
node: styleNode,
|
|
449
|
+
file: s.path,
|
|
450
|
+
line
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
for (const n of nodes) all.push(n);
|
|
454
|
+
}
|
|
455
|
+
if (!tracked.length) return [];
|
|
456
|
+
try {
|
|
457
|
+
await tailwindcss(all, config, rootFile);
|
|
458
|
+
} catch {
|
|
459
|
+
return [];
|
|
460
|
+
}
|
|
461
|
+
return tracked.map((t) => {
|
|
462
|
+
const txt = t.node.children?.find((c) => c.type === "text");
|
|
463
|
+
return txt?.data ? {
|
|
464
|
+
file: t.file,
|
|
465
|
+
css: txt.data,
|
|
466
|
+
line: t.line
|
|
467
|
+
} : null;
|
|
468
|
+
}).filter((x) => x !== null);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Walk CSS AST with detectors. Calls onHit per feature hit.
|
|
472
|
+
* `selector` is the containing rule's selector (undefined if no rule ancestor).
|
|
473
|
+
*/
|
|
474
|
+
function walkCss(css, idx, onHit) {
|
|
475
|
+
let root;
|
|
476
|
+
try {
|
|
477
|
+
root = safeParser(css);
|
|
478
|
+
} catch {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
const containingSelector = (n) => {
|
|
482
|
+
let p = n?.parent;
|
|
483
|
+
while (p && p.type !== "root") {
|
|
484
|
+
if (p.type === "rule") return p.selector;
|
|
485
|
+
p = p.parent;
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
if (idx.cssComments) root.walkComments((c) => {
|
|
489
|
+
onHit(idx.cssComments, {
|
|
490
|
+
line: c.source?.start?.line,
|
|
491
|
+
selector: containingSelector(c)
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
root.walkAtRules((atRule) => {
|
|
495
|
+
const line = atRule.source?.start?.line;
|
|
496
|
+
let sel = containingSelector(atRule);
|
|
497
|
+
if (atRule.name === "media" && !sel) {
|
|
498
|
+
const innerSelectors = [];
|
|
499
|
+
atRule.walkRules((r) => {
|
|
500
|
+
innerSelectors.push(r.selector);
|
|
501
|
+
});
|
|
502
|
+
if (innerSelectors.length) sel = innerSelectors.join(", ");
|
|
503
|
+
}
|
|
504
|
+
if (atRule.name === "media") {
|
|
505
|
+
const specific = [];
|
|
506
|
+
if (idx.cssMediaFeature.size) {
|
|
507
|
+
for (const [feat, fs2] of idx.cssMediaFeature) if (atRule.params.includes(`(${feat}`) || atRule.params.includes(feat)) specific.push(...fs2);
|
|
508
|
+
}
|
|
509
|
+
if (specific.length) for (const f of specific) onHit(f, {
|
|
510
|
+
line,
|
|
511
|
+
selector: sel
|
|
512
|
+
});
|
|
513
|
+
else {
|
|
514
|
+
const fs = idx.cssAtRule.get("media");
|
|
515
|
+
if (fs) for (const f of fs) onHit(f, {
|
|
516
|
+
line,
|
|
517
|
+
selector: sel
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
} else {
|
|
521
|
+
const fs = idx.cssAtRule.get(atRule.name);
|
|
522
|
+
if (fs) for (const f of fs) onHit(f, {
|
|
523
|
+
line,
|
|
524
|
+
selector: sel
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
root.walkRules((rule) => {
|
|
529
|
+
const line = rule.source?.start?.line;
|
|
530
|
+
const sel = rule.selector;
|
|
531
|
+
if (idx.cssPseudoClass.size) {
|
|
532
|
+
for (const [name, fs] of idx.cssPseudoClass) if (new RegExp(`(^|[^:]):${escapeRe(name)}(\\b|\\()`).test(sel)) for (const f of fs) onHit(f, {
|
|
533
|
+
line,
|
|
534
|
+
selector: sel
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
if (idx.cssPseudoElement.size) {
|
|
538
|
+
for (const [name, fs] of idx.cssPseudoElement) if (new RegExp(`::${escapeRe(name)}\\b`).test(sel)) for (const f of fs) onHit(f, {
|
|
539
|
+
line,
|
|
540
|
+
selector: sel
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
root.walkDecls((decl) => {
|
|
545
|
+
const line = decl.source?.start?.line;
|
|
546
|
+
const sel = containingSelector(decl);
|
|
547
|
+
const prop = decl.prop;
|
|
548
|
+
if (idx.cssImportant && decl.important) onHit(idx.cssImportant, {
|
|
549
|
+
line,
|
|
550
|
+
selector: sel
|
|
551
|
+
});
|
|
552
|
+
if (idx.cssVariables && prop.startsWith("--")) onHit(idx.cssVariables, {
|
|
553
|
+
line,
|
|
554
|
+
selector: sel
|
|
555
|
+
});
|
|
556
|
+
const fs = idx.cssProp.get(prop);
|
|
557
|
+
if (fs) for (const f of fs) onHit(f, {
|
|
558
|
+
line,
|
|
559
|
+
selector: sel
|
|
560
|
+
});
|
|
561
|
+
const pvs = idx.cssPropValue.get(prop);
|
|
562
|
+
if (pvs) {
|
|
563
|
+
const v = decl.value.trim().toLowerCase();
|
|
564
|
+
for (const pv of pvs) if (v === pv.value) onHit(pv.feature, {
|
|
565
|
+
line,
|
|
566
|
+
selector: sel
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
if (idx.cssFunction.size || idx.cssUnit.size || idx.cssVariables || idx.cssModernColor) try {
|
|
570
|
+
valueParser(decl.value).walk((n) => {
|
|
571
|
+
if (n.type === "function") {
|
|
572
|
+
const fname = n.value.toLowerCase();
|
|
573
|
+
const fs2 = idx.cssFunction.get(fname);
|
|
574
|
+
if (fs2) for (const f of fs2) onHit(f, {
|
|
575
|
+
line,
|
|
576
|
+
selector: sel
|
|
577
|
+
});
|
|
578
|
+
if (idx.cssVariables && fname === "var") onHit(idx.cssVariables, {
|
|
579
|
+
line,
|
|
580
|
+
selector: sel
|
|
581
|
+
});
|
|
582
|
+
if (idx.cssModernColor && MODERN_COLOR_FNS.has(fname)) onHit(idx.cssModernColor, {
|
|
583
|
+
line,
|
|
584
|
+
selector: sel
|
|
585
|
+
});
|
|
586
|
+
} else if (n.type === "word") {
|
|
587
|
+
const m = /^-?\d*\.?\d+([a-z%]+)$/i.exec(n.value);
|
|
588
|
+
if (m) {
|
|
589
|
+
const unit = m[1].toLowerCase();
|
|
590
|
+
const fs2 = idx.cssUnit.get(unit);
|
|
591
|
+
if (fs2) for (const f of fs2) onHit(f, {
|
|
592
|
+
line,
|
|
593
|
+
selector: sel
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
} catch {}
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
const MODERN_COLOR_FNS = new Set([
|
|
602
|
+
"oklch",
|
|
603
|
+
"oklab",
|
|
604
|
+
"lch",
|
|
605
|
+
"lab",
|
|
606
|
+
"color",
|
|
607
|
+
"color-mix",
|
|
608
|
+
"hwb"
|
|
609
|
+
]);
|
|
610
|
+
function escapeRe(s) {
|
|
611
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
612
|
+
}
|
|
613
|
+
function offsetToLine(source, offset) {
|
|
614
|
+
let line = 1;
|
|
615
|
+
for (let i = 0; i < offset && i < source.length; i++) if (source.charCodeAt(i) === 10) line++;
|
|
616
|
+
return line;
|
|
617
|
+
}
|
|
618
|
+
function walkTemplate(html, idx, fileLineOffset, source, templateStartOffset, onHit) {
|
|
619
|
+
const semanticTags = new Set([
|
|
620
|
+
"article",
|
|
621
|
+
"aside",
|
|
622
|
+
"details",
|
|
623
|
+
"figcaption",
|
|
624
|
+
"figure",
|
|
625
|
+
"footer",
|
|
626
|
+
"header",
|
|
627
|
+
"main",
|
|
628
|
+
"mark",
|
|
629
|
+
"nav",
|
|
630
|
+
"section",
|
|
631
|
+
"time",
|
|
632
|
+
"summary"
|
|
633
|
+
]);
|
|
634
|
+
const bodyScopeStack = [];
|
|
635
|
+
const parser = new Parser({
|
|
636
|
+
onopentag(tag, attrs) {
|
|
637
|
+
const startIdx = parser.startIndex;
|
|
638
|
+
const line = offsetToLine(source, templateStartOffset + startIdx);
|
|
639
|
+
const tagFs = idx.htmlTag.get(tag);
|
|
640
|
+
if (tagFs) for (const f of tagFs) onHit(f, line);
|
|
641
|
+
if (idx.htmlSemantics && semanticTags.has(tag)) onHit(idx.htmlSemantics, line);
|
|
642
|
+
if (tag === "style" && bodyScopeStack.length > 0 && idx.htmlStyleInBody) onHit(idx.htmlStyleInBody, line);
|
|
643
|
+
if (tag === "body") bodyScopeStack.push(tag);
|
|
644
|
+
else if (tag === "teleport" && /body/i.test(attrs.to ?? "")) bodyScopeStack.push(tag);
|
|
645
|
+
for (const attr in attrs) {
|
|
646
|
+
const attrFs = idx.htmlAttr.get(attr);
|
|
647
|
+
if (attrFs) for (const f of attrFs) onHit(f, line);
|
|
648
|
+
}
|
|
649
|
+
if (tag === "input" && attrs.type) {
|
|
650
|
+
const fs = idx.htmlInputType.get(attrs.type.toLowerCase());
|
|
651
|
+
if (fs) for (const f of fs) onHit(f, line);
|
|
652
|
+
}
|
|
653
|
+
if (tag === "button" && attrs.type) {
|
|
654
|
+
const fs = idx.htmlButtonType.get(attrs.type.toLowerCase());
|
|
655
|
+
if (fs) for (const f of fs) onHit(f, line);
|
|
656
|
+
}
|
|
657
|
+
if (tag === "a" && attrs.href) {
|
|
658
|
+
const h = attrs.href.trim();
|
|
659
|
+
if (idx.htmlMailtoLinks && /^mailto:/i.test(h)) onHit(idx.htmlMailtoLinks, line);
|
|
660
|
+
else if (idx.htmlAnchorLinks && h.startsWith("#")) onHit(idx.htmlAnchorLinks, line);
|
|
661
|
+
}
|
|
662
|
+
if (tag === "meta" && idx.htmlMetaColorScheme && attrs.name?.toLowerCase() === "color-scheme") onHit(idx.htmlMetaColorScheme, line);
|
|
663
|
+
if (idx.imageExt.size && (attrs.src || attrs.srcset)) {
|
|
664
|
+
const urls = [];
|
|
665
|
+
if (attrs.src) urls.push(attrs.src);
|
|
666
|
+
if (attrs.srcset) for (const part of attrs.srcset.split(",")) urls.push(part.trim().split(/\s+/)[0]);
|
|
667
|
+
for (const url of urls) {
|
|
668
|
+
const m = /\.([a-z0-9]+)(?:\?|#|$)/i.exec(url);
|
|
669
|
+
if (!m) continue;
|
|
670
|
+
const fs = idx.imageExt.get(m[1].toLowerCase());
|
|
671
|
+
if (fs) for (const f of fs) onHit(f, line);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (attrs.style) scanInlineStyle(attrs.style, idx, line, onHit);
|
|
675
|
+
},
|
|
676
|
+
onclosetag(tag) {
|
|
677
|
+
if (bodyScopeStack[bodyScopeStack.length - 1] === tag) bodyScopeStack.pop();
|
|
678
|
+
},
|
|
679
|
+
onprocessinginstruction(name) {
|
|
680
|
+
if (idx.htmlDoctype && name.toLowerCase() === "!doctype") {
|
|
681
|
+
const startIdx = parser.startIndex;
|
|
682
|
+
onHit(idx.htmlDoctype, offsetToLine(source, templateStartOffset + startIdx));
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
oncomment() {
|
|
686
|
+
if (idx.htmlComments) {
|
|
687
|
+
const startIdx = parser.startIndex;
|
|
688
|
+
onHit(idx.htmlComments, offsetToLine(source, templateStartOffset + startIdx));
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}, {
|
|
692
|
+
decodeEntities: false,
|
|
693
|
+
lowerCaseTags: true,
|
|
694
|
+
lowerCaseAttributeNames: true
|
|
695
|
+
});
|
|
696
|
+
parser.write(html);
|
|
697
|
+
parser.end();
|
|
698
|
+
}
|
|
699
|
+
function scanInlineStyle(style, idx, line, onHit) {
|
|
700
|
+
const wrapped = `*{${style}}`;
|
|
701
|
+
try {
|
|
702
|
+
safeParser(wrapped).walkDecls((decl) => {
|
|
703
|
+
if (idx.cssImportant && decl.important) onHit(idx.cssImportant, line);
|
|
704
|
+
const fs = idx.cssProp.get(decl.prop);
|
|
705
|
+
if (fs) for (const f of fs) onHit(f, line);
|
|
706
|
+
if (idx.cssVariables && decl.prop.startsWith("--")) onHit(idx.cssVariables, line);
|
|
707
|
+
const pvs = idx.cssPropValue.get(decl.prop);
|
|
708
|
+
if (pvs) {
|
|
709
|
+
const v = decl.value.trim().toLowerCase();
|
|
710
|
+
for (const pv of pvs) if (v === pv.value) onHit(pv.feature, line);
|
|
711
|
+
}
|
|
712
|
+
if (idx.cssFunction.size || idx.cssUnit.size || idx.cssVariables || idx.cssModernColor) try {
|
|
713
|
+
valueParser(decl.value).walk((n) => {
|
|
714
|
+
if (n.type === "function") {
|
|
715
|
+
const fname = n.value.toLowerCase();
|
|
716
|
+
const fs2 = idx.cssFunction.get(fname);
|
|
717
|
+
if (fs2) for (const f of fs2) onHit(f, line);
|
|
718
|
+
if (idx.cssVariables && fname === "var") onHit(idx.cssVariables, line);
|
|
719
|
+
if (idx.cssModernColor && MODERN_COLOR_FNS.has(fname)) onHit(idx.cssModernColor, line);
|
|
720
|
+
} else if (n.type === "word") {
|
|
721
|
+
const m = /^-?\d*\.?\d+([a-z%]+)$/i.exec(n.value);
|
|
722
|
+
if (m) {
|
|
723
|
+
const fs2 = idx.cssUnit.get(m[1].toLowerCase());
|
|
724
|
+
if (fs2) for (const f of fs2) onHit(f, line);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
} catch {}
|
|
729
|
+
});
|
|
730
|
+
} catch {}
|
|
731
|
+
}
|
|
732
|
+
function labelFor(idx, level) {
|
|
733
|
+
const n = idx.nicenames;
|
|
734
|
+
if (level === "unsupported") return n.unsupported ?? "Not supported";
|
|
735
|
+
if (level === "mitigated") return n.mitigated ?? "Partially supported";
|
|
736
|
+
return n.unknown ?? "Support unknown";
|
|
737
|
+
}
|
|
738
|
+
async function scan(rootFile, config, componentDirs, allowedClients) {
|
|
739
|
+
const idx = await initCompatibility();
|
|
740
|
+
if (!idx) return [];
|
|
741
|
+
const componentMap = await buildComponentMap(config.root ?? process.cwd(), componentDirs);
|
|
742
|
+
const streams = [];
|
|
743
|
+
collectStreams(rootFile, componentMap, /* @__PURE__ */ new Set(), streams);
|
|
744
|
+
const issues = [];
|
|
745
|
+
const seen = /* @__PURE__ */ new Set();
|
|
746
|
+
const resolvedCache = /* @__PURE__ */ new Map();
|
|
747
|
+
const resolveSupport = (f) => {
|
|
748
|
+
let cached = resolvedCache.get(f.slug);
|
|
749
|
+
if (cached === void 0) {
|
|
750
|
+
cached = computeSupport(f.stats, idx.familyNicenames, allowedClients);
|
|
751
|
+
resolvedCache.set(f.slug, cached);
|
|
752
|
+
}
|
|
753
|
+
return cached;
|
|
754
|
+
};
|
|
755
|
+
const add = (f, file, line) => {
|
|
756
|
+
const key = `${f.slug}|${file}|${line ?? 0}`;
|
|
757
|
+
if (seen.has(key)) return;
|
|
758
|
+
const support = resolveSupport(f);
|
|
759
|
+
if (!support) return;
|
|
760
|
+
seen.add(key);
|
|
761
|
+
issues.push({
|
|
762
|
+
kind: "compat",
|
|
763
|
+
slug: f.slug,
|
|
764
|
+
title: f.title,
|
|
765
|
+
url: f.url,
|
|
766
|
+
category: f.category,
|
|
767
|
+
supportLevel: support.level,
|
|
768
|
+
supportLabel: labelFor(idx, support.level),
|
|
769
|
+
affectedClients: support.affected,
|
|
770
|
+
line,
|
|
771
|
+
file
|
|
772
|
+
});
|
|
773
|
+
};
|
|
774
|
+
const compiledBlocks = await compileViaPipeline(streams, config, rootFile);
|
|
775
|
+
for (const block of compiledBlocks) walkCss(block.css, idx, (feature, node) => {
|
|
776
|
+
const locations = classLocations(node.selector, streams);
|
|
777
|
+
if (!locations.length) {
|
|
778
|
+
add(feature, block.file, block.line);
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
if (feature.slug.startsWith("css-at-media")) add(feature, locations[0].file, locations[0].line);
|
|
782
|
+
else for (const { file, line } of locations) add(feature, file, line);
|
|
783
|
+
});
|
|
784
|
+
for (const s of streams) {
|
|
785
|
+
if (!s.template) continue;
|
|
786
|
+
walkTemplate(s.template.content, idx, s.template.offset, s.source, s.source.indexOf(s.template.content), (feature, line) => add(feature, s.path, line));
|
|
787
|
+
}
|
|
788
|
+
return issues;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Return every (file, line) where any class from the selector appears in a
|
|
792
|
+
* template. Scans every stream so a shared utility class used in multiple
|
|
793
|
+
* components surfaces once per occurrence.
|
|
794
|
+
*/
|
|
795
|
+
function classLocations(selector, streams) {
|
|
796
|
+
if (!selector) return [];
|
|
797
|
+
const classNames = extractSelectorClasses(selector);
|
|
798
|
+
if (!classNames.length) return [];
|
|
799
|
+
const out = [];
|
|
800
|
+
const seen = /* @__PURE__ */ new Set();
|
|
801
|
+
for (const cn of classNames) for (const s of streams) {
|
|
802
|
+
if (!s.classes.has(cn) || !s.template) continue;
|
|
803
|
+
const tpl = s.template.content;
|
|
804
|
+
const tplStart = s.source.indexOf(tpl);
|
|
805
|
+
let pos = 0;
|
|
806
|
+
while (true) {
|
|
807
|
+
const i = tpl.indexOf(cn, pos);
|
|
808
|
+
if (i < 0) break;
|
|
809
|
+
pos = i + cn.length;
|
|
810
|
+
const before = i > 0 ? tpl[i - 1] : " ";
|
|
811
|
+
const after = i + cn.length < tpl.length ? tpl[i + cn.length] : " ";
|
|
812
|
+
if (!isClassBoundary(before) || !isClassBoundary(after)) continue;
|
|
813
|
+
const line = offsetToLine(s.source, tplStart + i);
|
|
814
|
+
const key = `${s.path}|${line}`;
|
|
815
|
+
if (seen.has(key)) continue;
|
|
816
|
+
seen.add(key);
|
|
817
|
+
out.push({
|
|
818
|
+
file: s.path,
|
|
819
|
+
line
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
return out;
|
|
824
|
+
}
|
|
825
|
+
function isClassBoundary(c) {
|
|
826
|
+
return c === " " || c === " " || c === "\n" || c === "\r" || c === "\"" || c === "'";
|
|
827
|
+
}
|
|
828
|
+
function extractSelectorClasses(selector) {
|
|
829
|
+
const out = [];
|
|
830
|
+
const re = /\.((?:\\.|[\w-])+)/g;
|
|
831
|
+
let m;
|
|
832
|
+
while ((m = re.exec(selector)) !== null) out.push(m[1].replace(/\\(.)/g, "$1"));
|
|
833
|
+
return out;
|
|
834
|
+
}
|
|
835
|
+
const CATEGORY_ORDER = [
|
|
836
|
+
"css",
|
|
837
|
+
"html",
|
|
838
|
+
"image",
|
|
839
|
+
"others"
|
|
840
|
+
];
|
|
841
|
+
const LEVEL_ORDER = {
|
|
842
|
+
error: 0,
|
|
843
|
+
unsupported: 1,
|
|
844
|
+
warning: 2,
|
|
845
|
+
mitigated: 3,
|
|
846
|
+
unknown: 4
|
|
847
|
+
};
|
|
848
|
+
function orderKey(i) {
|
|
849
|
+
if (i.kind === "lint") return LEVEL_ORDER[i.severity] ?? 99;
|
|
850
|
+
return LEVEL_ORDER[i.supportLevel] ?? 99;
|
|
851
|
+
}
|
|
852
|
+
function resolveChecksConfig(config) {
|
|
853
|
+
const raw = config.server?.checks;
|
|
854
|
+
if (raw === false) return null;
|
|
855
|
+
return {
|
|
856
|
+
clients: raw?.clients === "all" ? "all" : Array.isArray(raw?.clients) && raw.clients.length ? new Set(raw.clients) : DEFAULT_CLIENTS,
|
|
857
|
+
level: raw?.level ?? null
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
function passesLevelFilter(issue, level) {
|
|
861
|
+
if (!level) return true;
|
|
862
|
+
if (level === "lint") return issue.kind === "lint";
|
|
863
|
+
if (issue.kind === "lint") return level === "error" ? issue.severity === "error" : issue.severity === "warning";
|
|
864
|
+
return level === "error" ? issue.supportLevel === "unsupported" : issue.supportLevel === "mitigated" || issue.supportLevel === "unknown";
|
|
865
|
+
}
|
|
866
|
+
async function serveCompatibility(url, res, config, componentDirs) {
|
|
867
|
+
const filePath = url.replace("/__maizzle/compatibility/", "").replace(/\?.*$/, "");
|
|
868
|
+
const checksCfg = resolveChecksConfig(config);
|
|
869
|
+
try {
|
|
870
|
+
res.setHeader("Content-Type", "application/json");
|
|
871
|
+
if (!checksCfg) {
|
|
872
|
+
res.end(JSON.stringify([]));
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
const absolutePath = resolve(filePath);
|
|
876
|
+
const [compatIssues, lintIssues] = await Promise.all([scan(absolutePath, config, componentDirs, checksCfg.clients), scanLint(absolutePath, config, componentDirs)]);
|
|
877
|
+
const idx = await initCompatibility();
|
|
878
|
+
const lintAsIssues = lintIssues.map((li) => {
|
|
879
|
+
const info = li.slug ? idx?.bySlug.get(li.slug) : void 0;
|
|
880
|
+
return {
|
|
881
|
+
kind: "lint",
|
|
882
|
+
slug: li.slug,
|
|
883
|
+
title: li.title,
|
|
884
|
+
url: info?.url,
|
|
885
|
+
category: li.category,
|
|
886
|
+
severity: li.type,
|
|
887
|
+
message: li.message,
|
|
888
|
+
line: li.line,
|
|
889
|
+
file: li.file
|
|
890
|
+
};
|
|
891
|
+
});
|
|
892
|
+
let issues = [...compatIssues, ...lintAsIssues];
|
|
893
|
+
issues = issues.filter((i) => !isFrameworkComponent(i.file));
|
|
894
|
+
if (checksCfg.level) issues = issues.filter((i) => passesLevelFilter(i, checksCfg.level));
|
|
895
|
+
issues.sort((a, b) => {
|
|
896
|
+
const c = CATEGORY_ORDER.indexOf(a.category) - CATEGORY_ORDER.indexOf(b.category);
|
|
897
|
+
if (c) return c;
|
|
898
|
+
const l = orderKey(a) - orderKey(b);
|
|
899
|
+
if (l) return l;
|
|
900
|
+
return (a.slug ?? a.title).localeCompare(b.slug ?? b.title);
|
|
901
|
+
});
|
|
902
|
+
res.end(JSON.stringify(issues));
|
|
903
|
+
} catch (error) {
|
|
904
|
+
res.statusCode = 500;
|
|
905
|
+
res.end(JSON.stringify({ error: error.message }));
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
//#endregion
|
|
909
|
+
export { initCompatibility, serveCompatibility };
|
|
910
|
+
|
|
911
|
+
//# sourceMappingURL=compatibility.js.map
|