why-hydration 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +394 -0
  3. package/dist/chunk-EPJM3LH3.cjs +717 -0
  4. package/dist/chunk-EPJM3LH3.cjs.map +1 -0
  5. package/dist/chunk-FV3PEJQE.js +42 -0
  6. package/dist/chunk-FV3PEJQE.js.map +1 -0
  7. package/dist/chunk-HYG6GVWO.js +16 -0
  8. package/dist/chunk-HYG6GVWO.js.map +1 -0
  9. package/dist/chunk-LNVWRW65.js +700 -0
  10. package/dist/chunk-LNVWRW65.js.map +1 -0
  11. package/dist/chunk-OGQEPU7G.cjs +49 -0
  12. package/dist/chunk-OGQEPU7G.cjs.map +1 -0
  13. package/dist/chunk-PVXOK7GJ.js +418 -0
  14. package/dist/chunk-PVXOK7GJ.js.map +1 -0
  15. package/dist/chunk-QGAEURQY.cjs +38 -0
  16. package/dist/chunk-QGAEURQY.cjs.map +1 -0
  17. package/dist/chunk-R6344ZUK.cjs +441 -0
  18. package/dist/chunk-R6344ZUK.cjs.map +1 -0
  19. package/dist/index.cjs +97 -0
  20. package/dist/index.cjs.map +1 -0
  21. package/dist/index.d.cts +65 -0
  22. package/dist/index.d.ts +65 -0
  23. package/dist/index.js +4 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/next/index.cjs +23 -0
  26. package/dist/next/index.cjs.map +1 -0
  27. package/dist/next/index.d.cts +4 -0
  28. package/dist/next/index.d.ts +4 -0
  29. package/dist/next/index.js +6 -0
  30. package/dist/next/index.js.map +1 -0
  31. package/dist/next/script.cjs +13 -0
  32. package/dist/next/script.cjs.map +1 -0
  33. package/dist/next/script.d.cts +9 -0
  34. package/dist/next/script.d.ts +9 -0
  35. package/dist/next/script.js +4 -0
  36. package/dist/next/script.js.map +1 -0
  37. package/dist/react.cjs +18 -0
  38. package/dist/react.cjs.map +1 -0
  39. package/dist/react.d.cts +38 -0
  40. package/dist/react.d.ts +38 -0
  41. package/dist/react.js +5 -0
  42. package/dist/react.js.map +1 -0
  43. package/dist/types-DTlltJb9.d.cts +53 -0
  44. package/dist/types-DTlltJb9.d.ts +53 -0
  45. package/package.json +134 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/react/console.ts","../src/react/overlay.ts","../src/react/controller.ts","../src/react/inspector.tsx","../src/react/index.tsx"],"names":["React"],"mappings":";;;;;AAMO,SAAS,0BACd,SAAA,EACY;AACZ,EAAA,IAAI,OAAO,OAAA,KAAY,WAAA,EAAa,OAAO,MAAM;AAAA,EAAC,CAAA;AAClD,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,KAAA,CAAM,IAAA,CAAK,OAAO,CAAA;AAC3C,EAAA,MAAM,OAAA,GAAmB,IAAI,IAAA,KAAoB;AAC/C,IAAA,IAAI;AACF,MAAA,MAAM,OAAA,GAAU,kBAAkB,IAAI,CAAA;AACtC,MAAA,IAAI,OAAA,IAAW,kBAAA,CAAmB,OAAO,CAAA,EAAG;AAC1C,QAAA,SAAA,CAAU,SAAS,IAAI,CAAA;AAAA,MACzB;AAAA,IACF,CAAA,CAAA,MAAQ;AAAA,IAER;AACA,IAAA,QAAA,CAAS,GAAG,IAAI,CAAA;AAAA,EAClB,CAAA;AACA,EAAA,OAAA,CAAQ,KAAA,GAAQ,OAAA;AAEhB,EAAA,OAAO,MAAM;AACX,IAAA,IAAI,OAAA,CAAQ,UAAW,OAAA,EAAkC;AACvD,MAAA,OAAA,CAAQ,KAAA,GAAQ,QAAA;AAAA,IAClB;AAAA,EACF,CAAA;AACF;AAEA,IAAM,KAAA,GAAQ,gCAAA;AACd,IAAM,GAAA,GAAM,eAAA;AAEL,SAAS,qBAAA,GAAoC;AAClD,EAAA,MAAM,IAAA,GAAmB,CAAC,MAAA,KAA4B;AACpD,IAAA,MAAM,KAAA,GAAQ,4BAAuB,MAAA,CAAO,KAAA,CAAM,QAAQ,CAAA,QAAA,EAAM,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AA,OAAaA,MAAA,CAAA,aAAA,CAAoBA,MAAA,CAAA,QAAA,EAAU,IAAA,EAAM,QAAQ,CAAA;AAC3D;;;ACjCA,SAAS,YAAY,KAAA,EAEE;AACrB,EAAA,OAAa,MAAA,CAAA,aAAA,CAAoB,MAAA,CAAA,QAAA,EAAU,IAAA,EAAM,KAAA,CAAM,QAAQ,CAAA;AACjE;AAIO,IAAM,kBAAA,GAGX,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,eAAe,aAAA,GAAgB;AAUnD,SAAS,wBAAA,CACd,OAAA,GAA4B,EAAC,EACH;AAC1B,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,EAAc;AACzC,IAAA,OAAO;AAAA,MACL,oBAAoB,MAAM;AAAA,MAAC,CAAA;AAAA,MAC3B,QAAA,EAAU;AAAA,KACZ;AAAA,EACF;AAEA,EAAA,MAAM,UAAA,GAAa,IAAI,mBAAA,CAAoB,OAAO,CAAA;AAClD,EAAA,UAAA,CAAW,KAAA,EAAM;AAEjB,EAAA,SAAS,SAAS,KAAA,EAEK;AACrB,IAAM,iBAAU,MAAM,MAAM,WAAW,IAAA,EAAK,EAAG,EAAE,CAAA;AACjD,IAAA,OAAa,MAAA,CAAA,aAAA,CAAoB,MAAA,CAAA,QAAA,EAAU,IAAA,EAAM,KAAA,CAAM,QAAQ,CAAA;AAAA,EACjE;AAEA,EAAA,OAAO;AAAA,IACL,oBAAoB,UAAA,CAAW,kBAAA;AAAA,IAC/B;AAAA,GACF;AACF","file":"chunk-PVXOK7GJ.js","sourcesContent":["import { formatConsoleArgs, isHydrationMessage } from '../core/react-message';\nimport type { HydrationReport } from '../core/types';\nimport type { ReportSink } from '../core/report';\n\ntype ErrorFn = (...args: unknown[]) => void;\n\nexport function installConsoleInterceptor(\n onMessage: (message: string, args: readonly unknown[]) => void,\n): () => void {\n if (typeof console === 'undefined') return () => {};\n const original = console.error.bind(console) as ErrorFn;\n const patched: ErrorFn = (...args: unknown[]) => {\n try {\n const message = formatConsoleArgs(args);\n if (message && isHydrationMessage(message)) {\n onMessage(message, args);\n }\n } catch {\n /* never let interception break normal logging */\n }\n original(...args);\n };\n console.error = patched as typeof console.error;\n\n return () => {\n if (console.error === (patched as typeof console.error)) {\n console.error = original as typeof console.error;\n }\n };\n}\n\nconst BADGE = 'color:#f59e0b;font-weight:bold';\nconst DIM = 'color:#9ca3af';\n\nexport function createConsoleReporter(): ReportSink {\n const sink: ReportSink = (report: HydrationReport) => {\n const title = `%c⬡ why-hydration%c ${report.cause.category} — ${report.node.path}`;\n console.group(title, BADGE, DIM);\n console.log('%cServer:%c', 'color:#fb7185', '', report.server ?? '(none)');\n console.log('%cClient:%c', 'color:#4ade80', '', report.client ?? '(none)');\n if (report.component) {\n console.log('%cComponent:%c', DIM, '', report.component);\n }\n console.log('%cWhy:%c', DIM, '', report.cause.explanation);\n console.log('%cFix:%c', 'color:#86efac', '', report.cause.suggestion);\n if (report.cause.docsUrl) {\n console.log('%cDocs:%c', DIM, '', report.cause.docsUrl);\n }\n if (report.componentStack) {\n console.log('%cComponent stack:%c', DIM, '', report.componentStack);\n }\n console.groupEnd();\n };\n return sink;\n}\n","import type { HydrationReport } from '../core/types';\n\nexport interface OverlayOptions {\n position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';\n}\n\nexport interface OverlayHandle {\n push: (report: HydrationReport) => void;\n destroy: () => void;\n}\n\nconst CONTAINER_ID = 'why-hydration-overlay';\n\nconst CATEGORY_LABELS: Record<string, string> = {\n 'non-deterministic-value': 'Non-deterministic value',\n 'date-time': 'Date / time',\n 'locale-format': 'Locale formatting',\n 'browser-only-api': 'Browser-only API',\n 'viewport-branching': 'Viewport branching',\n 'invalid-html-nesting': 'Invalid HTML nesting',\n 'whitespace-minification': 'Whitespace / minification',\n 'third-party-dom-mutation': 'Third-party DOM mutation',\n unknown: 'Unknown',\n};\n\nconst STYLES = `\n:host { all: initial; }\n* { box-sizing: border-box; }\n.wh-panel {\n position: fixed;\n z-index: 2147483647;\n width: min(420px, calc(100vw - 32px));\n max-height: min(70vh, 640px);\n display: flex;\n flex-direction: column;\n font: 13px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;\n color: #e5e7eb;\n background: #0b0f17;\n border: 1px solid #1f2937;\n border-radius: 12px;\n box-shadow: 0 12px 40px rgba(0,0,0,.5);\n overflow: hidden;\n}\n.wh-bottom-right { bottom: 16px; right: 16px; }\n.wh-bottom-left { bottom: 16px; left: 16px; }\n.wh-top-right { top: 16px; right: 16px; }\n.wh-top-left { top: 16px; left: 16px; }\n.wh-header {\n display: flex; align-items: center; gap: 8px;\n padding: 10px 12px;\n background: linear-gradient(180deg, #151b26, #0d1220);\n border-bottom: 1px solid #1f2937;\n}\n.wh-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; flex: none; }\n.wh-title { font-weight: 600; color: #f3f4f6; }\n.wh-count {\n margin-left: auto; font-size: 11px; color: #9ca3af;\n background: #111827; border: 1px solid #1f2937; border-radius: 999px;\n padding: 1px 8px;\n}\n.wh-btn {\n appearance: none; border: 1px solid #1f2937; background: #111827;\n color: #9ca3af; border-radius: 6px; cursor: pointer;\n font-size: 12px; padding: 3px 8px;\n}\n.wh-btn:hover { color: #f3f4f6; border-color: #374151; }\n.wh-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }\n.wh-card { border: 1px solid #1f2937; border-radius: 10px; background: #0f1521; overflow: hidden; }\n.wh-card-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }\n.wh-cat {\n font-weight: 600; color: #fbbf24; font-size: 12px;\n}\n.wh-conf { margin-left: auto; font-size: 11px; color: #6b7280; }\n.wh-body { padding: 0 10px 10px; }\n.wh-where { font-size: 11px; color: #9ca3af; word-break: break-all; margin-bottom: 8px; }\n.wh-where code { color: #93c5fd; }\n.wh-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }\n.wh-side { border-radius: 8px; padding: 6px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-word; }\n.wh-server { background: rgba(244,63,94,.08); border: 1px solid rgba(244,63,94,.35); }\n.wh-client { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.35); }\n.wh-side .wh-label { display: block; font-family: inherit; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }\n.wh-server .wh-label { color: #fb7185; }\n.wh-client .wh-label { color: #4ade80; }\n.wh-explain { color: #cbd5e1; margin-bottom: 8px; }\n.wh-fix { color: #e5e7eb; background: #111827; border-left: 3px solid #22c55e; border-radius: 4px; padding: 6px 8px; }\n.wh-fix strong { color: #86efac; }\n.wh-docs { display: inline-block; margin-top: 6px; color: #60a5fa; text-decoration: none; font-size: 11px; }\n.wh-docs:hover { text-decoration: underline; }\n.wh-empty-value { color: #6b7280; font-style: italic; }\n@media (max-width: 420px) {\n .wh-panel { width: auto; max-height: min(80vh, 640px); }\n .wh-bottom-right, .wh-bottom-left { left: 8px; right: 8px; }\n .wh-top-right, .wh-top-left { left: 8px; right: 8px; }\n .wh-diff { grid-template-columns: 1fr; }\n}\n`;\n\nfunction el<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className?: string,\n text?: string,\n): HTMLElementTagNameMap[K] {\n const node = document.createElement(tag);\n if (className) node.className = className;\n if (text != null) node.textContent = text;\n return node;\n}\n\nfunction renderValue(value: string | null): HTMLElement {\n if (value == null || value === '') {\n return el('span', 'wh-empty-value', value === '' ? '(empty)' : '(none)');\n }\n const span = document.createElement('span');\n span.textContent = value;\n return span;\n}\n\nfunction renderCard(report: HydrationReport): HTMLElement {\n const card = el('div', 'wh-card');\n\n const head = el('div', 'wh-card-head');\n head.appendChild(\n el('span', 'wh-cat', CATEGORY_LABELS[report.cause.category] ?? 'Mismatch'),\n );\n head.appendChild(\n el('span', 'wh-conf', `${Math.round(report.cause.confidence * 100)}%`),\n );\n card.appendChild(head);\n\n const body = el('div', 'wh-body');\n\n const where = el('div', 'wh-where');\n const label = report.component\n ? `${report.component} · `\n : report.node.tagName\n ? `<${report.node.tagName.toLowerCase()}> · `\n : '';\n where.append(label);\n const code = el('code');\n code.textContent = report.node.path;\n where.appendChild(code);\n if (report.node.attribute) {\n where.append(` · @${report.node.attribute}`);\n }\n body.appendChild(where);\n\n const diff = el('div', 'wh-diff');\n const server = el('div', 'wh-side wh-server');\n server.appendChild(el('span', 'wh-label', 'Server'));\n server.appendChild(renderValue(report.server));\n const client = el('div', 'wh-side wh-client');\n client.appendChild(el('span', 'wh-label', 'Client'));\n client.appendChild(renderValue(report.client));\n diff.appendChild(server);\n diff.appendChild(client);\n body.appendChild(diff);\n\n body.appendChild(el('div', 'wh-explain', report.cause.explanation));\n\n const fix = el('div', 'wh-fix');\n const strong = el('strong');\n strong.textContent = 'Fix: ';\n fix.appendChild(strong);\n fix.append(report.cause.suggestion);\n body.appendChild(fix);\n\n if (report.cause.docsUrl && /^https?:\\/\\//i.test(report.cause.docsUrl)) {\n const a = el('a', 'wh-docs', 'Learn more →');\n a.href = report.cause.docsUrl;\n a.target = '_blank';\n a.rel = 'noreferrer noopener';\n body.appendChild(a);\n }\n\n card.appendChild(body);\n return card;\n}\n\nexport function createOverlay(options: OverlayOptions = {}): OverlayHandle {\n const position = options.position ?? 'bottom-right';\n let host: HTMLElement | null = null;\n let listEl: HTMLElement | null = null;\n let countEl: HTMLElement | null = null;\n let count = 0;\n\n function ensureMounted(): void {\n if (host) return;\n document.getElementById(CONTAINER_ID)?.remove();\n host = document.createElement('div');\n host.id = CONTAINER_ID;\n host.setAttribute('data-why-hydration', 'overlay');\n host.setAttribute('aria-hidden', 'false');\n const shadow = host.attachShadow({ mode: 'open' });\n\n const style = document.createElement('style');\n style.textContent = STYLES;\n shadow.appendChild(style);\n\n const panel = el('div', `wh-panel wh-${position}`);\n panel.setAttribute('role', 'dialog');\n panel.setAttribute('aria-label', 'Hydration mismatch diagnostics');\n\n const header = el('div', 'wh-header');\n header.appendChild(el('span', 'wh-dot'));\n header.appendChild(el('span', 'wh-title', 'Hydration mismatch'));\n countEl = el('span', 'wh-count', '0');\n header.appendChild(countEl);\n const close = el('button', 'wh-btn', 'Dismiss');\n close.setAttribute('aria-label', 'Dismiss diagnostics overlay');\n close.addEventListener('click', () => destroy());\n header.appendChild(close);\n panel.appendChild(header);\n\n listEl = el('div', 'wh-list');\n panel.appendChild(listEl);\n\n shadow.appendChild(panel);\n document.body.appendChild(host);\n\n host.addEventListener('keydown', (e) => {\n if ((e as KeyboardEvent).key === 'Escape') destroy();\n });\n }\n\n function destroy(): void {\n host?.remove();\n host = null;\n listEl = null;\n countEl = null;\n }\n\n function push(report: HydrationReport): void {\n ensureMounted();\n count += 1;\n if (countEl) countEl.textContent = String(count);\n listEl?.appendChild(renderCard(report));\n }\n\n return { push, destroy };\n}\n","import { inspectRoot, reportFromMessage } from '../core/inspect';\nimport { ReportCollector } from '../core/report';\nimport { DEFAULT_SNAPSHOT_SELECTORS, readSnapshot } from '../core/snapshot';\nimport { isDev } from '../core/env';\nimport type {\n Classifier,\n DetectionContext,\n Divergence,\n HydrationReport,\n} from '../core/types';\nimport { createConsoleReporter, installConsoleInterceptor } from './console';\nimport { createOverlay, type OverlayOptions } from './overlay';\n\nexport interface InspectorOptions {\n overlay?: boolean | OverlayOptions;\n onReport?: (report: HydrationReport) => void;\n ignore?: Array<string | ((node: Element) => boolean)>;\n classify?: Classifier[];\n maxReports?: number;\n roots?: string[];\n}\n\nfunction buildIgnore(\n ignore: InspectorOptions['ignore'],\n): ((d: Divergence) => boolean) | undefined {\n if (!ignore || ignore.length === 0) return undefined;\n return (divergence: Divergence): boolean => {\n const node = divergence.element ?? null;\n for (const rule of ignore) {\n if (typeof rule === 'function') {\n if (node && rule(node)) return true;\n } else if (node) {\n try {\n if (node.matches(rule) || node.closest(rule)) return true;\n } catch {\n /* invalid selector */\n }\n }\n }\n return false;\n };\n}\n\nexport class InspectorController {\n private readonly collector: ReportCollector;\n private readonly options: InspectorOptions;\n private readonly cleanups: Array<() => void> = [];\n private started = false;\n private pendingContext: DetectionContext = {};\n private messageReported = false;\n\n constructor(options: InspectorOptions = {}) {\n this.options = options;\n this.collector = new ReportCollector({\n maxReports: options.maxReports,\n extra: options.classify,\n ignore: buildIgnore(options.ignore),\n });\n }\n\n start(): void {\n if (this.started || !isDev || typeof window === 'undefined') return;\n this.started = true;\n this.pendingContext = {};\n this.messageReported = false;\n\n if (this.options.onReport) {\n this.collector.addSink(this.options.onReport);\n }\n this.collector.addSink(createConsoleReporter());\n if (this.options.overlay !== false) {\n const overlayOpts: OverlayOptions =\n typeof this.options.overlay === 'object' ? this.options.overlay : {};\n const handle = createOverlay(overlayOpts);\n this.collector.addSink(handle.push);\n this.cleanups.push(() => handle.destroy());\n }\n\n const restore = installConsoleInterceptor((message) => {\n this.mergeContext({ reactMessage: message });\n this.scheduleInspect();\n });\n this.cleanups.push(restore);\n\n this.scheduleInspect();\n }\n\n onRecoverableError = (\n error: unknown,\n info?: { componentStack?: string },\n ): void => {\n if (!isDev) return;\n this.mergeContext({\n componentStack: info?.componentStack,\n component: firstComponentFromStack(info?.componentStack),\n reactMessage: error instanceof Error ? error.message : String(error),\n });\n this.scheduleInspect();\n };\n\n private mergeContext(ctx: DetectionContext): void {\n this.pendingContext = {\n componentStack: this.pendingContext.componentStack ?? ctx.componentStack,\n component: this.pendingContext.component ?? ctx.component,\n location: this.pendingContext.location ?? ctx.location,\n reactMessage: this.pendingContext.reactMessage ?? ctx.reactMessage,\n };\n }\n\n stop(): void {\n for (const cleanup of this.cleanups.splice(0)) cleanup();\n this.started = false;\n }\n\n getReports(): readonly HydrationReport[] {\n return this.collector.getReports();\n }\n\n inspectNow(context: DetectionContext = {}): void {\n this.mergeContext(context);\n this.inspectAllRoots();\n }\n\n private inspectAllRoots(): void {\n if (\n !this.started ||\n typeof document === 'undefined' ||\n this.collector.isFull\n ) {\n return;\n }\n const selectors = this.options.roots ?? snapshotSelectors();\n const seen = new Set<Element>();\n for (const selector of selectors) {\n const root = document.querySelector(selector);\n if (!root || seen.has(root)) continue;\n seen.add(root);\n inspectRoot(root, this.collector, this.pendingContext);\n }\n\n if (\n this.collector.getReports().length === 0 &&\n this.pendingContext.reactMessage &&\n !this.messageReported\n ) {\n this.messageReported = true;\n reportFromMessage(\n this.pendingContext.reactMessage,\n this.collector,\n this.pendingContext,\n );\n }\n }\n\n private scheduleInspect(): void {\n const run = () => this.inspectAllRoots();\n if (typeof requestAnimationFrame === 'function') {\n requestAnimationFrame(run);\n } else {\n Promise.resolve().then(run);\n }\n }\n}\n\nfunction snapshotSelectors(): string[] {\n const snapshot = readSnapshot();\n const keys = snapshot ? Object.keys(snapshot.roots) : [];\n return keys.length > 0 ? keys : [...DEFAULT_SNAPSHOT_SELECTORS];\n}\n\nfunction firstComponentFromStack(stack?: string): string | undefined {\n if (!stack) return undefined;\n const match = /\\n?\\s*(?:at|in)\\s+([A-Za-z0-9_$]+)/.exec(stack);\n return match?.[1];\n}\n","import * as React from 'react';\nimport type { Classifier, HydrationReport } from '../core/types';\nimport { InspectorController } from './controller';\nimport type { OverlayOptions } from './overlay';\n\nexport interface HydrationInspectorProps {\n children: React.ReactNode;\n overlay?: boolean | OverlayOptions;\n onReport?: (report: HydrationReport) => void;\n ignore?: Array<string | ((node: Element) => boolean)>;\n classify?: Classifier[];\n maxReports?: number;\n}\n\nexport function InspectorImpl(\n props: HydrationInspectorProps,\n): React.ReactElement {\n const { children, overlay, onReport, ignore, classify, maxReports } = props;\n\n const controllerRef = React.useRef<InspectorController | null>(null);\n if (controllerRef.current === null) {\n controllerRef.current = new InspectorController({\n overlay,\n onReport,\n ignore,\n classify,\n maxReports,\n });\n controllerRef.current.start();\n }\n\n React.useEffect(() => {\n const controller = controllerRef.current;\n return () => controller?.stop();\n }, []);\n\n return React.createElement(React.Fragment, null, children);\n}\n","import * as React from 'react';\nimport { InspectorController, type InspectorOptions } from './controller';\nimport { InspectorImpl, type HydrationInspectorProps } from './inspector';\n\nfunction PassThrough(props: {\n children?: React.ReactNode;\n}): React.ReactElement {\n return React.createElement(React.Fragment, null, props.children);\n}\n\n// The process.env.NODE_ENV checks are inline (not hoisted to a variable) so\n// production bundlers fold them and tree-shake the dev-only implementation.\nexport const HydrationInspector: (\n props: HydrationInspectorProps,\n) => React.ReactElement =\n process.env.NODE_ENV !== 'production' ? InspectorImpl : PassThrough;\n\nexport interface HydrationInspectorHandle {\n onRecoverableError: (\n error: unknown,\n info?: { componentStack?: string },\n ) => void;\n Provider: (props: { children?: React.ReactNode }) => React.ReactElement;\n}\n\nexport function createHydrationInspector(\n options: InspectorOptions = {},\n): HydrationInspectorHandle {\n if (process.env.NODE_ENV === 'production') {\n return {\n onRecoverableError: () => {},\n Provider: PassThrough,\n };\n }\n\n const controller = new InspectorController(options);\n controller.start();\n\n function Provider(props: {\n children?: React.ReactNode;\n }): React.ReactElement {\n React.useEffect(() => () => controller.stop(), []);\n return React.createElement(React.Fragment, null, props.children);\n }\n\n return {\n onRecoverableError: controller.onRecoverableError,\n Provider,\n };\n}\n\nexport type { HydrationInspectorProps } from './inspector';\nexport type { InspectorOptions } from './controller';\nexport type { OverlayOptions } from './overlay';\nexport type {\n Cause,\n Classifier,\n DetectionContext,\n Divergence,\n HydrationCauseCategory,\n HydrationReport,\n} from '../core/types';\n"]}
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ var chunkOGQEPU7G_cjs = require('./chunk-OGQEPU7G.cjs');
4
+ var React = require('react');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
25
+
26
+ function HydrationSnapshotScript(props = {}) {
27
+ if (process.env.NODE_ENV === "production") return null;
28
+ const source = chunkOGQEPU7G_cjs.getSnapshotScriptSource(props.selectors);
29
+ return React__namespace.createElement("script", {
30
+ nonce: props.nonce,
31
+ suppressHydrationWarning: true,
32
+ dangerouslySetInnerHTML: { __html: source }
33
+ });
34
+ }
35
+
36
+ exports.HydrationSnapshotScript = HydrationSnapshotScript;
37
+ //# sourceMappingURL=chunk-QGAEURQY.cjs.map
38
+ //# sourceMappingURL=chunk-QGAEURQY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/next/script.tsx"],"names":["getSnapshotScriptSource","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQO,SAAS,uBAAA,CACd,KAAA,GAAsC,EAAC,EACZ;AAC3B,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,EAAc,OAAO,IAAA;AAClD,EAAA,MAAM,MAAA,GAASA,yCAAA,CAAwB,KAAA,CAAM,SAAS,CAAA;AACtD,EAAA,OAAaC,+BAAc,QAAA,EAAU;AAAA,IACnC,OAAO,KAAA,CAAM,KAAA;AAAA,IACb,wBAAA,EAA0B,IAAA;AAAA,IAC1B,uBAAA,EAAyB,EAAE,MAAA,EAAQ,MAAA;AAAO,GAC3C,CAAA;AACH","file":"chunk-QGAEURQY.cjs","sourcesContent":["import * as React from 'react';\nimport { getSnapshotScriptSource } from '../core/snapshot';\n\nexport interface HydrationSnapshotScriptProps {\n selectors?: string[];\n nonce?: string;\n}\n\nexport function HydrationSnapshotScript(\n props: HydrationSnapshotScriptProps = {},\n): React.ReactElement | null {\n if (process.env.NODE_ENV === 'production') return null;\n const source = getSnapshotScriptSource(props.selectors);\n return React.createElement('script', {\n nonce: props.nonce,\n suppressHydrationWarning: true,\n dangerouslySetInnerHTML: { __html: source },\n });\n}\n"]}
@@ -0,0 +1,441 @@
1
+ 'use strict';
2
+
3
+ var chunkEPJM3LH3_cjs = require('./chunk-EPJM3LH3.cjs');
4
+ var chunkOGQEPU7G_cjs = require('./chunk-OGQEPU7G.cjs');
5
+ var React2 = require('react');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
26
+
27
+ // src/react/console.ts
28
+ function installConsoleInterceptor(onMessage) {
29
+ if (typeof console === "undefined") return () => {
30
+ };
31
+ const original = console.error.bind(console);
32
+ const patched = (...args) => {
33
+ try {
34
+ const message = chunkEPJM3LH3_cjs.formatConsoleArgs(args);
35
+ if (message && chunkEPJM3LH3_cjs.isHydrationMessage(message)) {
36
+ onMessage(message, args);
37
+ }
38
+ } catch {
39
+ }
40
+ original(...args);
41
+ };
42
+ console.error = patched;
43
+ return () => {
44
+ if (console.error === patched) {
45
+ console.error = original;
46
+ }
47
+ };
48
+ }
49
+ var BADGE = "color:#f59e0b;font-weight:bold";
50
+ var DIM = "color:#9ca3af";
51
+ function createConsoleReporter() {
52
+ const sink = (report) => {
53
+ const title = `%c\u2B21 why-hydration%c ${report.cause.category} \u2014 ${report.node.path}`;
54
+ console.group(title, BADGE, DIM);
55
+ console.log("%cServer:%c", "color:#fb7185", "", report.server ?? "(none)");
56
+ console.log("%cClient:%c", "color:#4ade80", "", report.client ?? "(none)");
57
+ if (report.component) {
58
+ console.log("%cComponent:%c", DIM, "", report.component);
59
+ }
60
+ console.log("%cWhy:%c", DIM, "", report.cause.explanation);
61
+ console.log("%cFix:%c", "color:#86efac", "", report.cause.suggestion);
62
+ if (report.cause.docsUrl) {
63
+ console.log("%cDocs:%c", DIM, "", report.cause.docsUrl);
64
+ }
65
+ if (report.componentStack) {
66
+ console.log("%cComponent stack:%c", DIM, "", report.componentStack);
67
+ }
68
+ console.groupEnd();
69
+ };
70
+ return sink;
71
+ }
72
+
73
+ // src/react/overlay.ts
74
+ var CONTAINER_ID = "why-hydration-overlay";
75
+ var CATEGORY_LABELS = {
76
+ "non-deterministic-value": "Non-deterministic value",
77
+ "date-time": "Date / time",
78
+ "locale-format": "Locale formatting",
79
+ "browser-only-api": "Browser-only API",
80
+ "viewport-branching": "Viewport branching",
81
+ "invalid-html-nesting": "Invalid HTML nesting",
82
+ "whitespace-minification": "Whitespace / minification",
83
+ "third-party-dom-mutation": "Third-party DOM mutation",
84
+ unknown: "Unknown"
85
+ };
86
+ var STYLES = `
87
+ :host { all: initial; }
88
+ * { box-sizing: border-box; }
89
+ .wh-panel {
90
+ position: fixed;
91
+ z-index: 2147483647;
92
+ width: min(420px, calc(100vw - 32px));
93
+ max-height: min(70vh, 640px);
94
+ display: flex;
95
+ flex-direction: column;
96
+ font: 13px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
97
+ color: #e5e7eb;
98
+ background: #0b0f17;
99
+ border: 1px solid #1f2937;
100
+ border-radius: 12px;
101
+ box-shadow: 0 12px 40px rgba(0,0,0,.5);
102
+ overflow: hidden;
103
+ }
104
+ .wh-bottom-right { bottom: 16px; right: 16px; }
105
+ .wh-bottom-left { bottom: 16px; left: 16px; }
106
+ .wh-top-right { top: 16px; right: 16px; }
107
+ .wh-top-left { top: 16px; left: 16px; }
108
+ .wh-header {
109
+ display: flex; align-items: center; gap: 8px;
110
+ padding: 10px 12px;
111
+ background: linear-gradient(180deg, #151b26, #0d1220);
112
+ border-bottom: 1px solid #1f2937;
113
+ }
114
+ .wh-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; flex: none; }
115
+ .wh-title { font-weight: 600; color: #f3f4f6; }
116
+ .wh-count {
117
+ margin-left: auto; font-size: 11px; color: #9ca3af;
118
+ background: #111827; border: 1px solid #1f2937; border-radius: 999px;
119
+ padding: 1px 8px;
120
+ }
121
+ .wh-btn {
122
+ appearance: none; border: 1px solid #1f2937; background: #111827;
123
+ color: #9ca3af; border-radius: 6px; cursor: pointer;
124
+ font-size: 12px; padding: 3px 8px;
125
+ }
126
+ .wh-btn:hover { color: #f3f4f6; border-color: #374151; }
127
+ .wh-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
128
+ .wh-card { border: 1px solid #1f2937; border-radius: 10px; background: #0f1521; overflow: hidden; }
129
+ .wh-card-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
130
+ .wh-cat {
131
+ font-weight: 600; color: #fbbf24; font-size: 12px;
132
+ }
133
+ .wh-conf { margin-left: auto; font-size: 11px; color: #6b7280; }
134
+ .wh-body { padding: 0 10px 10px; }
135
+ .wh-where { font-size: 11px; color: #9ca3af; word-break: break-all; margin-bottom: 8px; }
136
+ .wh-where code { color: #93c5fd; }
137
+ .wh-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
138
+ .wh-side { border-radius: 8px; padding: 6px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-word; }
139
+ .wh-server { background: rgba(244,63,94,.08); border: 1px solid rgba(244,63,94,.35); }
140
+ .wh-client { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.35); }
141
+ .wh-side .wh-label { display: block; font-family: inherit; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
142
+ .wh-server .wh-label { color: #fb7185; }
143
+ .wh-client .wh-label { color: #4ade80; }
144
+ .wh-explain { color: #cbd5e1; margin-bottom: 8px; }
145
+ .wh-fix { color: #e5e7eb; background: #111827; border-left: 3px solid #22c55e; border-radius: 4px; padding: 6px 8px; }
146
+ .wh-fix strong { color: #86efac; }
147
+ .wh-docs { display: inline-block; margin-top: 6px; color: #60a5fa; text-decoration: none; font-size: 11px; }
148
+ .wh-docs:hover { text-decoration: underline; }
149
+ .wh-empty-value { color: #6b7280; font-style: italic; }
150
+ @media (max-width: 420px) {
151
+ .wh-panel { width: auto; max-height: min(80vh, 640px); }
152
+ .wh-bottom-right, .wh-bottom-left { left: 8px; right: 8px; }
153
+ .wh-top-right, .wh-top-left { left: 8px; right: 8px; }
154
+ .wh-diff { grid-template-columns: 1fr; }
155
+ }
156
+ `;
157
+ function el(tag, className, text) {
158
+ const node = document.createElement(tag);
159
+ if (className) node.className = className;
160
+ if (text != null) node.textContent = text;
161
+ return node;
162
+ }
163
+ function renderValue(value) {
164
+ if (value == null || value === "") {
165
+ return el("span", "wh-empty-value", value === "" ? "(empty)" : "(none)");
166
+ }
167
+ const span = document.createElement("span");
168
+ span.textContent = value;
169
+ return span;
170
+ }
171
+ function renderCard(report) {
172
+ const card = el("div", "wh-card");
173
+ const head = el("div", "wh-card-head");
174
+ head.appendChild(
175
+ el("span", "wh-cat", CATEGORY_LABELS[report.cause.category] ?? "Mismatch")
176
+ );
177
+ head.appendChild(
178
+ el("span", "wh-conf", `${Math.round(report.cause.confidence * 100)}%`)
179
+ );
180
+ card.appendChild(head);
181
+ const body = el("div", "wh-body");
182
+ const where = el("div", "wh-where");
183
+ const label = report.component ? `${report.component} \xB7 ` : report.node.tagName ? `<${report.node.tagName.toLowerCase()}> \xB7 ` : "";
184
+ where.append(label);
185
+ const code = el("code");
186
+ code.textContent = report.node.path;
187
+ where.appendChild(code);
188
+ if (report.node.attribute) {
189
+ where.append(` \xB7 @${report.node.attribute}`);
190
+ }
191
+ body.appendChild(where);
192
+ const diff = el("div", "wh-diff");
193
+ const server = el("div", "wh-side wh-server");
194
+ server.appendChild(el("span", "wh-label", "Server"));
195
+ server.appendChild(renderValue(report.server));
196
+ const client = el("div", "wh-side wh-client");
197
+ client.appendChild(el("span", "wh-label", "Client"));
198
+ client.appendChild(renderValue(report.client));
199
+ diff.appendChild(server);
200
+ diff.appendChild(client);
201
+ body.appendChild(diff);
202
+ body.appendChild(el("div", "wh-explain", report.cause.explanation));
203
+ const fix = el("div", "wh-fix");
204
+ const strong = el("strong");
205
+ strong.textContent = "Fix: ";
206
+ fix.appendChild(strong);
207
+ fix.append(report.cause.suggestion);
208
+ body.appendChild(fix);
209
+ if (report.cause.docsUrl && /^https?:\/\//i.test(report.cause.docsUrl)) {
210
+ const a = el("a", "wh-docs", "Learn more \u2192");
211
+ a.href = report.cause.docsUrl;
212
+ a.target = "_blank";
213
+ a.rel = "noreferrer noopener";
214
+ body.appendChild(a);
215
+ }
216
+ card.appendChild(body);
217
+ return card;
218
+ }
219
+ function createOverlay(options = {}) {
220
+ const position = options.position ?? "bottom-right";
221
+ let host = null;
222
+ let listEl = null;
223
+ let countEl = null;
224
+ let count = 0;
225
+ function ensureMounted() {
226
+ if (host) return;
227
+ document.getElementById(CONTAINER_ID)?.remove();
228
+ host = document.createElement("div");
229
+ host.id = CONTAINER_ID;
230
+ host.setAttribute("data-why-hydration", "overlay");
231
+ host.setAttribute("aria-hidden", "false");
232
+ const shadow = host.attachShadow({ mode: "open" });
233
+ const style = document.createElement("style");
234
+ style.textContent = STYLES;
235
+ shadow.appendChild(style);
236
+ const panel = el("div", `wh-panel wh-${position}`);
237
+ panel.setAttribute("role", "dialog");
238
+ panel.setAttribute("aria-label", "Hydration mismatch diagnostics");
239
+ const header = el("div", "wh-header");
240
+ header.appendChild(el("span", "wh-dot"));
241
+ header.appendChild(el("span", "wh-title", "Hydration mismatch"));
242
+ countEl = el("span", "wh-count", "0");
243
+ header.appendChild(countEl);
244
+ const close = el("button", "wh-btn", "Dismiss");
245
+ close.setAttribute("aria-label", "Dismiss diagnostics overlay");
246
+ close.addEventListener("click", () => destroy());
247
+ header.appendChild(close);
248
+ panel.appendChild(header);
249
+ listEl = el("div", "wh-list");
250
+ panel.appendChild(listEl);
251
+ shadow.appendChild(panel);
252
+ document.body.appendChild(host);
253
+ host.addEventListener("keydown", (e) => {
254
+ if (e.key === "Escape") destroy();
255
+ });
256
+ }
257
+ function destroy() {
258
+ host?.remove();
259
+ host = null;
260
+ listEl = null;
261
+ countEl = null;
262
+ }
263
+ function push(report) {
264
+ ensureMounted();
265
+ count += 1;
266
+ if (countEl) countEl.textContent = String(count);
267
+ listEl?.appendChild(renderCard(report));
268
+ }
269
+ return { push, destroy };
270
+ }
271
+
272
+ // src/react/controller.ts
273
+ function buildIgnore(ignore) {
274
+ if (!ignore || ignore.length === 0) return void 0;
275
+ return (divergence) => {
276
+ const node = divergence.element ?? null;
277
+ for (const rule of ignore) {
278
+ if (typeof rule === "function") {
279
+ if (node && rule(node)) return true;
280
+ } else if (node) {
281
+ try {
282
+ if (node.matches(rule) || node.closest(rule)) return true;
283
+ } catch {
284
+ }
285
+ }
286
+ }
287
+ return false;
288
+ };
289
+ }
290
+ var InspectorController = class {
291
+ constructor(options = {}) {
292
+ this.cleanups = [];
293
+ this.started = false;
294
+ this.pendingContext = {};
295
+ this.messageReported = false;
296
+ this.onRecoverableError = (error, info) => {
297
+ if (!chunkEPJM3LH3_cjs.isDev) return;
298
+ this.mergeContext({
299
+ componentStack: info?.componentStack,
300
+ component: firstComponentFromStack(info?.componentStack),
301
+ reactMessage: error instanceof Error ? error.message : String(error)
302
+ });
303
+ this.scheduleInspect();
304
+ };
305
+ this.options = options;
306
+ this.collector = new chunkEPJM3LH3_cjs.ReportCollector({
307
+ maxReports: options.maxReports,
308
+ extra: options.classify,
309
+ ignore: buildIgnore(options.ignore)
310
+ });
311
+ }
312
+ start() {
313
+ if (this.started || !chunkEPJM3LH3_cjs.isDev || typeof window === "undefined") return;
314
+ this.started = true;
315
+ this.pendingContext = {};
316
+ this.messageReported = false;
317
+ if (this.options.onReport) {
318
+ this.collector.addSink(this.options.onReport);
319
+ }
320
+ this.collector.addSink(createConsoleReporter());
321
+ if (this.options.overlay !== false) {
322
+ const overlayOpts = typeof this.options.overlay === "object" ? this.options.overlay : {};
323
+ const handle = createOverlay(overlayOpts);
324
+ this.collector.addSink(handle.push);
325
+ this.cleanups.push(() => handle.destroy());
326
+ }
327
+ const restore = installConsoleInterceptor((message) => {
328
+ this.mergeContext({ reactMessage: message });
329
+ this.scheduleInspect();
330
+ });
331
+ this.cleanups.push(restore);
332
+ this.scheduleInspect();
333
+ }
334
+ mergeContext(ctx) {
335
+ this.pendingContext = {
336
+ componentStack: this.pendingContext.componentStack ?? ctx.componentStack,
337
+ component: this.pendingContext.component ?? ctx.component,
338
+ location: this.pendingContext.location ?? ctx.location,
339
+ reactMessage: this.pendingContext.reactMessage ?? ctx.reactMessage
340
+ };
341
+ }
342
+ stop() {
343
+ for (const cleanup of this.cleanups.splice(0)) cleanup();
344
+ this.started = false;
345
+ }
346
+ getReports() {
347
+ return this.collector.getReports();
348
+ }
349
+ inspectNow(context = {}) {
350
+ this.mergeContext(context);
351
+ this.inspectAllRoots();
352
+ }
353
+ inspectAllRoots() {
354
+ if (!this.started || typeof document === "undefined" || this.collector.isFull) {
355
+ return;
356
+ }
357
+ const selectors = this.options.roots ?? snapshotSelectors();
358
+ const seen = /* @__PURE__ */ new Set();
359
+ for (const selector of selectors) {
360
+ const root = document.querySelector(selector);
361
+ if (!root || seen.has(root)) continue;
362
+ seen.add(root);
363
+ chunkEPJM3LH3_cjs.inspectRoot(root, this.collector, this.pendingContext);
364
+ }
365
+ if (this.collector.getReports().length === 0 && this.pendingContext.reactMessage && !this.messageReported) {
366
+ this.messageReported = true;
367
+ chunkEPJM3LH3_cjs.reportFromMessage(
368
+ this.pendingContext.reactMessage,
369
+ this.collector,
370
+ this.pendingContext
371
+ );
372
+ }
373
+ }
374
+ scheduleInspect() {
375
+ const run = () => this.inspectAllRoots();
376
+ if (typeof requestAnimationFrame === "function") {
377
+ requestAnimationFrame(run);
378
+ } else {
379
+ Promise.resolve().then(run);
380
+ }
381
+ }
382
+ };
383
+ function snapshotSelectors() {
384
+ const snapshot = chunkOGQEPU7G_cjs.readSnapshot();
385
+ const keys = snapshot ? Object.keys(snapshot.roots) : [];
386
+ return keys.length > 0 ? keys : [...chunkOGQEPU7G_cjs.DEFAULT_SNAPSHOT_SELECTORS];
387
+ }
388
+ function firstComponentFromStack(stack) {
389
+ if (!stack) return void 0;
390
+ const match = /\n?\s*(?:at|in)\s+([A-Za-z0-9_$]+)/.exec(stack);
391
+ return match?.[1];
392
+ }
393
+ function InspectorImpl(props) {
394
+ const { children, overlay, onReport, ignore, classify, maxReports } = props;
395
+ const controllerRef = React2__namespace.useRef(null);
396
+ if (controllerRef.current === null) {
397
+ controllerRef.current = new InspectorController({
398
+ overlay,
399
+ onReport,
400
+ ignore,
401
+ classify,
402
+ maxReports
403
+ });
404
+ controllerRef.current.start();
405
+ }
406
+ React2__namespace.useEffect(() => {
407
+ const controller = controllerRef.current;
408
+ return () => controller?.stop();
409
+ }, []);
410
+ return React2__namespace.createElement(React2__namespace.Fragment, null, children);
411
+ }
412
+
413
+ // src/react/index.tsx
414
+ function PassThrough(props) {
415
+ return React2__namespace.createElement(React2__namespace.Fragment, null, props.children);
416
+ }
417
+ var HydrationInspector = process.env.NODE_ENV !== "production" ? InspectorImpl : PassThrough;
418
+ function createHydrationInspector(options = {}) {
419
+ if (process.env.NODE_ENV === "production") {
420
+ return {
421
+ onRecoverableError: () => {
422
+ },
423
+ Provider: PassThrough
424
+ };
425
+ }
426
+ const controller = new InspectorController(options);
427
+ controller.start();
428
+ function Provider(props) {
429
+ React2__namespace.useEffect(() => () => controller.stop(), []);
430
+ return React2__namespace.createElement(React2__namespace.Fragment, null, props.children);
431
+ }
432
+ return {
433
+ onRecoverableError: controller.onRecoverableError,
434
+ Provider
435
+ };
436
+ }
437
+
438
+ exports.HydrationInspector = HydrationInspector;
439
+ exports.createHydrationInspector = createHydrationInspector;
440
+ //# sourceMappingURL=chunk-R6344ZUK.cjs.map
441
+ //# sourceMappingURL=chunk-R6344ZUK.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/react/console.ts","../src/react/overlay.ts","../src/react/controller.ts","../src/react/inspector.tsx","../src/react/index.tsx"],"names":["formatConsoleArgs","isHydrationMessage","isDev","ReportCollector","inspectRoot","reportFromMessage","readSnapshot","DEFAULT_SNAPSHOT_SELECTORS","React","React2"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,SAAS,0BACd,SAAA,EACY;AACZ,EAAA,IAAI,OAAO,OAAA,KAAY,WAAA,EAAa,OAAO,MAAM;AAAA,EAAC,CAAA;AAClD,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,KAAA,CAAM,IAAA,CAAK,OAAO,CAAA;AAC3C,EAAA,MAAM,OAAA,GAAmB,IAAI,IAAA,KAAoB;AAC/C,IAAA,IAAI;AACF,MAAA,MAAM,OAAA,GAAUA,oCAAkB,IAAI,CAAA;AACtC,MAAA,IAAI,OAAA,IAAWC,oCAAA,CAAmB,OAAO,CAAA,EAAG;AAC1C,QAAA,SAAA,CAAU,SAAS,IAAI,CAAA;AAAA,MACzB;AAAA,IACF,CAAA,CAAA,MAAQ;AAAA,IAER;AACA,IAAA,QAAA,CAAS,GAAG,IAAI,CAAA;AAAA,EAClB,CAAA;AACA,EAAA,OAAA,CAAQ,KAAA,GAAQ,OAAA;AAEhB,EAAA,OAAO,MAAM;AACX,IAAA,IAAI,OAAA,CAAQ,UAAW,OAAA,EAAkC;AACvD,MAAA,OAAA,CAAQ,KAAA,GAAQ,QAAA;AAAA,IAClB;AAAA,EACF,CAAA;AACF;AAEA,IAAM,KAAA,GAAQ,gCAAA;AACd,IAAM,GAAA,GAAM,eAAA;AAEL,SAAS,qBAAA,GAAoC;AAClD,EAAA,MAAM,IAAA,GAAmB,CAAC,MAAA,KAA4B;AACpD,IAAA,MAAM,KAAA,GAAQ,4BAAuB,MAAA,CAAO,KAAA,CAAM,QAAQ,CAAA,QAAA,EAAM,MAAA,CAAO,KAAK,IAAI,CAAA,CAAA;AAChF,IAAA,OAAA,CAAQ,KAAA,CAAM,KAAA,EAAO,KAA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QAAQ,CAAA;AAC3D;;;ACjCA,SAAS,YAAY,KAAA,EAEE;AACrB,EAAA,OAAaC,iBAAA,CAAA,aAAA,CAAoBA,iBAAA,CAAA,QAAA,EAAU,IAAA,EAAM,KAAA,CAAM,QAAQ,CAAA;AACjE;AAIO,IAAM,kBAAA,GAGX,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,eAAe,aAAA,GAAgB;AAUnD,SAAS,wBAAA,CACd,OAAA,GAA4B,EAAC,EACH;AAC1B,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,EAAc;AACzC,IAAA,OAAO;AAAA,MACL,oBAAoB,MAAM;AAAA,MAAC,CAAA;AAAA,MAC3B,QAAA,EAAU;AAAA,KACZ;AAAA,EACF;AAEA,EAAA,MAAM,UAAA,GAAa,IAAI,mBAAA,CAAoB,OAAO,CAAA;AAClD,EAAA,UAAA,CAAW,KAAA,EAAM;AAEjB,EAAA,SAAS,SAAS,KAAA,EAEK;AACrB,IAAMA,4BAAU,MAAM,MAAM,WAAW,IAAA,EAAK,EAAG,EAAE,CAAA;AACjD,IAAA,OAAaA,iBAAA,CAAA,aAAA,CAAoBA,iBAAA,CAAA,QAAA,EAAU,IAAA,EAAM,KAAA,CAAM,QAAQ,CAAA;AAAA,EACjE;AAEA,EAAA,OAAO;AAAA,IACL,oBAAoB,UAAA,CAAW,kBAAA;AAAA,IAC/B;AAAA,GACF;AACF","file":"chunk-R6344ZUK.cjs","sourcesContent":["import { formatConsoleArgs, isHydrationMessage } from '../core/react-message';\nimport type { HydrationReport } from '../core/types';\nimport type { ReportSink } from '../core/report';\n\ntype ErrorFn = (...args: unknown[]) => void;\n\nexport function installConsoleInterceptor(\n onMessage: (message: string, args: readonly unknown[]) => void,\n): () => void {\n if (typeof console === 'undefined') return () => {};\n const original = console.error.bind(console) as ErrorFn;\n const patched: ErrorFn = (...args: unknown[]) => {\n try {\n const message = formatConsoleArgs(args);\n if (message && isHydrationMessage(message)) {\n onMessage(message, args);\n }\n } catch {\n /* never let interception break normal logging */\n }\n original(...args);\n };\n console.error = patched as typeof console.error;\n\n return () => {\n if (console.error === (patched as typeof console.error)) {\n console.error = original as typeof console.error;\n }\n };\n}\n\nconst BADGE = 'color:#f59e0b;font-weight:bold';\nconst DIM = 'color:#9ca3af';\n\nexport function createConsoleReporter(): ReportSink {\n const sink: ReportSink = (report: HydrationReport) => {\n const title = `%c⬡ why-hydration%c ${report.cause.category} — ${report.node.path}`;\n console.group(title, BADGE, DIM);\n console.log('%cServer:%c', 'color:#fb7185', '', report.server ?? '(none)');\n console.log('%cClient:%c', 'color:#4ade80', '', report.client ?? '(none)');\n if (report.component) {\n console.log('%cComponent:%c', DIM, '', report.component);\n }\n console.log('%cWhy:%c', DIM, '', report.cause.explanation);\n console.log('%cFix:%c', 'color:#86efac', '', report.cause.suggestion);\n if (report.cause.docsUrl) {\n console.log('%cDocs:%c', DIM, '', report.cause.docsUrl);\n }\n if (report.componentStack) {\n console.log('%cComponent stack:%c', DIM, '', report.componentStack);\n }\n console.groupEnd();\n };\n return sink;\n}\n","import type { HydrationReport } from '../core/types';\n\nexport interface OverlayOptions {\n position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';\n}\n\nexport interface OverlayHandle {\n push: (report: HydrationReport) => void;\n destroy: () => void;\n}\n\nconst CONTAINER_ID = 'why-hydration-overlay';\n\nconst CATEGORY_LABELS: Record<string, string> = {\n 'non-deterministic-value': 'Non-deterministic value',\n 'date-time': 'Date / time',\n 'locale-format': 'Locale formatting',\n 'browser-only-api': 'Browser-only API',\n 'viewport-branching': 'Viewport branching',\n 'invalid-html-nesting': 'Invalid HTML nesting',\n 'whitespace-minification': 'Whitespace / minification',\n 'third-party-dom-mutation': 'Third-party DOM mutation',\n unknown: 'Unknown',\n};\n\nconst STYLES = `\n:host { all: initial; }\n* { box-sizing: border-box; }\n.wh-panel {\n position: fixed;\n z-index: 2147483647;\n width: min(420px, calc(100vw - 32px));\n max-height: min(70vh, 640px);\n display: flex;\n flex-direction: column;\n font: 13px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;\n color: #e5e7eb;\n background: #0b0f17;\n border: 1px solid #1f2937;\n border-radius: 12px;\n box-shadow: 0 12px 40px rgba(0,0,0,.5);\n overflow: hidden;\n}\n.wh-bottom-right { bottom: 16px; right: 16px; }\n.wh-bottom-left { bottom: 16px; left: 16px; }\n.wh-top-right { top: 16px; right: 16px; }\n.wh-top-left { top: 16px; left: 16px; }\n.wh-header {\n display: flex; align-items: center; gap: 8px;\n padding: 10px 12px;\n background: linear-gradient(180deg, #151b26, #0d1220);\n border-bottom: 1px solid #1f2937;\n}\n.wh-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; flex: none; }\n.wh-title { font-weight: 600; color: #f3f4f6; }\n.wh-count {\n margin-left: auto; font-size: 11px; color: #9ca3af;\n background: #111827; border: 1px solid #1f2937; border-radius: 999px;\n padding: 1px 8px;\n}\n.wh-btn {\n appearance: none; border: 1px solid #1f2937; background: #111827;\n color: #9ca3af; border-radius: 6px; cursor: pointer;\n font-size: 12px; padding: 3px 8px;\n}\n.wh-btn:hover { color: #f3f4f6; border-color: #374151; }\n.wh-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }\n.wh-card { border: 1px solid #1f2937; border-radius: 10px; background: #0f1521; overflow: hidden; }\n.wh-card-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }\n.wh-cat {\n font-weight: 600; color: #fbbf24; font-size: 12px;\n}\n.wh-conf { margin-left: auto; font-size: 11px; color: #6b7280; }\n.wh-body { padding: 0 10px 10px; }\n.wh-where { font-size: 11px; color: #9ca3af; word-break: break-all; margin-bottom: 8px; }\n.wh-where code { color: #93c5fd; }\n.wh-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }\n.wh-side { border-radius: 8px; padding: 6px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-word; }\n.wh-server { background: rgba(244,63,94,.08); border: 1px solid rgba(244,63,94,.35); }\n.wh-client { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.35); }\n.wh-side .wh-label { display: block; font-family: inherit; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }\n.wh-server .wh-label { color: #fb7185; }\n.wh-client .wh-label { color: #4ade80; }\n.wh-explain { color: #cbd5e1; margin-bottom: 8px; }\n.wh-fix { color: #e5e7eb; background: #111827; border-left: 3px solid #22c55e; border-radius: 4px; padding: 6px 8px; }\n.wh-fix strong { color: #86efac; }\n.wh-docs { display: inline-block; margin-top: 6px; color: #60a5fa; text-decoration: none; font-size: 11px; }\n.wh-docs:hover { text-decoration: underline; }\n.wh-empty-value { color: #6b7280; font-style: italic; }\n@media (max-width: 420px) {\n .wh-panel { width: auto; max-height: min(80vh, 640px); }\n .wh-bottom-right, .wh-bottom-left { left: 8px; right: 8px; }\n .wh-top-right, .wh-top-left { left: 8px; right: 8px; }\n .wh-diff { grid-template-columns: 1fr; }\n}\n`;\n\nfunction el<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className?: string,\n text?: string,\n): HTMLElementTagNameMap[K] {\n const node = document.createElement(tag);\n if (className) node.className = className;\n if (text != null) node.textContent = text;\n return node;\n}\n\nfunction renderValue(value: string | null): HTMLElement {\n if (value == null || value === '') {\n return el('span', 'wh-empty-value', value === '' ? '(empty)' : '(none)');\n }\n const span = document.createElement('span');\n span.textContent = value;\n return span;\n}\n\nfunction renderCard(report: HydrationReport): HTMLElement {\n const card = el('div', 'wh-card');\n\n const head = el('div', 'wh-card-head');\n head.appendChild(\n el('span', 'wh-cat', CATEGORY_LABELS[report.cause.category] ?? 'Mismatch'),\n );\n head.appendChild(\n el('span', 'wh-conf', `${Math.round(report.cause.confidence * 100)}%`),\n );\n card.appendChild(head);\n\n const body = el('div', 'wh-body');\n\n const where = el('div', 'wh-where');\n const label = report.component\n ? `${report.component} · `\n : report.node.tagName\n ? `<${report.node.tagName.toLowerCase()}> · `\n : '';\n where.append(label);\n const code = el('code');\n code.textContent = report.node.path;\n where.appendChild(code);\n if (report.node.attribute) {\n where.append(` · @${report.node.attribute}`);\n }\n body.appendChild(where);\n\n const diff = el('div', 'wh-diff');\n const server = el('div', 'wh-side wh-server');\n server.appendChild(el('span', 'wh-label', 'Server'));\n server.appendChild(renderValue(report.server));\n const client = el('div', 'wh-side wh-client');\n client.appendChild(el('span', 'wh-label', 'Client'));\n client.appendChild(renderValue(report.client));\n diff.appendChild(server);\n diff.appendChild(client);\n body.appendChild(diff);\n\n body.appendChild(el('div', 'wh-explain', report.cause.explanation));\n\n const fix = el('div', 'wh-fix');\n const strong = el('strong');\n strong.textContent = 'Fix: ';\n fix.appendChild(strong);\n fix.append(report.cause.suggestion);\n body.appendChild(fix);\n\n if (report.cause.docsUrl && /^https?:\\/\\//i.test(report.cause.docsUrl)) {\n const a = el('a', 'wh-docs', 'Learn more →');\n a.href = report.cause.docsUrl;\n a.target = '_blank';\n a.rel = 'noreferrer noopener';\n body.appendChild(a);\n }\n\n card.appendChild(body);\n return card;\n}\n\nexport function createOverlay(options: OverlayOptions = {}): OverlayHandle {\n const position = options.position ?? 'bottom-right';\n let host: HTMLElement | null = null;\n let listEl: HTMLElement | null = null;\n let countEl: HTMLElement | null = null;\n let count = 0;\n\n function ensureMounted(): void {\n if (host) return;\n document.getElementById(CONTAINER_ID)?.remove();\n host = document.createElement('div');\n host.id = CONTAINER_ID;\n host.setAttribute('data-why-hydration', 'overlay');\n host.setAttribute('aria-hidden', 'false');\n const shadow = host.attachShadow({ mode: 'open' });\n\n const style = document.createElement('style');\n style.textContent = STYLES;\n shadow.appendChild(style);\n\n const panel = el('div', `wh-panel wh-${position}`);\n panel.setAttribute('role', 'dialog');\n panel.setAttribute('aria-label', 'Hydration mismatch diagnostics');\n\n const header = el('div', 'wh-header');\n header.appendChild(el('span', 'wh-dot'));\n header.appendChild(el('span', 'wh-title', 'Hydration mismatch'));\n countEl = el('span', 'wh-count', '0');\n header.appendChild(countEl);\n const close = el('button', 'wh-btn', 'Dismiss');\n close.setAttribute('aria-label', 'Dismiss diagnostics overlay');\n close.addEventListener('click', () => destroy());\n header.appendChild(close);\n panel.appendChild(header);\n\n listEl = el('div', 'wh-list');\n panel.appendChild(listEl);\n\n shadow.appendChild(panel);\n document.body.appendChild(host);\n\n host.addEventListener('keydown', (e) => {\n if ((e as KeyboardEvent).key === 'Escape') destroy();\n });\n }\n\n function destroy(): void {\n host?.remove();\n host = null;\n listEl = null;\n countEl = null;\n }\n\n function push(report: HydrationReport): void {\n ensureMounted();\n count += 1;\n if (countEl) countEl.textContent = String(count);\n listEl?.appendChild(renderCard(report));\n }\n\n return { push, destroy };\n}\n","import { inspectRoot, reportFromMessage } from '../core/inspect';\nimport { ReportCollector } from '../core/report';\nimport { DEFAULT_SNAPSHOT_SELECTORS, readSnapshot } from '../core/snapshot';\nimport { isDev } from '../core/env';\nimport type {\n Classifier,\n DetectionContext,\n Divergence,\n HydrationReport,\n} from '../core/types';\nimport { createConsoleReporter, installConsoleInterceptor } from './console';\nimport { createOverlay, type OverlayOptions } from './overlay';\n\nexport interface InspectorOptions {\n overlay?: boolean | OverlayOptions;\n onReport?: (report: HydrationReport) => void;\n ignore?: Array<string | ((node: Element) => boolean)>;\n classify?: Classifier[];\n maxReports?: number;\n roots?: string[];\n}\n\nfunction buildIgnore(\n ignore: InspectorOptions['ignore'],\n): ((d: Divergence) => boolean) | undefined {\n if (!ignore || ignore.length === 0) return undefined;\n return (divergence: Divergence): boolean => {\n const node = divergence.element ?? null;\n for (const rule of ignore) {\n if (typeof rule === 'function') {\n if (node && rule(node)) return true;\n } else if (node) {\n try {\n if (node.matches(rule) || node.closest(rule)) return true;\n } catch {\n /* invalid selector */\n }\n }\n }\n return false;\n };\n}\n\nexport class InspectorController {\n private readonly collector: ReportCollector;\n private readonly options: InspectorOptions;\n private readonly cleanups: Array<() => void> = [];\n private started = false;\n private pendingContext: DetectionContext = {};\n private messageReported = false;\n\n constructor(options: InspectorOptions = {}) {\n this.options = options;\n this.collector = new ReportCollector({\n maxReports: options.maxReports,\n extra: options.classify,\n ignore: buildIgnore(options.ignore),\n });\n }\n\n start(): void {\n if (this.started || !isDev || typeof window === 'undefined') return;\n this.started = true;\n this.pendingContext = {};\n this.messageReported = false;\n\n if (this.options.onReport) {\n this.collector.addSink(this.options.onReport);\n }\n this.collector.addSink(createConsoleReporter());\n if (this.options.overlay !== false) {\n const overlayOpts: OverlayOptions =\n typeof this.options.overlay === 'object' ? this.options.overlay : {};\n const handle = createOverlay(overlayOpts);\n this.collector.addSink(handle.push);\n this.cleanups.push(() => handle.destroy());\n }\n\n const restore = installConsoleInterceptor((message) => {\n this.mergeContext({ reactMessage: message });\n this.scheduleInspect();\n });\n this.cleanups.push(restore);\n\n this.scheduleInspect();\n }\n\n onRecoverableError = (\n error: unknown,\n info?: { componentStack?: string },\n ): void => {\n if (!isDev) return;\n this.mergeContext({\n componentStack: info?.componentStack,\n component: firstComponentFromStack(info?.componentStack),\n reactMessage: error instanceof Error ? error.message : String(error),\n });\n this.scheduleInspect();\n };\n\n private mergeContext(ctx: DetectionContext): void {\n this.pendingContext = {\n componentStack: this.pendingContext.componentStack ?? ctx.componentStack,\n component: this.pendingContext.component ?? ctx.component,\n location: this.pendingContext.location ?? ctx.location,\n reactMessage: this.pendingContext.reactMessage ?? ctx.reactMessage,\n };\n }\n\n stop(): void {\n for (const cleanup of this.cleanups.splice(0)) cleanup();\n this.started = false;\n }\n\n getReports(): readonly HydrationReport[] {\n return this.collector.getReports();\n }\n\n inspectNow(context: DetectionContext = {}): void {\n this.mergeContext(context);\n this.inspectAllRoots();\n }\n\n private inspectAllRoots(): void {\n if (\n !this.started ||\n typeof document === 'undefined' ||\n this.collector.isFull\n ) {\n return;\n }\n const selectors = this.options.roots ?? snapshotSelectors();\n const seen = new Set<Element>();\n for (const selector of selectors) {\n const root = document.querySelector(selector);\n if (!root || seen.has(root)) continue;\n seen.add(root);\n inspectRoot(root, this.collector, this.pendingContext);\n }\n\n if (\n this.collector.getReports().length === 0 &&\n this.pendingContext.reactMessage &&\n !this.messageReported\n ) {\n this.messageReported = true;\n reportFromMessage(\n this.pendingContext.reactMessage,\n this.collector,\n this.pendingContext,\n );\n }\n }\n\n private scheduleInspect(): void {\n const run = () => this.inspectAllRoots();\n if (typeof requestAnimationFrame === 'function') {\n requestAnimationFrame(run);\n } else {\n Promise.resolve().then(run);\n }\n }\n}\n\nfunction snapshotSelectors(): string[] {\n const snapshot = readSnapshot();\n const keys = snapshot ? Object.keys(snapshot.roots) : [];\n return keys.length > 0 ? keys : [...DEFAULT_SNAPSHOT_SELECTORS];\n}\n\nfunction firstComponentFromStack(stack?: string): string | undefined {\n if (!stack) return undefined;\n const match = /\\n?\\s*(?:at|in)\\s+([A-Za-z0-9_$]+)/.exec(stack);\n return match?.[1];\n}\n","import * as React from 'react';\nimport type { Classifier, HydrationReport } from '../core/types';\nimport { InspectorController } from './controller';\nimport type { OverlayOptions } from './overlay';\n\nexport interface HydrationInspectorProps {\n children: React.ReactNode;\n overlay?: boolean | OverlayOptions;\n onReport?: (report: HydrationReport) => void;\n ignore?: Array<string | ((node: Element) => boolean)>;\n classify?: Classifier[];\n maxReports?: number;\n}\n\nexport function InspectorImpl(\n props: HydrationInspectorProps,\n): React.ReactElement {\n const { children, overlay, onReport, ignore, classify, maxReports } = props;\n\n const controllerRef = React.useRef<InspectorController | null>(null);\n if (controllerRef.current === null) {\n controllerRef.current = new InspectorController({\n overlay,\n onReport,\n ignore,\n classify,\n maxReports,\n });\n controllerRef.current.start();\n }\n\n React.useEffect(() => {\n const controller = controllerRef.current;\n return () => controller?.stop();\n }, []);\n\n return React.createElement(React.Fragment, null, children);\n}\n","import * as React from 'react';\nimport { InspectorController, type InspectorOptions } from './controller';\nimport { InspectorImpl, type HydrationInspectorProps } from './inspector';\n\nfunction PassThrough(props: {\n children?: React.ReactNode;\n}): React.ReactElement {\n return React.createElement(React.Fragment, null, props.children);\n}\n\n// The process.env.NODE_ENV checks are inline (not hoisted to a variable) so\n// production bundlers fold them and tree-shake the dev-only implementation.\nexport const HydrationInspector: (\n props: HydrationInspectorProps,\n) => React.ReactElement =\n process.env.NODE_ENV !== 'production' ? InspectorImpl : PassThrough;\n\nexport interface HydrationInspectorHandle {\n onRecoverableError: (\n error: unknown,\n info?: { componentStack?: string },\n ) => void;\n Provider: (props: { children?: React.ReactNode }) => React.ReactElement;\n}\n\nexport function createHydrationInspector(\n options: InspectorOptions = {},\n): HydrationInspectorHandle {\n if (process.env.NODE_ENV === 'production') {\n return {\n onRecoverableError: () => {},\n Provider: PassThrough,\n };\n }\n\n const controller = new InspectorController(options);\n controller.start();\n\n function Provider(props: {\n children?: React.ReactNode;\n }): React.ReactElement {\n React.useEffect(() => () => controller.stop(), []);\n return React.createElement(React.Fragment, null, props.children);\n }\n\n return {\n onRecoverableError: controller.onRecoverableError,\n Provider,\n };\n}\n\nexport type { HydrationInspectorProps } from './inspector';\nexport type { InspectorOptions } from './controller';\nexport type { OverlayOptions } from './overlay';\nexport type {\n Cause,\n Classifier,\n DetectionContext,\n Divergence,\n HydrationCauseCategory,\n HydrationReport,\n} from '../core/types';\n"]}