why-hydration 0.1.5 → 0.3.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.
@@ -1,19 +1,19 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var chunkOFVFNPE6_cjs = require('../chunk-OFVFNPE6.cjs');
5
- require('../chunk-AT6A77X3.cjs');
4
+ var chunkRWMRFTQ4_cjs = require('../chunk-RWMRFTQ4.cjs');
5
+ require('../chunk-QFHUKJ5K.cjs');
6
6
  require('../chunk-DXPTZB3Z.cjs');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "HydrationInspector", {
11
11
  enumerable: true,
12
- get: function () { return chunkOFVFNPE6_cjs.HydrationInspector; }
12
+ get: function () { return chunkRWMRFTQ4_cjs.HydrationInspector; }
13
13
  });
14
14
  Object.defineProperty(exports, "createHydrationInspector", {
15
15
  enumerable: true,
16
- get: function () { return chunkOFVFNPE6_cjs.createHydrationInspector; }
16
+ get: function () { return chunkRWMRFTQ4_cjs.createHydrationInspector; }
17
17
  });
18
18
  //# sourceMappingURL=index.cjs.map
19
19
  //# sourceMappingURL=index.cjs.map
@@ -1,3 +1,3 @@
1
1
  export { HydrationInspector, HydrationInspectorHandle, HydrationInspectorProps, InspectorOptions, OverlayOptions, createHydrationInspector } from '../react.cjs';
2
- export { d as HydrationCauseCategory, H as HydrationReport } from '../types-6wTih14e.cjs';
2
+ export { d as HydrationCauseCategory, H as HydrationReport } from '../types-C14vcpBO.cjs';
3
3
  import 'react';
@@ -1,3 +1,3 @@
1
1
  export { HydrationInspector, HydrationInspectorHandle, HydrationInspectorProps, InspectorOptions, OverlayOptions, createHydrationInspector } from '../react.js';
2
- export { d as HydrationCauseCategory, H as HydrationReport } from '../types-6wTih14e.js';
2
+ export { d as HydrationCauseCategory, H as HydrationReport } from '../types-C14vcpBO.js';
3
3
  import 'react';
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- export { HydrationInspector, createHydrationInspector } from '../chunk-3I6F4K4L.js';
3
- import '../chunk-AS5DZZHI.js';
2
+ export { HydrationInspector, createHydrationInspector } from '../chunk-CER5NQRR.js';
3
+ import '../chunk-KP4S6CRL.js';
4
4
  import '../chunk-XIM33ZGB.js';
5
5
  //# sourceMappingURL=index.js.map
6
6
  //# sourceMappingURL=index.js.map
package/dist/react.cjs CHANGED
@@ -1,19 +1,19 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var chunkOFVFNPE6_cjs = require('./chunk-OFVFNPE6.cjs');
5
- require('./chunk-AT6A77X3.cjs');
4
+ var chunkRWMRFTQ4_cjs = require('./chunk-RWMRFTQ4.cjs');
5
+ require('./chunk-QFHUKJ5K.cjs');
6
6
  require('./chunk-DXPTZB3Z.cjs');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "HydrationInspector", {
11
11
  enumerable: true,
12
- get: function () { return chunkOFVFNPE6_cjs.HydrationInspector; }
12
+ get: function () { return chunkRWMRFTQ4_cjs.HydrationInspector; }
13
13
  });
14
14
  Object.defineProperty(exports, "createHydrationInspector", {
15
15
  enumerable: true,
16
- get: function () { return chunkOFVFNPE6_cjs.createHydrationInspector; }
16
+ get: function () { return chunkRWMRFTQ4_cjs.createHydrationInspector; }
17
17
  });
18
18
  //# sourceMappingURL=react.cjs.map
19
19
  //# sourceMappingURL=react.cjs.map
package/dist/react.d.cts CHANGED
@@ -1,9 +1,30 @@
1
1
  import * as React from 'react';
2
- import { H as HydrationReport, C as Classifier } from './types-6wTih14e.cjs';
3
- export { a as Cause, b as DetectionContext, D as Divergence, d as HydrationCauseCategory } from './types-6wTih14e.cjs';
2
+ import { H as HydrationReport, C as Classifier } from './types-C14vcpBO.cjs';
3
+ export { a as Cause, b as DetectionContext, D as Divergence, d as HydrationCauseCategory } from './types-C14vcpBO.cjs';
4
+
5
+ /**
6
+ * Overlay languages.
7
+ *
8
+ * The overlay speaks the page's language where it can: an Arabic page gets an
9
+ * Arabic, right-to-left panel, and everything else gets English. The engine's
10
+ * own output (`cause.explanation`, the console, `onReport`) is always English;
11
+ * only this view is translated, by looking causes up by `messageId`.
12
+ *
13
+ * Only the overlay imports this module, so it is tree-shaken out of production
14
+ * builds together with the rest of the dev implementation.
15
+ */
16
+
17
+ type OverlayLocale = 'en' | 'ar' | 'he' | 'fa';
4
18
 
5
19
  interface OverlayOptions {
6
20
  position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
21
+ /**
22
+ * Language of the panel. `'auto'` (the default) follows the page's
23
+ * `<html lang>`: Arabic, Hebrew and Persian pages get the panel in that
24
+ * language, laid out right-to-left, and every other page gets English.
25
+ * Pass `'en'`, `'ar'`, `'he'` or `'fa'` to pin it.
26
+ */
27
+ locale?: 'auto' | OverlayLocale;
7
28
  }
8
29
 
9
30
  interface InspectorOptions {
@@ -35,4 +56,4 @@ interface HydrationInspectorHandle {
35
56
  }
36
57
  declare function createHydrationInspector(options?: InspectorOptions): HydrationInspectorHandle;
37
58
 
38
- export { Classifier, HydrationInspector, type HydrationInspectorHandle, type HydrationInspectorProps, HydrationReport, type InspectorOptions, type OverlayOptions, createHydrationInspector };
59
+ export { Classifier, HydrationInspector, type HydrationInspectorHandle, type HydrationInspectorProps, HydrationReport, type InspectorOptions, type OverlayLocale, type OverlayOptions, createHydrationInspector };
package/dist/react.d.ts CHANGED
@@ -1,9 +1,30 @@
1
1
  import * as React from 'react';
2
- import { H as HydrationReport, C as Classifier } from './types-6wTih14e.js';
3
- export { a as Cause, b as DetectionContext, D as Divergence, d as HydrationCauseCategory } from './types-6wTih14e.js';
2
+ import { H as HydrationReport, C as Classifier } from './types-C14vcpBO.js';
3
+ export { a as Cause, b as DetectionContext, D as Divergence, d as HydrationCauseCategory } from './types-C14vcpBO.js';
4
+
5
+ /**
6
+ * Overlay languages.
7
+ *
8
+ * The overlay speaks the page's language where it can: an Arabic page gets an
9
+ * Arabic, right-to-left panel, and everything else gets English. The engine's
10
+ * own output (`cause.explanation`, the console, `onReport`) is always English;
11
+ * only this view is translated, by looking causes up by `messageId`.
12
+ *
13
+ * Only the overlay imports this module, so it is tree-shaken out of production
14
+ * builds together with the rest of the dev implementation.
15
+ */
16
+
17
+ type OverlayLocale = 'en' | 'ar' | 'he' | 'fa';
4
18
 
5
19
  interface OverlayOptions {
6
20
  position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
21
+ /**
22
+ * Language of the panel. `'auto'` (the default) follows the page's
23
+ * `<html lang>`: Arabic, Hebrew and Persian pages get the panel in that
24
+ * language, laid out right-to-left, and every other page gets English.
25
+ * Pass `'en'`, `'ar'`, `'he'` or `'fa'` to pin it.
26
+ */
27
+ locale?: 'auto' | OverlayLocale;
7
28
  }
8
29
 
9
30
  interface InspectorOptions {
@@ -35,4 +56,4 @@ interface HydrationInspectorHandle {
35
56
  }
36
57
  declare function createHydrationInspector(options?: InspectorOptions): HydrationInspectorHandle;
37
58
 
38
- export { Classifier, HydrationInspector, type HydrationInspectorHandle, type HydrationInspectorProps, HydrationReport, type InspectorOptions, type OverlayOptions, createHydrationInspector };
59
+ export { Classifier, HydrationInspector, type HydrationInspectorHandle, type HydrationInspectorProps, HydrationReport, type InspectorOptions, type OverlayLocale, type OverlayOptions, createHydrationInspector };
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- export { HydrationInspector, createHydrationInspector } from './chunk-3I6F4K4L.js';
3
- import './chunk-AS5DZZHI.js';
2
+ export { HydrationInspector, createHydrationInspector } from './chunk-CER5NQRR.js';
3
+ import './chunk-KP4S6CRL.js';
4
4
  import './chunk-XIM33ZGB.js';
5
5
  //# sourceMappingURL=react.js.map
6
6
  //# sourceMappingURL=react.js.map
@@ -14,9 +14,18 @@ interface Divergence {
14
14
  interface Cause {
15
15
  category: HydrationCauseCategory;
16
16
  confidence: number;
17
+ /** Always English — this is what the console prints and `onReport` gets. */
17
18
  explanation: string;
18
19
  suggestion: string;
19
20
  docsUrl?: string;
21
+ /**
22
+ * Which message produced `explanation`/`suggestion`, so a renderer can show
23
+ * the same cause in another language. Set by every built-in rule; custom
24
+ * classifiers may leave it out, and renderers then fall back to the English.
25
+ */
26
+ messageId?: string;
27
+ /** The values interpolated into that message (attribute names, tokens…). */
28
+ params?: Readonly<Record<string, string | readonly string[]>>;
20
29
  }
21
30
  type Classifier = (divergence: Divergence) => Cause | null;
22
31
  interface SourceLocation {
@@ -14,9 +14,18 @@ interface Divergence {
14
14
  interface Cause {
15
15
  category: HydrationCauseCategory;
16
16
  confidence: number;
17
+ /** Always English — this is what the console prints and `onReport` gets. */
17
18
  explanation: string;
18
19
  suggestion: string;
19
20
  docsUrl?: string;
21
+ /**
22
+ * Which message produced `explanation`/`suggestion`, so a renderer can show
23
+ * the same cause in another language. Set by every built-in rule; custom
24
+ * classifiers may leave it out, and renderers then fall back to the English.
25
+ */
26
+ messageId?: string;
27
+ /** The values interpolated into that message (attribute names, tokens…). */
28
+ params?: Readonly<Record<string, string | readonly string[]>>;
20
29
  }
21
30
  type Classifier = (divergence: Divergence) => Cause | null;
22
31
  interface SourceLocation {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "why-hydration",
3
- "version": "0.1.5",
4
- "description": "Tells you which component broke hydration, what differed, and how to fix it — in dev, with zero production cost.",
3
+ "version": "0.3.0",
4
+ "description": "Find which React component broke hydration, what differed, and how to fix it — for Next.js, Remix and Vite, React 18 and 19. Dev-only, zero production cost.",
5
5
  "license": "MIT",
6
6
  "author": "Razan Aboushi (https://www.linkedin.com/in/razan-aboushi/)",
7
7
  "homepage": "https://github.com/razan-aboushi/why-hydration#readme",
@@ -14,15 +14,33 @@
14
14
  },
15
15
  "keywords": [
16
16
  "react",
17
+ "react-dom",
17
18
  "hydration",
18
19
  "hydration error",
20
+ "hydration mismatch",
21
+ "hydration-mismatch",
22
+ "hydration failed",
23
+ "react hydration",
24
+ "hydrateRoot",
25
+ "text content does not match",
26
+ "suppressHydrationWarning",
19
27
  "ssr",
28
+ "server-side rendering",
20
29
  "next",
30
+ "nextjs",
31
+ "next.js",
32
+ "app router",
21
33
  "remix",
22
34
  "vite",
23
- "hydration-mismatch",
35
+ "react 18",
36
+ "react 19",
24
37
  "devtools",
25
- "diagnostics"
38
+ "debugging",
39
+ "diagnostics",
40
+ "developer tools",
41
+ "rtl",
42
+ "arabic",
43
+ "i18n"
26
44
  ],
27
45
  "type": "module",
28
46
  "sideEffects": false,