@maizzle/framework 6.0.0-rc.11 → 6.0.0-rc.13

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.
Files changed (49) hide show
  1. package/dist/build.mjs +4 -1
  2. package/dist/build.mjs.map +1 -1
  3. package/dist/serve.d.mts.map +1 -1
  4. package/dist/serve.mjs +23 -11
  5. package/dist/serve.mjs.map +1 -1
  6. package/dist/server/compatibility.d.mts +54 -2
  7. package/dist/server/compatibility.d.mts.map +1 -1
  8. package/dist/server/compatibility.mjs +890 -76
  9. package/dist/server/compatibility.mjs.map +1 -1
  10. package/dist/server/linter.d.mts +15 -2
  11. package/dist/server/linter.d.mts.map +1 -1
  12. package/dist/server/linter.mjs +194 -43
  13. package/dist/server/linter.mjs.map +1 -1
  14. package/dist/server/sfc-utils.d.mts +18 -0
  15. package/dist/server/sfc-utils.d.mts.map +1 -0
  16. package/dist/server/sfc-utils.mjs +184 -0
  17. package/dist/server/sfc-utils.mjs.map +1 -0
  18. package/dist/server/ui/App.vue +4 -41
  19. package/dist/server/ui/components/SidebarClose.vue +12 -0
  20. package/dist/server/ui/components/ui/command/Command.vue +1 -0
  21. package/dist/server/ui/components/ui/input/Input.vue +1 -1
  22. package/dist/server/ui/components/ui/sidebar/SidebarTrigger.vue +1 -1
  23. package/dist/server/ui/components/ui/tags-input/TagsInputInput.vue +1 -1
  24. package/dist/server/ui/pages/Preview.vue +194 -151
  25. package/dist/transformers/addAttributes.mjs +10 -6
  26. package/dist/transformers/addAttributes.mjs.map +1 -1
  27. package/dist/transformers/inlineCSS.mjs +2 -2
  28. package/dist/transformers/inlineCSS.mjs.map +1 -1
  29. package/dist/transformers/purgeCSS.mjs +1 -1
  30. package/dist/transformers/purgeCSS.mjs.map +1 -1
  31. package/dist/transformers/tailwindcss.mjs +2 -4
  32. package/dist/transformers/tailwindcss.mjs.map +1 -1
  33. package/dist/types/config.d.mts +42 -2
  34. package/dist/types/config.d.mts.map +1 -1
  35. package/dist/types/index.d.mts +2 -2
  36. package/package.json +1 -3
  37. package/dist/_virtual/_rolldown/runtime.mjs +0 -32
  38. package/dist/node_modules/picomatch/index.mjs +0 -13
  39. package/dist/node_modules/picomatch/index.mjs.map +0 -1
  40. package/dist/node_modules/picomatch/lib/constants.mjs +0 -174
  41. package/dist/node_modules/picomatch/lib/constants.mjs.map +0 -1
  42. package/dist/node_modules/picomatch/lib/parse.mjs +0 -1067
  43. package/dist/node_modules/picomatch/lib/parse.mjs.map +0 -1
  44. package/dist/node_modules/picomatch/lib/picomatch.mjs +0 -304
  45. package/dist/node_modules/picomatch/lib/picomatch.mjs.map +0 -1
  46. package/dist/node_modules/picomatch/lib/scan.mjs +0 -296
  47. package/dist/node_modules/picomatch/lib/scan.mjs.map +0 -1
  48. package/dist/node_modules/picomatch/lib/utils.mjs +0 -53
  49. package/dist/node_modules/picomatch/lib/utils.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"compatibility.mjs","names":[],"sources":["../../src/server/compatibility.ts"],"sourcesContent":["import { caniemail, rawData } from 'caniemail'\n\nexport async function serveCompatibility(req: any, res: any) {\n try {\n const html = await new Promise<string>((resolve, reject) => {\n let body = ''\n req.on('data', (chunk: string) => { body += chunk })\n req.on('end', () => resolve(body))\n req.on('error', reject)\n })\n\n if (!html) {\n res.setHeader('Content-Type', 'application/json')\n res.end(JSON.stringify([]))\n return\n }\n\n const result = caniemail({\n clients: ['apple-mail.*', 'gmail.*', 'outlook.*', 'yahoo.*'],\n html,\n })\n\n // Build title -> caniemail URL and category lookups\n const urlMap = new Map<string, string>()\n const categoryMap = new Map<string, string>()\n for (const item of (rawData as any).data) {\n urlMap.set(item.title, item.url)\n categoryMap.set(item.title, item.category)\n }\n\n const issues: Array<{ type: 'error' | 'warning', client: string, title: string, notes: string[], line?: number }> = []\n\n for (const [client, clientIssues] of result.issues.errors) {\n for (const issue of clientIssues) {\n issues.push({\n type: 'error',\n client,\n title: issue.title,\n notes: issue.notes,\n line: issue.position?.start.line,\n })\n }\n }\n\n for (const [client, clientIssues] of result.issues.warnings) {\n for (const issue of clientIssues) {\n issues.push({\n type: 'warning',\n client,\n title: issue.title,\n notes: issue.notes,\n line: issue.position?.start.line,\n })\n }\n }\n\n // Group by feature title + type, keep per-client notes\n const grouped = new Map<string, {\n type: 'error' | 'warning'\n title: string\n category: string\n clients: Array<{ name: string, notes: string[] }>\n url?: string\n line?: number\n }>()\n\n for (const issue of issues) {\n const key = `${issue.type}:${issue.title}`\n const existing = grouped.get(key)\n const clientName = issue.client\n .split('.')[0]\n .replace(/-/g, ' ')\n .replace(/\\b\\w/g, c => c.toUpperCase())\n\n if (existing) {\n const existingClient = existing.clients.find(c => c.name === clientName)\n if (existingClient) {\n for (const note of issue.notes) {\n if (!existingClient.notes.includes(note)) {\n existingClient.notes.push(note)\n }\n }\n } else {\n existing.clients.push({ name: clientName, notes: [...issue.notes] })\n }\n } else {\n grouped.set(key, {\n type: issue.type,\n title: issue.title,\n category: categoryMap.get(issue.title) || 'others',\n clients: [{ name: clientName, notes: [...issue.notes] }],\n url: urlMap.get(issue.title),\n line: issue.line,\n })\n }\n }\n\n // Sort: by category order, then errors first, then alphabetically\n const categoryOrder = ['css', 'html', 'image', 'others']\n const sortedIssues = [...grouped.values()].sort((a, b) => {\n const catA = categoryOrder.indexOf(a.category)\n const catB = categoryOrder.indexOf(b.category)\n if (catA !== catB) return catA - catB\n if (a.type !== b.type) return a.type === 'error' ? -1 : 1\n return a.title.localeCompare(b.title)\n })\n\n res.setHeader('Content-Type', 'application/json')\n res.end(JSON.stringify(sortedIssues))\n } catch (error: any) {\n res.statusCode = 500\n res.end(JSON.stringify({ error: error.message }))\n }\n}\n"],"mappings":";;;AAEA,eAAsB,mBAAmB,KAAU,KAAU;AAC3D,KAAI;EACF,MAAM,OAAO,MAAM,IAAI,SAAiB,SAAS,WAAW;GAC1D,IAAI,OAAO;AACX,OAAI,GAAG,SAAS,UAAkB;AAAE,YAAQ;KAAQ;AACpD,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K,MAAM,QAAQ,MAAM,MACvB,KAAI,CAAC,eAAe,MAAM,SAAS,KAAK,CACtC,gBAAe,MAAM,KAAK,KAAK;UAInC,UAAS,QAAQ,KAAK;KAAE,MAAM;KAAY,OAAO,CAAC,GAAG,MAAM,MAAM;KAAE,CAAC;SAGtE,SAAQ,IAAI,KAAK;IACf,MAAM,MAAM;IACZ,OAAO,MAAM;IACb,UAAU,YAAY,IAAI,MAAM,MAAM,IAAI;IAC1C,SAAS,CAAC;KAAE,MAAM;KAAY,OAAO,CAAC,GAAG,MAAM,MAAM;KAAE,CAAC;IACxD,KAAK,OAAO,IAAI,MAAM,MAAM;IAC5B,MAAM,MAAM;IACb,CAAC;;EAKN,MAAM,gBAAgB;GAAC;GAAO;GAAQ;GAAS;GAAS;EACxD,MAAM,eAAe,CAAC,GAAG,QAAQ,QAAQ,CAAC,CAAC,MAAM,GAAG,MAAM;GACxD,MAAM,OAAO,cAAc,QAAQ,EAAE,SAAS;GAC9C,MAAM,OAAO,cAAc,QAAQ,EAAE,SAAS;AAC9C,OAAI,SAAS,KAAM,QAAO,OAAO;AACjC,OAAI,EAAE,SAAS,EAAE,KAAM,QAAO,EAAE,SAAS,UAAU,KAAK;AACxD,UAAO,EAAE,MAAM,cAAc,EAAE,MAAM;IACrC;AAEF,MAAI,UAAU,gBAAgB,mBAAmB;AACjD,MAAI,IAAI,KAAK,UAAU,aAAa,CAAC;UAC9B,OAAY;AACnB,MAAI,aAAa;AACjB,MAAI,IAAI,KAAK,UAAU,EAAE,OAAO,MAAM,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"compatibility.mjs","names":["compileWithPipeline"],"sources":["../../src/server/compatibility.ts"],"sourcesContent":["import { readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport postcss, { type Declaration, type AtRule, type Rule } from 'postcss'\nimport safeParser from 'postcss-safe-parser'\nimport valueParser from 'postcss-value-parser'\nimport { Parser } from 'htmlparser2'\nimport { DomHandler, type ChildNode, type Element } from 'domhandler'\nimport { parseSfcBlocks, findComponentTags, buildComponentMap, type SfcBlock } from './sfc-utils.ts'\nimport { scanLint } from './linter.ts'\nimport { tailwindcss as compileWithPipeline } from '../transformers/tailwindcss.ts'\nimport type { MaizzleConfig } from '../types/index.ts'\n\nconst API_URL = 'https://www.caniemail.com/api/data.json'\nconst DEFAULT_CLIENTS = new Set(['gmail', 'apple-mail', 'outlook', 'yahoo'])\n\ntype SupportLevel = 'unsupported' | 'mitigated' | 'unknown'\n\ninterface Feature {\n slug: string\n title: string\n url: string\n category: string\n stats: any\n}\n\ninterface Issue {\n kind: 'compat' | 'lint'\n slug?: string\n title: string\n url?: string\n category: string\n line?: number\n file: string\n // compat-only\n supportLevel?: SupportLevel\n supportLabel?: string\n affectedClients?: string[]\n // lint-only\n severity?: 'error' | 'warning'\n message?: string\n}\n\ninterface Indexes {\n nicenames: { supported: string, mitigated: string, unsupported: string, unknown: string, mixed: string }\n familyNicenames: Record<string, string>\n cssProp: Map<string, Feature[]>\n cssPropValue: Map<string, Array<{ value: string, feature: Feature }>>\n cssAtRule: Map<string, Feature[]>\n cssMediaFeature: Map<string, Feature[]>\n cssPseudoClass: Map<string, Feature[]>\n cssPseudoElement: Map<string, Feature[]>\n cssFunction: Map<string, Feature[]>\n cssUnit: Map<string, Feature[]>\n cssImportant?: Feature\n cssVariables?: Feature\n cssNesting?: Feature\n cssComments?: Feature\n cssModernColor?: Feature\n htmlTag: Map<string, Feature[]>\n htmlAttr: Map<string, Feature[]>\n htmlInputType: Map<string, Feature[]>\n htmlButtonType: Map<string, Feature[]>\n htmlDoctype?: Feature\n htmlComments?: Feature\n htmlAnchorLinks?: Feature\n htmlMailtoLinks?: Feature\n htmlMetaColorScheme?: Feature\n htmlSemantics?: Feature\n htmlStyleInBody?: Feature\n imageExt: Map<string, Feature[]>\n /** All features by slug — unfiltered, used for URL lookups (e.g. by lint). */\n bySlug: Map<string, { title: string, url: string }>\n}\n\nlet indexes: Indexes | null = null\nlet initPromise: Promise<Indexes | null> | null = null\n\nfunction mpush<K, V>(m: Map<K, V[]>, k: K, v: V) {\n const arr = m.get(k)\n if (arr) arr.push(v)\n else m.set(k, [v])\n}\n\nfunction emptyIndexes(nicenames: any, familyNicenames: Record<string, string>): Indexes {\n return {\n nicenames,\n familyNicenames,\n cssProp: new Map(), cssPropValue: new Map(), cssAtRule: new Map(),\n cssMediaFeature: new Map(), cssPseudoClass: new Map(), cssPseudoElement: new Map(),\n cssFunction: new Map(), cssUnit: new Map(),\n htmlTag: new Map(), htmlAttr: new Map(), htmlInputType: new Map(), htmlButtonType: new Map(),\n imageExt: new Map(),\n bySlug: new Map(),\n }\n}\n\nfunction hasAnyNonY(stats: any): boolean {\n if (!stats) return false\n for (const family in stats) {\n for (const plat in stats[family]) {\n for (const ver in stats[family][plat]) {\n const v = stripNotes(String(stats[family][plat][ver]).trim())\n if (v && v !== 'y') return true\n }\n }\n }\n return false\n}\n\n/** Strip `#N` note markers — `\"y #1\"` → `\"y\"`. Notes document edge cases but\n * don't change support semantics, so treat `y #1` as fully supported. */\nfunction stripNotes(v: string): string {\n return v.split(/\\s+/).filter(t => t && !t.startsWith('#')).join(' ')\n}\n\nfunction computeSupport(stats: any, familyNicenames: Record<string, string>, allowedClients: Set<string> | 'all'): { level: SupportLevel, affected: string[] } | null {\n let nY = 0, nN = 0, nU = 0, nPartial = 0, total = 0\n const affectedFamilies = new Set<string>()\n for (const family in stats) {\n if (allowedClients !== 'all' && !allowedClients.has(family)) continue\n let familyHasNonY = false\n for (const plat in stats[family]) {\n // Only score the latest version per (family, platform) — legacy\n // versions (Outlook 2007, etc.) otherwise flag modern-widely-supported\n // features as partial forever.\n const versions = Object.keys(stats[family][plat]).sort()\n const latest = versions[versions.length - 1]\n if (!latest) continue\n total++\n const v = stripNotes(String(stats[family][plat][latest]).trim())\n if (v === 'y') nY++\n else if (v === 'n') { nN++; familyHasNonY = true }\n else if (v === 'u') { nU++; familyHasNonY = true }\n else { nPartial++; familyHasNonY = true }\n }\n if (familyHasNonY) affectedFamilies.add(family)\n }\n if (!total) return null\n if (nY === total) return null\n const affected = [...affectedFamilies].map(f => familyNicenames[f] ?? f).sort()\n if (nN === total) return { level: 'unsupported', affected }\n if (nU === total) return { level: 'unknown', affected }\n return { level: 'mitigated', affected }\n}\n\n/**\n * Slugs we never report. Fundamental HTML (every email uses these) plus\n * CSS noise that's not actionable (comments, !important usage).\n */\nconst IGNORED_SLUGS = new Set([\n // Required/unavoidable tags\n 'html-doctype', 'html-comments',\n 'html-html', 'html-head', 'html-body', 'html-title',\n 'html-meta', 'html-meta-color-scheme',\n 'html-style', 'html-link',\n 'html-div', 'html-span', 'html-br', 'html-p', 'html-a', 'html-img',\n 'html-table', 'html-tr', 'html-td', 'html-th',\n 'html-thead', 'html-tbody', 'html-tfoot',\n 'html-h1-h6', 'html-lists',\n 'html-strong', 'html-em', 'html-b', 'html-i', 'html-u',\n 'html-semantics',\n // Ubiquitous attributes — always present, caveats aren't actionable.\n 'html-role', 'html-hidden', 'html-width', 'html-height',\n // CSS noise\n 'css-comments', 'css-important',\n // CSS fundamentals — universally used with known minor caveats; flagging\n // them as \"partial\" is noise rather than signal.\n 'css-margin', 'css-padding', 'css-border',\n 'css-font-size', 'css-font-weight', 'css-font', 'css-font-family',\n 'css-line-height', 'css-letter-spacing', 'css-text-align',\n 'css-text-decoration', 'css-text-transform', 'css-color',\n 'css-background', 'css-background-color',\n 'css-width', 'css-height',\n 'css-display',\n])\n\nfunction classify(f: Feature, idx: Indexes) {\n const slug = f.slug\n // Retain html-style feature for the body-only detector even though it's\n // blacklisted from the normal html-tag detection path. Title is suffixed\n // so the flag reads as a body-placement warning, not a blanket `<style>`.\n if (slug === 'html-style') {\n idx.htmlStyleInBody = { ...f, title: `${f.title} in <body>` }\n return\n }\n if (IGNORED_SLUGS.has(slug)) return\n\n if (f.category === 'css') return classifyCss(f, slug, idx)\n if (f.category === 'html') return classifyHtml(f, slug, idx)\n if (f.category === 'image') {\n const ext = slug.slice('image-'.length)\n if (ext === 'base64') return\n mpush(idx.imageExt, ext, f)\n }\n // 'others' (amp, bimi) intentionally skipped\n}\n\nfunction classifyCss(f: Feature, slug: string, idx: Indexes) {\n // Specials first\n switch (slug) {\n case 'css-important': idx.cssImportant = f; return\n case 'css-variables': idx.cssVariables = f; return\n case 'css-nesting': idx.cssNesting = f; return\n case 'css-comments': idx.cssComments = f; return\n case 'css-modern-color': idx.cssModernColor = f; return\n case 'css-display-flex': mpushPropValue(idx, 'display', 'flex', f); return\n case 'css-display-grid': mpushPropValue(idx, 'display', 'grid', f); return\n case 'css-display-none': mpushPropValue(idx, 'display', 'none', f); return\n case 'css-rgb': mpush(idx.cssFunction, 'rgb', f); return\n case 'css-rgba': mpush(idx.cssFunction, 'rgba', f); return\n case 'css-linear-gradient': mpush(idx.cssFunction, 'linear-gradient', f); return\n case 'css-radial-gradient': mpush(idx.cssFunction, 'radial-gradient', f); return\n case 'css-conic-gradient': mpush(idx.cssFunction, 'conic-gradient', f); return\n }\n\n if (slug.startsWith('css-at-media-') && slug !== 'css-at-media') {\n mpush(idx.cssMediaFeature, slug.slice('css-at-media-'.length), f)\n return\n }\n if (slug.startsWith('css-at-')) {\n mpush(idx.cssAtRule, slug.slice('css-at-'.length), f)\n return\n }\n if (slug.startsWith('css-pseudo-class-')) {\n mpush(idx.cssPseudoClass, slug.slice('css-pseudo-class-'.length), f)\n return\n }\n if (slug.startsWith('css-pseudo-element-')) {\n mpush(idx.cssPseudoElement, slug.slice('css-pseudo-element-'.length), f)\n return\n }\n if (slug.startsWith('css-unit-')) {\n const u = slug.slice('css-unit-'.length)\n if (u === 'calc') { mpush(idx.cssFunction, 'calc', f); return }\n if (u === 'initial') return // keyword detection is noisy; skip\n const unit = u === 'percent' ? '%' : u\n mpush(idx.cssUnit, unit, f)\n return\n }\n if (slug.startsWith('css-function-')) {\n mpush(idx.cssFunction, slug.slice('css-function-'.length), f)\n return\n }\n // css-selector-* — skip (too broad to detect meaningfully)\n if (slug.startsWith('css-selector-')) return\n\n // Fallback: treat as property name\n mpush(idx.cssProp, slug.slice('css-'.length), f)\n}\n\nfunction mpushPropValue(idx: Indexes, prop: string, value: string, f: Feature) {\n const arr = idx.cssPropValue.get(prop)\n if (arr) arr.push({ value, feature: f })\n else idx.cssPropValue.set(prop, [{ value, feature: f }])\n}\n\nconst HTML_ATTR_SLUGS = new Set([\n 'align', 'background', 'cellpadding', 'cellspacing', 'height', 'width',\n 'valign', 'target', 'srcset', 'lang', 'dir', 'role', 'required', 'hidden',\n])\n\nfunction classifyHtml(f: Feature, slug: string, idx: Indexes) {\n // Specials\n switch (slug) {\n case 'html-doctype': idx.htmlDoctype = f; return\n case 'html-comments': idx.htmlComments = f; return\n case 'html-anchor-links': idx.htmlAnchorLinks = f; return\n case 'html-mailto-links': idx.htmlMailtoLinks = f; return\n case 'html-meta-color-scheme': idx.htmlMetaColorScheme = f; return\n case 'html-semantics': idx.htmlSemantics = f; return\n case 'html-loading-attribute': mpush(idx.htmlAttr, 'loading', f); return\n case 'html-image-maps':\n mpush(idx.htmlTag, 'map', f); mpush(idx.htmlTag, 'area', f); mpush(idx.htmlAttr, 'usemap', f); return\n case 'html-lists':\n for (const t of ['ul', 'ol', 'li', 'dl', 'dt', 'dd']) mpush(idx.htmlTag, t, f)\n return\n case 'html-h1-h6':\n for (const t of ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']) mpush(idx.htmlTag, t, f)\n return\n }\n\n if (slug.startsWith('html-input-')) {\n mpush(idx.htmlInputType, slug.slice('html-input-'.length), f)\n return\n }\n if (slug.startsWith('html-button-')) {\n mpush(idx.htmlButtonType, slug.slice('html-button-'.length), f)\n return\n }\n if (slug.startsWith('html-aria-')) {\n mpush(idx.htmlAttr, slug.slice('html-'.length), f)\n return\n }\n const name = slug.slice('html-'.length)\n if (HTML_ATTR_SLUGS.has(name)) {\n mpush(idx.htmlAttr, name, f)\n return\n }\n mpush(idx.htmlTag, name, f)\n}\n\nexport async function initCompatibility(): Promise<Indexes | null> {\n if (indexes) return indexes\n if (initPromise) return initPromise\n initPromise = (async () => {\n try {\n const res = await fetch(API_URL)\n if (!res.ok) return null\n const data = await res.json()\n const idx = emptyIndexes(data.nicenames?.support ?? {}, data.nicenames?.family ?? {})\n for (const item of data.data ?? []) {\n // Record every slug's title/url so lint can look up caniemail pages\n // for issues that map to a known feature, even ignored ones.\n if (item.slug && item.url) idx.bySlug.set(item.slug, { title: item.title, url: item.url })\n // Index the feature if any cell anywhere in the matrix is non-y.\n // Per-request aggregation (with the active client filter) decides\n // whether to actually surface the issue.\n if (!hasAnyNonY(item.stats)) continue\n const f: Feature = {\n slug: item.slug,\n title: item.title,\n url: item.url,\n category: item.category,\n stats: item.stats,\n }\n classify(f, idx)\n }\n indexes = idx\n return idx\n } catch {\n return null\n }\n })()\n return initPromise\n}\n\n// Note: fetch of the caniemail dataset is lazy — it fires on the first\n// check request, not at module load, so `server.checks: false` pays no\n// network cost.\n\ninterface FileStreams {\n path: string\n source: string\n template: SfcBlock | null\n styles: SfcBlock[]\n classes: Set<string>\n}\n\nfunction collectStreams(\n filePath: string,\n componentMap: Map<string, string>,\n visited: Set<string>,\n out: FileStreams[],\n) {\n if (visited.has(filePath)) return\n visited.add(filePath)\n\n let source: string\n try {\n source = readFileSync(filePath, 'utf-8')\n } catch { return }\n\n const { template, styles } = parseSfcBlocks(source)\n const classes = new Set<string>()\n if (template) extractClasses(template.content, classes)\n\n out.push({ path: filePath, source, template, styles, classes })\n\n if (template) {\n for (const tag of findComponentTags(template.content)) {\n const cp = componentMap.get(tag.toLowerCase())\n if (cp) collectStreams(cp, componentMap, visited, out)\n }\n }\n}\n\nfunction extractClasses(html: string, out: Set<string>) {\n const parser = new Parser({\n onopentag(_tag, attrs) {\n const c = attrs.class\n if (!c) return\n for (const t of c.split(/\\s+/)) if (t) out.add(t)\n },\n }, { decodeEntities: true })\n parser.write(html)\n parser.end()\n}\n\nfunction parseWithIndices(html: string): ChildNode[] {\n const handler = new DomHandler(undefined, { withStartIndices: true })\n const parser = new Parser(handler)\n parser.write(html)\n parser.end()\n return handler.dom\n}\n\nfunction findStyleNodes(nodes: ChildNode[], out: Element[] = []): Element[] {\n for (const n of nodes) {\n const el = n as Element\n if (el.name === 'style') out.push(el)\n if (el.children?.length) findStyleNodes(el.children as ChildNode[], out)\n }\n return out\n}\n\n/**\n * Parse each file's template, collect every `<style>` node with its source\n * line (via htmlparser2 start indices), then pass the combined DOM through\n * the framework's real Tailwind pipeline. The pipeline resolves imports\n * (@maizzle/tailwindcss), compiles utilities from class attrs, lowers modern\n * CSS via lightningcss, and resolves static calc() — so what we walk matches\n * what ships.\n */\nasync function compileViaPipeline(\n streams: FileStreams[],\n config: MaizzleConfig,\n rootFile: string,\n): Promise<Array<{ file: string, css: string, line: number }>> {\n const all: ChildNode[] = []\n const tracked: Array<{ node: Element, file: string, line: number }> = []\n\n for (const s of streams) {\n if (!s.template) continue\n const templateStart = s.source.indexOf(s.template.content)\n const nodes = parseWithIndices(s.template.content)\n for (const styleNode of findStyleNodes(nodes)) {\n const startIdx = (styleNode as any).startIndex ?? 0\n const line = offsetToLine(s.source, templateStart + startIdx)\n tracked.push({ node: styleNode, file: s.path, line })\n }\n for (const n of nodes) all.push(n)\n }\n\n if (!tracked.length) return []\n\n try {\n await compileWithPipeline(all, config, rootFile)\n } catch { return [] }\n\n return tracked\n .map(t => {\n const txt = t.node.children?.find(c => (c as any).type === 'text') as any\n return txt?.data ? { file: t.file, css: txt.data as string, line: t.line } : null\n })\n .filter((x): x is { file: string, css: string, line: number } => x !== null)\n}\n\n/**\n * Walk CSS AST with detectors. Calls onHit per feature hit.\n * `selector` is the containing rule's selector (undefined if no rule ancestor).\n */\nfunction walkCss(\n css: string,\n idx: Indexes,\n onHit: (feature: Feature, node: { line?: number, selector?: string }) => void,\n) {\n let root: postcss.Root\n try { root = safeParser(css) } catch { return }\n\n const containingSelector = (n: postcss.Node | undefined): string | undefined => {\n let p = n?.parent\n while (p && p.type !== 'root') {\n if (p.type === 'rule') return (p as Rule).selector\n p = p.parent\n }\n return undefined\n }\n\n if (idx.cssComments) {\n root.walkComments((c) => { onHit(idx.cssComments!, { line: c.source?.start?.line, selector: containingSelector(c) }) })\n }\n\n root.walkAtRules((atRule: AtRule) => {\n const line = atRule.source?.start?.line\n let sel = containingSelector(atRule)\n if (atRule.name === 'media' && !sel) {\n const innerSelectors: string[] = []\n atRule.walkRules((r) => { innerSelectors.push(r.selector) })\n if (innerSelectors.length) sel = innerSelectors.join(', ')\n }\n\n if (atRule.name === 'media') {\n // Pick the most specific media-feature match (prefers-color-scheme,\n // hover, orientation, …). If one matches, skip the generic `css-at-media`\n // to avoid duplicate rows pointing at the same line.\n const specific: Feature[] = []\n if (idx.cssMediaFeature.size) {\n for (const [feat, fs2] of idx.cssMediaFeature) {\n if (atRule.params.includes(`(${feat}`) || atRule.params.includes(feat)) {\n specific.push(...fs2)\n }\n }\n }\n if (specific.length) {\n for (const f of specific) onHit(f, { line, selector: sel })\n } else {\n const fs = idx.cssAtRule.get('media')\n if (fs) for (const f of fs) onHit(f, { line, selector: sel })\n }\n } else {\n const fs = idx.cssAtRule.get(atRule.name)\n if (fs) for (const f of fs) onHit(f, { line, selector: sel })\n }\n })\n\n root.walkRules((rule: Rule) => {\n const line = rule.source?.start?.line\n const sel = rule.selector\n if (idx.cssPseudoClass.size) {\n for (const [name, fs] of idx.cssPseudoClass) {\n const re = new RegExp(`(^|[^:]):${escapeRe(name)}(\\\\b|\\\\()`)\n if (re.test(sel)) for (const f of fs) onHit(f, { line, selector: sel })\n }\n }\n if (idx.cssPseudoElement.size) {\n for (const [name, fs] of idx.cssPseudoElement) {\n const re = new RegExp(`::${escapeRe(name)}\\\\b`)\n if (re.test(sel)) for (const f of fs) onHit(f, { line, selector: sel })\n }\n }\n })\n\n root.walkDecls((decl: Declaration) => {\n const line = decl.source?.start?.line\n const sel = containingSelector(decl)\n const prop = decl.prop\n\n if (idx.cssImportant && decl.important) onHit(idx.cssImportant, { line, selector: sel })\n if (idx.cssVariables && prop.startsWith('--')) onHit(idx.cssVariables, { line, selector: sel })\n\n const fs = idx.cssProp.get(prop)\n if (fs) for (const f of fs) onHit(f, { line, selector: sel })\n\n const pvs = idx.cssPropValue.get(prop)\n if (pvs) {\n const v = decl.value.trim().toLowerCase()\n for (const pv of pvs) if (v === pv.value) onHit(pv.feature, { line, selector: sel })\n }\n\n if (idx.cssFunction.size || idx.cssUnit.size || idx.cssVariables || idx.cssModernColor) {\n try {\n valueParser(decl.value).walk((n) => {\n if (n.type === 'function') {\n const fname = n.value.toLowerCase()\n const fs2 = idx.cssFunction.get(fname)\n if (fs2) for (const f of fs2) onHit(f, { line, selector: sel })\n if (idx.cssVariables && fname === 'var') onHit(idx.cssVariables, { line, selector: sel })\n if (idx.cssModernColor && MODERN_COLOR_FNS.has(fname)) onHit(idx.cssModernColor, { line, selector: sel })\n } else if (n.type === 'word') {\n const m = /^-?\\d*\\.?\\d+([a-z%]+)$/i.exec(n.value)\n if (m) {\n const unit = m[1].toLowerCase()\n const fs2 = idx.cssUnit.get(unit)\n if (fs2) for (const f of fs2) onHit(f, { line, selector: sel })\n }\n }\n })\n } catch {}\n }\n })\n}\n\nconst MODERN_COLOR_FNS = new Set(['oklch', 'oklab', 'lch', 'lab', 'color', 'color-mix', 'hwb'])\n\nfunction escapeRe(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\nfunction offsetToLine(source: string, offset: number): number {\n let line = 1\n for (let i = 0; i < offset && i < source.length; i++) {\n if (source.charCodeAt(i) === 10) line++\n }\n return line\n}\n\nfunction walkTemplate(\n html: string,\n idx: Indexes,\n fileLineOffset: number,\n source: string,\n templateStartOffset: number,\n onHit: (feature: Feature, line: number) => void,\n) {\n const semanticTags = new Set(['article', 'aside', 'details', 'figcaption', 'figure',\n 'footer', 'header', 'main', 'mark', 'nav', 'section', 'time', 'summary'])\n\n // Stack of tags that opened a body-scope: a literal <body> or a\n // <Teleport to=\"body...\"> whose rendered contents land inside body.\n const bodyScopeStack: string[] = []\n const parser = new Parser({\n onopentag(tag, attrs) {\n const startIdx = (parser as any).startIndex as number\n const line = offsetToLine(source, templateStartOffset + startIdx)\n\n const tagFs = idx.htmlTag.get(tag)\n if (tagFs) for (const f of tagFs) onHit(f, line)\n\n if (idx.htmlSemantics && semanticTags.has(tag)) onHit(idx.htmlSemantics, line)\n\n if (tag === 'style' && bodyScopeStack.length > 0 && idx.htmlStyleInBody) {\n onHit(idx.htmlStyleInBody, line)\n }\n if (tag === 'body') bodyScopeStack.push(tag)\n else if (tag === 'teleport' && /body/i.test(attrs.to ?? '')) bodyScopeStack.push(tag)\n\n for (const attr in attrs) {\n const attrFs = idx.htmlAttr.get(attr)\n if (attrFs) for (const f of attrFs) onHit(f, line)\n }\n\n if (tag === 'input' && attrs.type) {\n const fs = idx.htmlInputType.get(attrs.type.toLowerCase())\n if (fs) for (const f of fs) onHit(f, line)\n }\n if (tag === 'button' && attrs.type) {\n const fs = idx.htmlButtonType.get(attrs.type.toLowerCase())\n if (fs) for (const f of fs) onHit(f, line)\n }\n if (tag === 'a' && attrs.href) {\n const h = attrs.href.trim()\n if (idx.htmlMailtoLinks && /^mailto:/i.test(h)) onHit(idx.htmlMailtoLinks, line)\n else if (idx.htmlAnchorLinks && h.startsWith('#')) onHit(idx.htmlAnchorLinks, line)\n }\n if (tag === 'meta' && idx.htmlMetaColorScheme\n && attrs.name?.toLowerCase() === 'color-scheme') onHit(idx.htmlMetaColorScheme, line)\n\n // Image formats via src / srcset\n if (idx.imageExt.size && (attrs.src || attrs.srcset)) {\n const urls: string[] = []\n if (attrs.src) urls.push(attrs.src)\n if (attrs.srcset) for (const part of attrs.srcset.split(',')) urls.push(part.trim().split(/\\s+/)[0])\n for (const url of urls) {\n const m = /\\.([a-z0-9]+)(?:\\?|#|$)/i.exec(url)\n if (!m) continue\n const fs = idx.imageExt.get(m[1].toLowerCase())\n if (fs) for (const f of fs) onHit(f, line)\n }\n }\n\n // inline style attribute → scan as CSS decl list\n if (attrs.style) scanInlineStyle(attrs.style, idx, line, onHit)\n },\n onclosetag(tag) {\n const top = bodyScopeStack[bodyScopeStack.length - 1]\n if (top === tag) bodyScopeStack.pop()\n },\n onprocessinginstruction(name) {\n if (idx.htmlDoctype && name.toLowerCase() === '!doctype') {\n const startIdx = (parser as any).startIndex as number\n onHit(idx.htmlDoctype, offsetToLine(source, templateStartOffset + startIdx))\n }\n },\n oncomment() {\n if (idx.htmlComments) {\n const startIdx = (parser as any).startIndex as number\n onHit(idx.htmlComments, offsetToLine(source, templateStartOffset + startIdx))\n }\n },\n }, { decodeEntities: false, lowerCaseTags: true, lowerCaseAttributeNames: true })\n\n parser.write(html)\n parser.end()\n}\n\nfunction scanInlineStyle(\n style: string,\n idx: Indexes,\n line: number,\n onHit: (feature: Feature, line: number) => void,\n) {\n // Wrap in a rule so safeParser produces a Root with declarations\n const wrapped = `*{${style}}`\n try {\n const root = safeParser(wrapped)\n root.walkDecls((decl) => {\n if (idx.cssImportant && decl.important) onHit(idx.cssImportant, line)\n const fs = idx.cssProp.get(decl.prop)\n if (fs) for (const f of fs) onHit(f, line)\n if (idx.cssVariables && decl.prop.startsWith('--')) onHit(idx.cssVariables, line)\n const pvs = idx.cssPropValue.get(decl.prop)\n if (pvs) {\n const v = decl.value.trim().toLowerCase()\n for (const pv of pvs) if (v === pv.value) onHit(pv.feature, line)\n }\n if (idx.cssFunction.size || idx.cssUnit.size || idx.cssVariables || idx.cssModernColor) {\n try {\n valueParser(decl.value).walk((n) => {\n if (n.type === 'function') {\n const fname = n.value.toLowerCase()\n const fs2 = idx.cssFunction.get(fname)\n if (fs2) for (const f of fs2) onHit(f, line)\n if (idx.cssVariables && fname === 'var') onHit(idx.cssVariables, line)\n if (idx.cssModernColor && MODERN_COLOR_FNS.has(fname)) onHit(idx.cssModernColor, line)\n } else if (n.type === 'word') {\n const m = /^-?\\d*\\.?\\d+([a-z%]+)$/i.exec(n.value)\n if (m) {\n const fs2 = idx.cssUnit.get(m[1].toLowerCase())\n if (fs2) for (const f of fs2) onHit(f, line)\n }\n }\n })\n } catch {}\n }\n })\n } catch {}\n}\n\nfunction labelFor(idx: Indexes, level: SupportLevel): string {\n const n = idx.nicenames\n if (level === 'unsupported') return n.unsupported ?? 'Not supported'\n if (level === 'mitigated') return n.mitigated ?? 'Partially supported'\n return n.unknown ?? 'Support unknown'\n}\n\nasync function scan(\n rootFile: string,\n config: MaizzleConfig,\n componentDirs: string[],\n allowedClients: Set<string> | 'all',\n): Promise<Issue[]> {\n const idx = await initCompatibility()\n if (!idx) return []\n\n const root = config.root ?? process.cwd()\n const componentMap = await buildComponentMap(root, componentDirs)\n const streams: FileStreams[] = []\n collectStreams(rootFile, componentMap, new Set(), streams)\n\n const issues: Issue[] = []\n const seen = new Set<string>()\n const resolvedCache = new Map<string, { level: SupportLevel, affected: string[] } | null>()\n const resolveSupport = (f: Feature) => {\n let cached = resolvedCache.get(f.slug)\n if (cached === undefined) {\n cached = computeSupport(f.stats, idx.familyNicenames, allowedClients)\n resolvedCache.set(f.slug, cached)\n }\n return cached\n }\n const add = (f: Feature, file: string, line?: number) => {\n const key = `${f.slug}|${file}|${line ?? 0}`\n if (seen.has(key)) return\n const support = resolveSupport(f)\n if (!support) return\n seen.add(key)\n issues.push({\n kind: 'compat',\n slug: f.slug, title: f.title, url: f.url, category: f.category,\n supportLevel: support.level, supportLabel: labelFor(idx, support.level),\n affectedClients: support.affected,\n line, file,\n })\n }\n\n // Stream A: compiled CSS from real pipeline — reflects shipped output\n // (Tailwind utilities resolved, @maizzle/tailwindcss imported, calc\n // resolved, modern CSS lowered). Filter hits whose containing selector\n // doesn't reference a user class — drops Tailwind preflight noise.\n // For hits without a class selector (e.g. @media, user-written rules),\n // attribute to the file that owned the style block.\n const compiledBlocks = await compileViaPipeline(streams, config, rootFile)\n for (const block of compiledBlocks) {\n walkCss(block.css, idx, (feature, node) => {\n const locations = classLocations(node.selector, streams)\n if (!locations.length) {\n add(feature, block.file, block.line)\n return\n }\n // @media features collapse to a single source line: the first usage\n // of whatever class/variant triggered the wrapper. Other features\n // show up for every occurrence.\n if (feature.slug.startsWith('css-at-media')) {\n add(feature, locations[0].file, locations[0].line)\n } else {\n for (const { file, line } of locations) add(feature, file, line)\n }\n })\n }\n\n // Stream C: source template per file\n for (const s of streams) {\n if (!s.template) continue\n walkTemplate(s.template.content, idx, s.template.offset, s.source,\n s.source.indexOf(s.template.content),\n (feature, line) => add(feature, s.path, line))\n }\n\n return issues\n}\n\n/**\n * Return every (file, line) where any class from the selector appears in a\n * template. Scans every stream so a shared utility class used in multiple\n * components surfaces once per occurrence.\n */\nfunction classLocations(\n selector: string | undefined,\n streams: FileStreams[],\n): Array<{ file: string, line: number }> {\n if (!selector) return []\n const classNames = extractSelectorClasses(selector)\n if (!classNames.length) return []\n const out: Array<{ file: string, line: number }> = []\n const seen = new Set<string>()\n for (const cn of classNames) {\n for (const s of streams) {\n if (!s.classes.has(cn) || !s.template) continue\n const tpl = s.template.content\n const tplStart = s.source.indexOf(tpl)\n let pos = 0\n while (true) {\n const i = tpl.indexOf(cn, pos)\n if (i < 0) break\n pos = i + cn.length\n // Whole-word boundary: adjacent char must be whitespace or quote\n const before = i > 0 ? tpl[i - 1] : ' '\n const after = i + cn.length < tpl.length ? tpl[i + cn.length] : ' '\n if (!isClassBoundary(before) || !isClassBoundary(after)) continue\n const line = offsetToLine(s.source, tplStart + i)\n const key = `${s.path}|${line}`\n if (seen.has(key)) continue\n seen.add(key)\n out.push({ file: s.path, line })\n }\n }\n }\n return out\n}\n\nfunction isClassBoundary(c: string): boolean {\n return c === ' ' || c === '\\t' || c === '\\n' || c === '\\r' || c === '\"' || c === \"'\"\n}\n\nfunction extractSelectorClasses(selector: string): string[] {\n const out: string[] = []\n const re = /\\.((?:\\\\.|[\\w-])+)/g\n let m\n while ((m = re.exec(selector)) !== null) {\n out.push(m[1].replace(/\\\\(.)/g, '$1'))\n }\n return out\n}\n\nconst CATEGORY_ORDER = ['css', 'html', 'image', 'others']\nconst LEVEL_ORDER: Record<string, number> = { error: 0, unsupported: 1, warning: 2, mitigated: 3, unknown: 4 }\n\nfunction orderKey(i: Issue): number {\n if (i.kind === 'lint') return LEVEL_ORDER[i.severity!] ?? 99\n return LEVEL_ORDER[i.supportLevel!] ?? 99\n}\n\nfunction resolveChecksConfig(config: MaizzleConfig) {\n const raw = (config as any).server?.checks\n if (raw === false) return null\n const clients: Set<string> | 'all' = raw?.clients === 'all'\n ? 'all'\n : Array.isArray(raw?.clients) && raw.clients.length\n ? new Set(raw.clients as string[])\n : DEFAULT_CLIENTS\n const level: 'error' | 'warning' | 'lint' | null = raw?.level ?? null\n return { clients, level }\n}\n\nfunction passesLevelFilter(issue: Issue, level: 'error' | 'warning' | 'lint' | null): boolean {\n if (!level) return true\n if (level === 'lint') return issue.kind === 'lint'\n if (issue.kind === 'lint') {\n return level === 'error' ? issue.severity === 'error' : issue.severity === 'warning'\n }\n // compat\n return level === 'error'\n ? issue.supportLevel === 'unsupported'\n : issue.supportLevel === 'mitigated' || issue.supportLevel === 'unknown'\n}\n\nexport async function serveCompatibility(\n url: string,\n res: any,\n config: MaizzleConfig,\n componentDirs: string[],\n) {\n const filePath = url.replace('/__maizzle/compatibility/', '').replace(/\\?.*$/, '')\n const checksCfg = resolveChecksConfig(config)\n try {\n res.setHeader('Content-Type', 'application/json')\n if (!checksCfg) {\n // Defensive: UI hides the tab using window.__MAIZZLE_CONFIG__ so it\n // shouldn't reach this endpoint when disabled, but if something else\n // does, return an empty list.\n res.end(JSON.stringify([]))\n return\n }\n const absolutePath = resolve(filePath)\n const [compatIssues, lintIssues] = await Promise.all([\n scan(absolutePath, config, componentDirs, checksCfg.clients),\n scanLint(absolutePath, config, componentDirs),\n ])\n\n const idx = await initCompatibility()\n const lintAsIssues: Issue[] = lintIssues.map((li) => {\n const info = li.slug ? idx?.bySlug.get(li.slug) : undefined\n return {\n kind: 'lint',\n slug: li.slug,\n title: li.title,\n url: info?.url,\n category: li.category,\n severity: li.type,\n message: li.message,\n line: li.line,\n file: li.file,\n }\n })\n\n let issues: Issue[] = [...compatIssues, ...lintAsIssues]\n if (checksCfg.level) issues = issues.filter((i) => passesLevelFilter(i, checksCfg.level))\n issues.sort((a, b) => {\n const c = CATEGORY_ORDER.indexOf(a.category) - CATEGORY_ORDER.indexOf(b.category)\n if (c) return c\n const l = orderKey(a) - orderKey(b)\n if (l) return l\n return (a.slug ?? a.title).localeCompare(b.slug ?? b.title)\n })\n res.end(JSON.stringify(issues))\n } catch (error: any) {\n res.statusCode = 500\n res.end(JSON.stringify({ error: error.message }))\n }\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,UAAU;AAChB,MAAM,kBAAkB,IAAI,IAAI;CAAC;CAAS;CAAc;CAAW;CAAQ,CAAC;AA6D5E,IAAI,UAA0B;AAC9B,IAAI,cAA8C;AAElD,SAAS,MAAY,GAAgB,GAAM,GAAM;CAC/C,MAAM,MAAM,EAAE,IAAI,EAAE;AACpB,KAAI,IAAK,KAAI,KAAK,EAAE;KACf,GAAE,IAAI,GAAG,CAAC,EAAE,CAAC;;AAGpB,SAAS,aAAa,WAAgB,iBAAkD;AACtF,QAAO;EACL;EACA;EACA,yBAAS,IAAI,KAAK;EAAE,8BAAc,IAAI,KAAK;EAAE,2BAAW,IAAI,KAAK;EACjE,iCAAiB,IAAI,KAAK;EAAE,gCAAgB,IAAI,KAAK;EAAE,kCAAkB,IAAI,KAAK;EAClF,6BAAa,IAAI,KAAK;EAAE,yBAAS,IAAI,KAAK;EAC1C,yBAAS,IAAI,KAAK;EAAE,0BAAU,IAAI,KAAK;EAAE,+BAAe,IAAI,KAAK;EAAE,gCAAgB,IAAI,KAAK;EAC5F,0BAAU,IAAI,KAAK;EACnB,wBAAQ,IAAI,KAAK;EAClB;;AAGH,SAAS,WAAW,OAAqB;AACvC,KAAI,CAAC,MAAO,QAAO;AACnB,MAAK,MAAM,UAAU,MACnB,MAAK,MAAM,QAAQ,MAAM,QACvB,MAAK,MAAM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GAAG;IACb,UAAU,GAAG;IACb,SAAS,GAAG;IACZ,MAAM,GAAG;IACT,MAAM,GAAG;IACV;IACD;EAEF,IAAI,SAAkB,CAAC,GAAG,cAAc,GAAG,aAAa;AACxD,MAAI,UAAU,MAAO,UAAS,OAAO,QAAQ,MAAM,kBAAkB,GAAG,UAAU,MAAM,CAAC;AACzF,SAAO,MAAM,GAAG,MAAM;GACpB,MAAM,IAAI,eAAe,QAAQ,EAAE,SAAS,GAAG,eAAe,QAAQ,EAAE,SAAS;AACjF,OAAI,EAAG,QAAO;GACd,MAAM,IAAI,SAAS,EAAE,GAAG,SAAS,EAAE;AACnC,OAAI,EAAG,QAAO;AACd,WAAQ,EAAE,QAAQ,EAAE,OAAO,cAAc,EAAE,QAAQ,EAAE,MAAM;IAC3D;AACF,MAAI,IAAI,KAAK,UAAU,OAAO,CAAC;UACxB,OAAY;AACnB,MAAI,aAAa;AACjB,MAAI,IAAI,KAAK,UAAU,EAAE,OAAO,MAAM,SAAS,CAAC,CAAC"}
@@ -1,5 +1,18 @@
1
+ import { MaizzleConfig } from "../types/config.mjs";
1
2
  //#region src/server/linter.d.ts
2
- declare function serveLint(url: string, res: any): void;
3
+ interface LintIssue {
4
+ type: 'error' | 'warning';
5
+ title: string;
6
+ message: string;
7
+ /** Which tab this lands in when merged into the Checks panel. */
8
+ category: 'css' | 'html' | 'image' | 'others';
9
+ /** Optional caniemail slug for URL enrichment (e.g. "html-html"). */
10
+ slug?: string;
11
+ line?: number;
12
+ file: string;
13
+ }
14
+ declare function scanLint(rootFile: string, config: MaizzleConfig, componentDirs: string[]): Promise<LintIssue[]>;
15
+ declare function serveLint(url: string, res: any, config: MaizzleConfig, componentDirs: string[]): Promise<void>;
3
16
  //#endregion
4
- export { serveLint };
17
+ export { LintIssue, scanLint, serveLint };
5
18
  //# sourceMappingURL=linter.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"linter.d.mts","names":[],"sources":["../../src/server/linter.ts"],"mappings":";iBAUgB,SAAA,CAAU,GAAA,UAAa,GAAA"}
1
+ {"version":3,"file":"linter.d.mts","names":[],"sources":["../../src/server/linter.ts"],"mappings":";;UAKiB,SAAA;EACf,IAAA;EACA,KAAA;EACA,OAAA;EAHwB;EAKxB,QAAA;EALwB;EAOxB,IAAA;EACA,IAAA;EACA,IAAA;AAAA;AAAA,iBA8BoB,QAAA,CACpB,QAAA,UACA,MAAA,EAAQ,aAAA,EACR,aAAA,aACC,OAAA,CAAQ,SAAA;AAAA,iBAeW,SAAA,CAAU,GAAA,UAAa,GAAA,OAAU,MAAA,EAAQ,aAAA,EAAe,aAAA,aAAuB,OAAA"}
@@ -1,13 +1,74 @@
1
+ import { buildComponentMap, findComponentTags, parseSfcBlocks } from "./sfc-utils.mjs";
1
2
  import { readFileSync } from "node:fs";
2
3
  import { resolve } from "node:path";
3
4
 
4
5
  //#region src/server/linter.ts
5
- function serveLint(url, res) {
6
+ /**
7
+ * Maizzle auto-adds role="none" to every <table> by default via the
8
+ * addAttributes transformer. Warn about missing role only when that won't
9
+ * happen:
10
+ * - useTransformers: false → whole pipeline off
11
+ * - html.attributes.add: false → auto-add disabled globally
12
+ * - add.table: false → table selector opted out
13
+ * - add.table.role: false → role attribute specifically opted out
14
+ * An empty `add.table: {}` still inherits role via defu merge, so it's fine.
15
+ */
16
+ function tableRoleAutoAdded(config) {
17
+ if (config.useTransformers === false) return false;
18
+ const add = config.html?.attributes?.add;
19
+ if (add === false) return false;
20
+ if (!add || typeof add !== "object") return true;
21
+ const table = add.table;
22
+ if (table === false) return false;
23
+ if (table && typeof table === "object" && table.role === false) return false;
24
+ return true;
25
+ }
26
+ async function scanLint(rootFile, config, componentDirs) {
27
+ const componentMap = await buildComponentMap(config.root ?? process.cwd(), componentDirs);
28
+ const visited = /* @__PURE__ */ new Set();
29
+ const presence = {
30
+ html: false,
31
+ head: false,
32
+ body: false
33
+ };
34
+ const issues = checkFile(rootFile, componentMap, visited, presence, !tableRoleAutoAdded(config));
35
+ if (!presence.html) issues.push({
36
+ type: "warning",
37
+ category: "html",
38
+ title: "Missing <html>",
39
+ message: "Root <html> tag not found in the template or any of its components.",
40
+ slug: "html-html",
41
+ line: 1,
42
+ file: rootFile
43
+ });
44
+ if (!presence.head) issues.push({
45
+ type: "warning",
46
+ category: "html",
47
+ title: "Missing <head>",
48
+ message: "Root <head> tag not found in the template or any of its components.",
49
+ slug: "html-head",
50
+ line: 1,
51
+ file: rootFile
52
+ });
53
+ if (!presence.body) issues.push({
54
+ type: "warning",
55
+ category: "html",
56
+ title: "Missing <body>",
57
+ message: "Root <body> tag not found in the template or any of its components.",
58
+ slug: "html-body",
59
+ line: 1,
60
+ file: rootFile
61
+ });
62
+ return issues;
63
+ }
64
+ async function serveLint(url, res, config, componentDirs) {
6
65
  const filePath = url.replace("/__maizzle/lint/", "").replace(/\?.*$/, "");
7
66
  try {
8
- const source = readFileSync(resolve(filePath), "utf-8");
9
- const templateMatch = source.match(/<template\b[^>]*>([\s\S]*)<\/template>/);
10
- const issues = lintHtml(templateMatch ? templateMatch[1] : source, templateMatch ? source.slice(0, source.indexOf(templateMatch[0]) + templateMatch[0].indexOf(templateMatch[1])).split("\n").length - 1 : 0);
67
+ const issues = await scanLint(resolve(filePath), config, componentDirs);
68
+ issues.sort((a, b) => {
69
+ if (a.type !== b.type) return a.type === "error" ? -1 : 1;
70
+ return (a.line ?? 0) - (b.line ?? 0);
71
+ });
11
72
  res.setHeader("Content-Type", "application/json");
12
73
  res.end(JSON.stringify(issues));
13
74
  } catch (error) {
@@ -15,70 +76,158 @@ function serveLint(url, res) {
15
76
  res.end(JSON.stringify({ error: error.message }));
16
77
  }
17
78
  }
79
+ function checkFile(filePath, componentMap, visited, presence, checkTableRole) {
80
+ if (visited.has(filePath)) return [];
81
+ visited.add(filePath);
82
+ let source;
83
+ try {
84
+ source = readFileSync(filePath, "utf-8");
85
+ } catch {
86
+ return [];
87
+ }
88
+ const { template } = parseSfcBlocks(source);
89
+ const issues = [];
90
+ if (template) {
91
+ issues.push(...lintHtml(template.content, template.offset, filePath, presence, checkTableRole));
92
+ const componentTags = findComponentTags(template.content);
93
+ for (const tag of componentTags) {
94
+ const componentPath = componentMap.get(tag.toLowerCase());
95
+ if (componentPath) issues.push(...checkFile(componentPath, componentMap, visited, presence, checkTableRole));
96
+ }
97
+ }
98
+ return issues;
99
+ }
18
100
  function lineAt(html, offset, lineOffset) {
19
101
  return html.slice(0, offset).split("\n").length + lineOffset;
20
102
  }
21
- function lintHtml(html, lineOffset = 0) {
103
+ /**
104
+ * True if the <img> tag has a width defined via any of:
105
+ * - `width` attribute
106
+ * - inline `style` with a `width` property
107
+ * - class attribute with a Tailwind `w-` utility (any variant prefix like
108
+ * sm:, hover:), or an arbitrary `[width:…]` utility
109
+ */
110
+ function hasWidthDefined(imgTag) {
111
+ if (/\bwidth\s*=/i.test(imgTag)) return true;
112
+ const styleMatch = imgTag.match(/\bstyle\s*=\s*["']([^"']*)["']/i);
113
+ if (styleMatch && /(^|[;\s])width\s*:/i.test(styleMatch[1])) return true;
114
+ const classMatch = imgTag.match(/\bclass\s*=\s*["']([^"']*)["']/i);
115
+ if (classMatch) {
116
+ const classes = classMatch[1];
117
+ if (/(?:^|\s)(?:[a-z0-9-]+:)*w-\S+/i.test(classes)) return true;
118
+ if (/\[width:/i.test(classes)) return true;
119
+ }
120
+ return false;
121
+ }
122
+ function lintHtml(html, lineOffset, filePath, presence, checkTableRole) {
22
123
  const issues = [];
23
124
  for (const m of Array.from(html.matchAll(/<([a-zA-Z][a-zA-Z0-9]*)\b([\s\S]*?)>/g))) {
24
125
  const tag = m[0];
25
126
  const tagName = m[1].toLowerCase();
26
127
  const line = lineAt(html, m.index, lineOffset);
128
+ if (tagName === "html") presence.html = true;
129
+ else if (tagName === "head") presence.head = true;
130
+ else if (tagName === "body") presence.body = true;
131
+ if (checkTableRole && tagName === "table") {
132
+ if (!tag.match(/\brole\s*=\s*["']([^"']*)["']/i)) {
133
+ const tableEndIdx = html.indexOf("</table>", m.index);
134
+ const inner = tableEndIdx >= 0 ? html.slice(m.index, tableEndIdx) : "";
135
+ if (!(/<th\b/i.test(inner) || /<caption\b/i.test(inner))) issues.push({
136
+ type: "warning",
137
+ category: "html",
138
+ title: "Layout table missing role",
139
+ message: "Add role=\"none\" so screen readers skip this layout table.",
140
+ slug: "html-role",
141
+ line,
142
+ file: filePath
143
+ });
144
+ }
145
+ }
27
146
  if (tagName === "img") {
28
147
  if (!/\balt\s*=/i.test(tag)) issues.push({
29
148
  type: "warning",
149
+ category: "image",
30
150
  title: "Missing alt text",
31
151
  message: "Image is missing the alt attribute",
32
- line
152
+ line,
153
+ file: filePath
33
154
  });
34
155
  const srcMatch = tag.match(/\bsrc\s*=\s*["']([^"']*)["']/i);
35
156
  if (!srcMatch) issues.push({
36
157
  type: "error",
158
+ category: "image",
37
159
  title: "Missing image src",
38
160
  message: "Image tag has no src attribute",
39
- line
161
+ line,
162
+ file: filePath
40
163
  });
41
164
  else if (!srcMatch[1].trim()) issues.push({
42
165
  type: "error",
166
+ category: "image",
43
167
  title: "Empty image src",
44
168
  message: "Image src attribute is empty",
45
- line
169
+ line,
170
+ file: filePath
46
171
  });
47
172
  else if (srcMatch[1].trim().startsWith("http:")) issues.push({
48
173
  type: "warning",
174
+ category: "image",
49
175
  title: "Insecure image src",
50
176
  message: "Image loads over HTTP instead of HTTPS",
51
- line
52
- });
53
- }
54
- const hrefMatch = tag.match(/\bhref\s*=\s*["']([^"']*)["']/i);
55
- if (hrefMatch) {
56
- const href = hrefMatch[1].trim();
57
- if (!href) issues.push({
58
- type: "warning",
59
- title: "Empty link href",
60
- message: "Link href attribute is empty",
61
- line
62
- });
63
- else if (href === "#" || href === "/") issues.push({
64
- type: "warning",
65
- title: "Placeholder link",
66
- message: `Link href is "${href}"`,
67
- line
177
+ line,
178
+ file: filePath
68
179
  });
69
- else if (href.startsWith("http:")) issues.push({
180
+ if (!hasWidthDefined(tag)) issues.push({
70
181
  type: "warning",
71
- title: "Insecure link",
72
- message: "Link uses HTTP instead of HTTPS",
73
- line
74
- });
75
- else if (href.startsWith("http") && !/^https?:\/\/.+\..+/i.test(href)) issues.push({
76
- type: "warning",
77
- title: "Invalid link",
78
- message: `Link href "${href}" looks malformed`,
79
- line
182
+ category: "image",
183
+ title: "Missing image width",
184
+ message: "Use a `width=\"\"` attribute for best results in Outlook",
185
+ line,
186
+ file: filePath
80
187
  });
81
188
  }
189
+ if (![
190
+ "link",
191
+ "script",
192
+ "source"
193
+ ].includes(tagName)) {
194
+ const hrefMatch = tag.match(/\bhref\s*=\s*["']([^"']*)["']/i);
195
+ if (hrefMatch) {
196
+ const href = hrefMatch[1].trim();
197
+ if (!href) issues.push({
198
+ type: "error",
199
+ category: "html",
200
+ title: "Empty link href",
201
+ message: "Link href attribute is empty",
202
+ line,
203
+ file: filePath
204
+ });
205
+ else if (href === "#" || href === "/") issues.push({
206
+ type: "error",
207
+ category: "html",
208
+ title: "Placeholder link",
209
+ message: `Link href is "${href}"`,
210
+ line,
211
+ file: filePath
212
+ });
213
+ else if (href.startsWith("http:")) issues.push({
214
+ type: "warning",
215
+ category: "html",
216
+ title: "Insecure link",
217
+ message: "Link uses HTTP instead of HTTPS",
218
+ line,
219
+ file: filePath
220
+ });
221
+ else if (href.startsWith("http") && !/^https?:\/\/.+\..+/i.test(href)) issues.push({
222
+ type: "error",
223
+ category: "html",
224
+ title: "Invalid link",
225
+ message: `Link href "${href}" looks malformed`,
226
+ line,
227
+ file: filePath
228
+ });
229
+ }
230
+ }
82
231
  if ([
83
232
  "link",
84
233
  "script",
@@ -87,17 +236,21 @@ function lintHtml(html, lineOffset = 0) {
87
236
  const attrMatch = tag.match(/\b(?:href|src)\s*=\s*["']([^"']*)["']/i);
88
237
  if (attrMatch && attrMatch[1].trim().startsWith("http:")) issues.push({
89
238
  type: "warning",
239
+ category: "html",
90
240
  title: "Insecure resource",
91
241
  message: "Resource loads over HTTP instead of HTTPS",
92
- line
242
+ line,
243
+ file: filePath
93
244
  });
94
245
  }
95
246
  }
96
247
  for (const m of Array.from(html.matchAll(/url\s*\(\s*["']?(http:[^"')]+)["']?\s*\)/gi))) issues.push({
97
248
  type: "warning",
249
+ category: "css",
98
250
  title: "Insecure CSS url()",
99
251
  message: "CSS url() loads over HTTP instead of HTTPS",
100
- line: lineAt(html, m.index, lineOffset)
252
+ line: lineAt(html, m.index, lineOffset),
253
+ file: filePath
101
254
  });
102
255
  const voidElements = new Set([
103
256
  "area",
@@ -173,17 +326,15 @@ function lintHtml(html, lineOffset = 0) {
173
326
  }
174
327
  for (const unclosed of stack) issues.push({
175
328
  type: "error",
329
+ category: "html",
176
330
  title: "Unclosed tag",
177
331
  message: `<${unclosed.tag}> tag is not closed`,
178
- line: unclosed.line
179
- });
180
- issues.sort((a, b) => {
181
- if (a.type !== b.type) return a.type === "error" ? -1 : 1;
182
- return (a.line ?? 0) - (b.line ?? 0);
332
+ line: unclosed.line,
333
+ file: filePath
183
334
  });
184
335
  return issues;
185
336
  }
186
337
 
187
338
  //#endregion
188
- export { serveLint };
339
+ export { scanLint, serveLint };
189
340
  //# sourceMappingURL=linter.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"linter.mjs","names":[],"sources":["../../src/server/linter.ts"],"sourcesContent":["import { readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\ninterface LintIssue {\n type: 'error' | 'warning'\n title: string\n message: string\n line?: number\n}\n\nexport function serveLint(url: string, res: any) {\n const filePath = url.replace('/__maizzle/lint/', '').replace(/\\?.*$/, '')\n\n try {\n const source = readFileSync(resolve(filePath), 'utf-8')\n\n // Extract only the <template> block for linting\n const templateMatch = source.match(/<template\\b[^>]*>([\\s\\S]*)<\\/template>/)\n const html = templateMatch ? templateMatch[1] : source\n\n // Calculate the offset of the <template> content within the source file\n const templateOffset = templateMatch\n ? source.slice(0, source.indexOf(templateMatch[0]) + templateMatch[0].indexOf(templateMatch[1])).split('\\n').length - 1\n : 0\n\n const issues = lintHtml(html, templateOffset)\n\n res.setHeader('Content-Type', 'application/json')\n res.end(JSON.stringify(issues))\n } catch (error: any) {\n res.statusCode = 500\n res.end(JSON.stringify({ error: error.message }))\n }\n}\n\nfunction lineAt(html: string, offset: number, lineOffset: number): number {\n return html.slice(0, offset).split('\\n').length + lineOffset\n}\n\nfunction lintHtml(html: string, lineOffset = 0): LintIssue[] {\n const issues: LintIssue[] = []\n\n // Match all tags (multiline) — [^>] doesn't cross > so use [\\s\\S] with lazy quantifier\n const tagRe = /<([a-zA-Z][a-zA-Z0-9]*)\\b([\\s\\S]*?)>/g\n\n for (const m of Array.from(html.matchAll(tagRe))) {\n const tag = m[0]\n const tagName = m[1].toLowerCase()\n const line = lineAt(html, m.index!, lineOffset)\n\n // Images\n if (tagName === 'img') {\n if (!/\\balt\\s*=/i.test(tag)) {\n issues.push({ type: 'warning', title: 'Missing alt text', message: 'Image is missing the alt attribute', line })\n }\n\n const srcMatch = tag.match(/\\bsrc\\s*=\\s*[\"']([^\"']*)[\"']/i)\n if (!srcMatch) {\n issues.push({ type: 'error', title: 'Missing image src', message: 'Image tag has no src attribute', line })\n } else if (!srcMatch[1].trim()) {\n issues.push({ type: 'error', title: 'Empty image src', message: 'Image src attribute is empty', line })\n } else if (srcMatch[1].trim().startsWith('http:')) {\n issues.push({ type: 'warning', title: 'Insecure image src', message: 'Image loads over HTTP instead of HTTPS', line })\n }\n }\n\n // Any tag with href (catches <a>, <Button>, etc.)\n const hrefMatch = tag.match(/\\bhref\\s*=\\s*[\"']([^\"']*)[\"']/i)\n if (hrefMatch) {\n const href = hrefMatch[1].trim()\n if (!href) {\n issues.push({ type: 'warning', title: 'Empty link href', message: 'Link href attribute is empty', line })\n } else if (href === '#' || href === '/') {\n issues.push({ type: 'warning', title: 'Placeholder link', message: `Link href is \"${href}\"`, line })\n } else if (href.startsWith('http:')) {\n issues.push({ type: 'warning', title: 'Insecure link', message: 'Link uses HTTP instead of HTTPS', line })\n } else if (href.startsWith('http') && !/^https?:\\/\\/.+\\..+/i.test(href)) {\n issues.push({ type: 'warning', title: 'Invalid link', message: `Link href \"${href}\" looks malformed`, line })\n }\n }\n\n // Insecure resources (<link>, <script>, <source>)\n if (['link', 'script', 'source'].includes(tagName)) {\n const attrMatch = tag.match(/\\b(?:href|src)\\s*=\\s*[\"']([^\"']*)[\"']/i)\n if (attrMatch && attrMatch[1].trim().startsWith('http:')) {\n issues.push({ type: 'warning', title: 'Insecure resource', message: 'Resource loads over HTTP instead of HTTPS', line })\n }\n }\n }\n\n // Insecure CSS url() references\n for (const m of Array.from(html.matchAll(/url\\s*\\(\\s*[\"']?(http:[^\"')]+)[\"']?\\s*\\)/gi))) {\n issues.push({ type: 'warning', title: 'Insecure CSS url()', message: 'CSS url() loads over HTTP instead of HTTPS', line: lineAt(html, m.index!, lineOffset) })\n }\n\n // Check for unclosed tags (block-level and common inline elements)\n const voidElements = new Set([\n 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',\n 'link', 'meta', 'param', 'source', 'track', 'wbr',\n ])\n\n const trackedTags = new Set([\n 'a', 'b', 'body', 'div', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',\n 'head', 'html', 'i', 'li', 'ol', 'p', 'span', 'strong', 'style',\n 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'title', 'tr', 'u', 'ul',\n ])\n\n const stack: Array<{ tag: string, line: number }> = []\n\n // Strip comments and content inside <style>/<script> to avoid false matches\n const stripped = html\n .replace(/<!--[\\s\\S]*?-->/g, (m) => '\\n'.repeat((m.match(/\\n/g) || []).length))\n .replace(/<(style|script)\\b[^>]*>[\\s\\S]*?<\\/\\1>/gi, (m) => '\\n'.repeat((m.match(/\\n/g) || []).length))\n\n const strippedLines = stripped.split('\\n')\n\n for (let i = 0; i < strippedLines.length; i++) {\n const line = strippedLines[i]\n const tagRegex = /<\\/?([a-zA-Z][a-zA-Z0-9]*)\\b[^>]*\\/?>/g\n let m\n\n while ((m = tagRegex.exec(line)) !== null) {\n const fullMatch = m[0]\n const tagName = m[1].toLowerCase()\n\n if (!trackedTags.has(tagName) || voidElements.has(tagName)) continue\n if (fullMatch.endsWith('/>')) continue\n\n if (fullMatch.startsWith('</')) {\n // Closing tag\n let lastOpen = -1\n for (let j = stack.length - 1; j >= 0; j--) {\n if (stack[j].tag === tagName) { lastOpen = j; break }\n }\n if (lastOpen !== -1) {\n stack.splice(lastOpen, 1)\n }\n } else {\n // Opening tag\n stack.push({ tag: tagName, line: i + 1 + lineOffset })\n }\n }\n }\n\n for (const unclosed of stack) {\n issues.push({\n type: 'error',\n title: 'Unclosed tag',\n message: `<${unclosed.tag}> tag is not closed`,\n line: unclosed.line,\n })\n }\n\n // Sort: errors first, then warnings, then by line\n issues.sort((a, b) => {\n if (a.type !== b.type) return a.type === 'error' ? -1 : 1\n return (a.line ?? 0) - (b.line ?? 0)\n })\n\n return issues\n}\n"],"mappings":";;;;AAUA,SAAgB,UAAU,KAAa,KAAU;CAC/C,MAAM,WAAW,IAAI,QAAQ,oBAAoB,GAAG,CAAC,QAAQ,SAAS,GAAG;AAEzE,KAAI;EACF,MAAM,SAAS,aAAa,QAAQ,SAAS,EAAE,QAAQ;EAGvD,MAAM,gBAAgB,OAAO,MAAM,yCAAyC;EAQ5E,MAAM,SAAS,SAPF,gBAAgB,cAAc,KAAK,QAGzB,gBACnB,OAAO,MAAM,GAAG,OAAO,QAAQ,cAAc,GAAG,GAAG,cAAc,GAAG,QAAQ,cAAc,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,SAAS,IACpH,EAEyC;AAE7C,MAAI,UAAU,gBAAgB,mBAAmB;AACjD,MAAI,IAAI,KAAK,UAAU,OAAO,CAAC;UACxB,OAAY;AACnB,MAAI,aAAa;AACjB,MAAI,IAAI,KAAK,UAAU,EAAE,OAAO,MAAM,SAAS,CAAC,CAAC;;;AAIrD,SAAS,OAAO,MAAc,QAAgB,YAA4B;AACxE,QAAO,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,CAAC,SAAS;;AAGpD,SAAS,SAAS,M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AE;GACpB,MAAM,UAAU,EAAE,GAAG,aAAa;AAElC,OAAI,CAAC,YAAY,IAAI,QAAQ,IAAI,aAAa,IAAI,QAAQ,CAAE;AAC5D,OAAI,UAAU,SAAS,KAAK,CAAE;AAE9B,OAAI,UAAU,WAAW,KAAK,EAAE;IAE9B,IAAI,WAAW;AACf,SAAK,IAAI,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,IACrC,KAAI,MAAM,GAAG,QAAQ,SAAS;AAAE,gBAAW;AAAG;;AAEhD,QAAI,aAAa,GACf,OAAM,OAAO,UAAU,EAAE;SAI3B,OAAM,KAAK;IAAE,KAAK;IAAS,MAAM,IAAI,IAAI;IAAY,CAAC;;;AAK5D,MAAK,MAAM,YAAY,MACrB,QAAO,KAAK;EACV,MAAM;EACN,OAAO;EACP,SAAS,IAAI,SAAS,IAAI;EAC1B,MAAM,SAAS;EAChB,CAAC;AAIJ,QAAO,MAAM,GAAG,MAAM;AACpB,MAAI,EAAE,SAAS,EAAE,KAAM,QAAO,EAAE,SAAS,UAAU,KAAK;AACxD,UAAQ,EAAE,QAAQ,MAAM,EAAE,QAAQ;GAClC;AAEF,QAAO"}
1
+ {"version":3,"file":"linter.mjs","names":[],"sources":["../../src/server/linter.ts"],"sourcesContent":["import { readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { parseSfcBlocks, findComponentTags, buildComponentMap } from './sfc-utils.ts'\nimport type { MaizzleConfig } from '../types/index.ts'\n\nexport interface LintIssue {\n type: 'error' | 'warning'\n title: string\n message: string\n /** Which tab this lands in when merged into the Checks panel. */\n category: 'css' | 'html' | 'image' | 'others'\n /** Optional caniemail slug for URL enrichment (e.g. \"html-html\"). */\n slug?: string\n line?: number\n file: string\n}\n\ninterface Presence {\n html: boolean\n head: boolean\n body: boolean\n}\n\n/**\n * Maizzle auto-adds role=\"none\" to every <table> by default via the\n * addAttributes transformer. Warn about missing role only when that won't\n * happen:\n * - useTransformers: false → whole pipeline off\n * - html.attributes.add: false → auto-add disabled globally\n * - add.table: false → table selector opted out\n * - add.table.role: false → role attribute specifically opted out\n * An empty `add.table: {}` still inherits role via defu merge, so it's fine.\n */\nfunction tableRoleAutoAdded(config: MaizzleConfig): boolean {\n if (config.useTransformers === false) return false\n const add = config.html?.attributes?.add\n if (add === false) return false\n if (!add || typeof add !== 'object') return true\n const table = (add as any).table\n if (table === false) return false\n if (table && typeof table === 'object' && table.role === false) return false\n return true\n}\n\nexport async function scanLint(\n rootFile: string,\n config: MaizzleConfig,\n componentDirs: string[],\n): Promise<LintIssue[]> {\n const root = config.root ?? process.cwd()\n const componentMap = await buildComponentMap(root, componentDirs)\n const visited = new Set<string>()\n const presence: Presence = { html: false, head: false, body: false }\n const checkTableRole = !tableRoleAutoAdded(config)\n const issues = checkFile(rootFile, componentMap, visited, presence, checkTableRole)\n\n if (!presence.html) issues.push({ type: 'warning', category: 'html', title: 'Missing <html>', message: 'Root <html> tag not found in the template or any of its components.', slug: 'html-html', line: 1, file: rootFile })\n if (!presence.head) issues.push({ type: 'warning', category: 'html', title: 'Missing <head>', message: 'Root <head> tag not found in the template or any of its components.', slug: 'html-head', line: 1, file: rootFile })\n if (!presence.body) issues.push({ type: 'warning', category: 'html', title: 'Missing <body>', message: 'Root <body> tag not found in the template or any of its components.', slug: 'html-body', line: 1, file: rootFile })\n\n return issues\n}\n\nexport async function serveLint(url: string, res: any, config: MaizzleConfig, componentDirs: string[]) {\n const filePath = url.replace('/__maizzle/lint/', '').replace(/\\?.*$/, '')\n\n try {\n const absolutePath = resolve(filePath)\n const issues = await scanLint(absolutePath, config, componentDirs)\n\n // Sort: errors first, then warnings, then by line\n issues.sort((a, b) => {\n if (a.type !== b.type) return a.type === 'error' ? -1 : 1\n return (a.line ?? 0) - (b.line ?? 0)\n })\n\n res.setHeader('Content-Type', 'application/json')\n res.end(JSON.stringify(issues))\n } catch (error: any) {\n res.statusCode = 500\n res.end(JSON.stringify({ error: error.message }))\n }\n}\n\nfunction checkFile(\n filePath: string,\n componentMap: Map<string, string>,\n visited: Set<string>,\n presence: Presence,\n checkTableRole: boolean,\n): LintIssue[] {\n if (visited.has(filePath)) return []\n visited.add(filePath)\n\n let source: string\n try {\n source = readFileSync(filePath, 'utf-8')\n } catch {\n return []\n }\n\n const { template } = parseSfcBlocks(source)\n const issues: LintIssue[] = []\n\n if (template) {\n issues.push(...lintHtml(template.content, template.offset, filePath, presence, checkTableRole))\n\n // Recurse into components\n const componentTags = findComponentTags(template.content)\n for (const tag of componentTags) {\n const componentPath = componentMap.get(tag.toLowerCase())\n if (componentPath) {\n issues.push(...checkFile(componentPath, componentMap, visited, presence, checkTableRole))\n }\n }\n }\n\n return issues\n}\n\nfunction lineAt(html: string, offset: number, lineOffset: number): number {\n return html.slice(0, offset).split('\\n').length + lineOffset\n}\n\n/**\n * True if the <img> tag has a width defined via any of:\n * - `width` attribute\n * - inline `style` with a `width` property\n * - class attribute with a Tailwind `w-` utility (any variant prefix like\n * sm:, hover:), or an arbitrary `[width:…]` utility\n */\nfunction hasWidthDefined(imgTag: string): boolean {\n if (/\\bwidth\\s*=/i.test(imgTag)) return true\n\n const styleMatch = imgTag.match(/\\bstyle\\s*=\\s*[\"']([^\"']*)[\"']/i)\n if (styleMatch && /(^|[;\\s])width\\s*:/i.test(styleMatch[1])) return true\n\n const classMatch = imgTag.match(/\\bclass\\s*=\\s*[\"']([^\"']*)[\"']/i)\n if (classMatch) {\n const classes = classMatch[1]\n if (/(?:^|\\s)(?:[a-z0-9-]+:)*w-\\S+/i.test(classes)) return true\n if (/\\[width:/i.test(classes)) return true\n }\n return false\n}\n\nfunction lintHtml(html: string, lineOffset: number, filePath: string, presence: Presence, checkTableRole: boolean): LintIssue[] {\n const issues: LintIssue[] = []\n\n // Match all tags (multiline) — [^>] doesn't cross > so use [\\s\\S] with lazy quantifier\n const tagRe = /<([a-zA-Z][a-zA-Z0-9]*)\\b([\\s\\S]*?)>/g\n\n for (const m of Array.from(html.matchAll(tagRe))) {\n const tag = m[0]\n const tagName = m[1].toLowerCase()\n const line = lineAt(html, m.index!, lineOffset)\n\n if (tagName === 'html') presence.html = true\n else if (tagName === 'head') presence.head = true\n else if (tagName === 'body') presence.body = true\n\n // Layout tables — accessibility requires role=\"none\" so screen readers\n // skip the table structure. Only surface the warning when the user has\n // disabled Maizzle's auto-role-add; otherwise every build-step output\n // already has role=\"none\" set.\n if (checkTableRole && tagName === 'table') {\n const roleMatch = tag.match(/\\brole\\s*=\\s*[\"']([^\"']*)[\"']/i)\n if (!roleMatch) {\n const tableEndIdx = html.indexOf('</table>', m.index!)\n const inner = tableEndIdx >= 0 ? html.slice(m.index!, tableEndIdx) : ''\n const isDataTable = /<th\\b/i.test(inner) || /<caption\\b/i.test(inner)\n if (!isDataTable) {\n issues.push({ type: 'warning', category: 'html', title: 'Layout table missing role', message: 'Add role=\"none\" so screen readers skip this layout table.', slug: 'html-role', line, file: filePath })\n }\n }\n }\n\n // Images\n if (tagName === 'img') {\n if (!/\\balt\\s*=/i.test(tag)) {\n issues.push({ type: 'warning', category: 'image', title: 'Missing alt text', message: 'Image is missing the alt attribute', line, file: filePath })\n }\n\n const srcMatch = tag.match(/\\bsrc\\s*=\\s*[\"']([^\"']*)[\"']/i)\n if (!srcMatch) {\n issues.push({ type: 'error', category: 'image', title: 'Missing image src', message: 'Image tag has no src attribute', line, file: filePath })\n } else if (!srcMatch[1].trim()) {\n issues.push({ type: 'error', category: 'image', title: 'Empty image src', message: 'Image src attribute is empty', line, file: filePath })\n } else if (srcMatch[1].trim().startsWith('http:')) {\n issues.push({ type: 'warning', category: 'image', title: 'Insecure image src', message: 'Image loads over HTTP instead of HTTPS', line, file: filePath })\n }\n\n if (!hasWidthDefined(tag)) {\n issues.push({ type: 'warning', category: 'image', title: 'Missing image width', message: 'Use a `width=\"\"` attribute for best results in Outlook', line, file: filePath })\n }\n }\n\n // Any tag with href — skip resource tags handled below\n if (!['link', 'script', 'source'].includes(tagName)) {\n const hrefMatch = tag.match(/\\bhref\\s*=\\s*[\"']([^\"']*)[\"']/i)\n if (hrefMatch) {\n const href = hrefMatch[1].trim()\n if (!href) {\n issues.push({ type: 'error', category: 'html', title: 'Empty link href', message: 'Link href attribute is empty', line, file: filePath })\n } else if (href === '#' || href === '/') {\n issues.push({ type: 'error', category: 'html', title: 'Placeholder link', message: `Link href is \"${href}\"`, line, file: filePath })\n } else if (href.startsWith('http:')) {\n issues.push({ type: 'warning', category: 'html', title: 'Insecure link', message: 'Link uses HTTP instead of HTTPS', line, file: filePath })\n } else if (href.startsWith('http') && !/^https?:\\/\\/.+\\..+/i.test(href)) {\n issues.push({ type: 'error', category: 'html', title: 'Invalid link', message: `Link href \"${href}\" looks malformed`, line, file: filePath })\n }\n }\n }\n\n // Insecure resources (<link>, <script>, <source>)\n if (['link', 'script', 'source'].includes(tagName)) {\n const attrMatch = tag.match(/\\b(?:href|src)\\s*=\\s*[\"']([^\"']*)[\"']/i)\n if (attrMatch && attrMatch[1].trim().startsWith('http:')) {\n issues.push({ type: 'warning', category: 'html', title: 'Insecure resource', message: 'Resource loads over HTTP instead of HTTPS', line, file: filePath })\n }\n }\n }\n\n // Insecure CSS url() references\n for (const m of Array.from(html.matchAll(/url\\s*\\(\\s*[\"']?(http:[^\"')]+)[\"']?\\s*\\)/gi))) {\n issues.push({ type: 'warning', category: 'css', title: 'Insecure CSS url()', message: 'CSS url() loads over HTTP instead of HTTPS', line: lineAt(html, m.index!, lineOffset), file: filePath })\n }\n\n // Check for unclosed tags (block-level and common inline elements)\n const voidElements = new Set([\n 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',\n 'link', 'meta', 'param', 'source', 'track', 'wbr',\n ])\n\n const trackedTags = new Set([\n 'a', 'b', 'body', 'div', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',\n 'head', 'html', 'i', 'li', 'ol', 'p', 'span', 'strong', 'style',\n 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'title', 'tr', 'u', 'ul',\n ])\n\n const stack: Array<{ tag: string, line: number }> = []\n\n // Strip comments and content inside <style>/<script> to avoid false matches\n const stripped = html\n .replace(/<!--[\\s\\S]*?-->/g, (m) => '\\n'.repeat((m.match(/\\n/g) || []).length))\n .replace(/<(style|script)\\b[^>]*>[\\s\\S]*?<\\/\\1>/gi, (m) => '\\n'.repeat((m.match(/\\n/g) || []).length))\n\n const strippedLines = stripped.split('\\n')\n\n for (let i = 0; i < strippedLines.length; i++) {\n const line = strippedLines[i]\n const tagRegex = /<\\/?([a-zA-Z][a-zA-Z0-9]*)\\b[^>]*\\/?>/g\n let m\n\n while ((m = tagRegex.exec(line)) !== null) {\n const fullMatch = m[0]\n const tagName = m[1].toLowerCase()\n\n if (!trackedTags.has(tagName) || voidElements.has(tagName)) continue\n if (fullMatch.endsWith('/>')) continue\n\n if (fullMatch.startsWith('</')) {\n // Closing tag\n let lastOpen = -1\n for (let j = stack.length - 1; j >= 0; j--) {\n if (stack[j].tag === tagName) { lastOpen = j; break }\n }\n if (lastOpen !== -1) {\n stack.splice(lastOpen, 1)\n }\n } else {\n // Opening tag\n stack.push({ tag: tagName, line: i + 1 + lineOffset })\n }\n }\n }\n\n for (const unclosed of stack) {\n issues.push({\n type: 'error',\n category: 'html',\n title: 'Unclosed tag',\n message: `<${unclosed.tag}> tag is not closed`,\n line: unclosed.line,\n file: filePath,\n })\n }\n\n return issues\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,SAAS,mBAAmB,QAAgC;AAC1D,KAAI,OAAO,oBAAoB,MAAO,QAAO;CAC7C,MAAM,MAAM,OAAO,MAAM,YAAY;AACrC,KAAI,QAAQ,MAAO,QAAO;AAC1B,KAAI,CAAC,OAAO,OAAO,QAAQ,SAAU,QAAO;CAC5C,MAAM,QAAS,IAAY;AAC3B,KAAI,UAAU,MAAO,QAAO;AAC5B,KAAI,SAAS,OAAO,UAAU,YAAY,MAAM,SAAS,MAAO,QAAO;AACvE,QAAO;;AAGT,eAAsB,SACpB,UACA,QACA,eACsB;CAEtB,MAAM,eAAe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,SAAS,IAAI;EAC1B,MAAM,SAAS;EACf,MAAM;EACP,CAAC;AAGJ,QAAO"}
@@ -0,0 +1,18 @@
1
+ //#region src/server/sfc-utils.d.ts
2
+ interface SfcBlock {
3
+ content: string;
4
+ offset: number;
5
+ }
6
+ declare function parseSfcBlocks(source: string): {
7
+ template: SfcBlock | null;
8
+ styles: SfcBlock[];
9
+ };
10
+ /**
11
+ * Standard HTML elements — anything not in this set is treated as a component.
12
+ */
13
+ declare const HTML_ELEMENTS: Set<string>;
14
+ declare function findComponentTags(templateContent: string): string[];
15
+ declare function buildComponentMap(root: string, componentDirs: string[]): Promise<Map<string, string>>;
16
+ //#endregion
17
+ export { HTML_ELEMENTS, SfcBlock, buildComponentMap, findComponentTags, parseSfcBlocks };
18
+ //# sourceMappingURL=sfc-utils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sfc-utils.d.mts","names":[],"sources":["../../src/server/sfc-utils.ts"],"mappings":";UAOiB,QAAA;EACf,OAAA;EACA,MAAA;AAAA;AAAA,iBAGc,cAAA,CAAe,MAAA;EAAmB,QAAA,EAAU,QAAA;EAAiB,MAAA,EAAQ,QAAA;AAAA;;;;cA4BxE,aAAA,EAAa,GAAA;AAAA,iBAgBV,iBAAA,CAAkB,eAAA;AAAA,iBAqBZ,iBAAA,CAAkB,IAAA,UAAc,aAAA,aAA0B,OAAA,CAAQ,GAAA"}