why-hydration 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +108 -1
- package/README.md +220 -33
- package/dist/{chunk-WQLUD25W.js → chunk-3OAI2ZHY.js} +375 -118
- package/dist/chunk-3OAI2ZHY.js.map +1 -0
- package/dist/{chunk-OGQEPU7G.cjs → chunk-DXPTZB3Z.cjs} +44 -2
- package/dist/chunk-DXPTZB3Z.cjs.map +1 -0
- package/dist/{chunk-DSO337ME.cjs → chunk-KX6G7I4Y.cjs} +384 -118
- package/dist/chunk-KX6G7I4Y.cjs.map +1 -0
- package/dist/chunk-MK3TYHKM.js +966 -0
- package/dist/chunk-MK3TYHKM.js.map +1 -0
- package/dist/chunk-R7IWOK5M.cjs +989 -0
- package/dist/chunk-R7IWOK5M.cjs.map +1 -0
- package/dist/{chunk-FV3PEJQE.js → chunk-XIM33ZGB.js} +44 -2
- package/dist/chunk-XIM33ZGB.js.map +1 -0
- package/dist/index.cjs +32 -24
- package/dist/index.d.cts +43 -5
- package/dist/index.d.ts +43 -5
- package/dist/index.js +2 -2
- package/dist/next/index.cjs +5 -5
- package/dist/next/index.d.cts +1 -1
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +3 -3
- package/dist/next/script.cjs +2 -2
- package/dist/next/script.js +1 -1
- package/dist/react.cjs +5 -5
- package/dist/react.d.cts +23 -3
- package/dist/react.d.ts +23 -3
- package/dist/react.js +3 -3
- package/dist/{types-6wTih14e.d.cts → types-C14vcpBO.d.cts} +9 -0
- package/dist/{types-6wTih14e.d.ts → types-C14vcpBO.d.ts} +9 -0
- package/package.json +1 -1
- package/dist/chunk-3KULWJ7A.js +0 -569
- package/dist/chunk-3KULWJ7A.js.map +0 -1
- package/dist/chunk-5CBGYE7A.cjs +0 -592
- package/dist/chunk-5CBGYE7A.cjs.map +0 -1
- package/dist/chunk-DSO337ME.cjs.map +0 -1
- package/dist/chunk-FV3PEJQE.js.map +0 -1
- package/dist/chunk-OGQEPU7G.cjs.map +0 -1
- package/dist/chunk-WQLUD25W.js.map +0 -1
package/dist/next/index.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
4
|
+
var chunkR7IWOK5M_cjs = require('../chunk-R7IWOK5M.cjs');
|
|
5
|
+
require('../chunk-KX6G7I4Y.cjs');
|
|
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
|
|
12
|
+
get: function () { return chunkR7IWOK5M_cjs.HydrationInspector; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "createHydrationInspector", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkR7IWOK5M_cjs.createHydrationInspector; }
|
|
17
17
|
});
|
|
18
18
|
//# sourceMappingURL=index.cjs.map
|
|
19
19
|
//# sourceMappingURL=index.cjs.map
|
package/dist/next/index.d.cts
CHANGED
|
@@ -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-
|
|
2
|
+
export { d as HydrationCauseCategory, H as HydrationReport } from '../types-C14vcpBO.cjs';
|
|
3
3
|
import 'react';
|
package/dist/next/index.d.ts
CHANGED
|
@@ -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-
|
|
2
|
+
export { d as HydrationCauseCategory, H as HydrationReport } from '../types-C14vcpBO.js';
|
|
3
3
|
import 'react';
|
package/dist/next/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { HydrationInspector, createHydrationInspector } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
2
|
+
export { HydrationInspector, createHydrationInspector } from '../chunk-MK3TYHKM.js';
|
|
3
|
+
import '../chunk-3OAI2ZHY.js';
|
|
4
|
+
import '../chunk-XIM33ZGB.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/next/script.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDXPTZB3Z_cjs = require('../chunk-DXPTZB3Z.cjs');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
|
|
6
6
|
function _interopNamespace(e) {
|
|
@@ -25,7 +25,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
25
25
|
|
|
26
26
|
function HydrationSnapshotScript(props = {}) {
|
|
27
27
|
if (process.env.NODE_ENV === "production") return null;
|
|
28
|
-
const source =
|
|
28
|
+
const source = chunkDXPTZB3Z_cjs.getSnapshotScriptSource(props.selectors);
|
|
29
29
|
return React__namespace.createElement("script", {
|
|
30
30
|
nonce: props.nonce,
|
|
31
31
|
suppressHydrationWarning: true,
|
package/dist/next/script.js
CHANGED
package/dist/react.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
4
|
+
var chunkR7IWOK5M_cjs = require('./chunk-R7IWOK5M.cjs');
|
|
5
|
+
require('./chunk-KX6G7I4Y.cjs');
|
|
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
|
|
12
|
+
get: function () { return chunkR7IWOK5M_cjs.HydrationInspector; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "createHydrationInspector", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkR7IWOK5M_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,29 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { H as HydrationReport, C as Classifier } from './types-
|
|
3
|
-
export { a as Cause, b as DetectionContext, D as Divergence, d as HydrationCauseCategory } from './types-
|
|
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';
|
|
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>`: an Arabic page gets an Arabic, right-to-left panel and
|
|
24
|
+
* every other page gets English. Pass `'en'` or `'ar'` to pin it.
|
|
25
|
+
*/
|
|
26
|
+
locale?: 'auto' | OverlayLocale;
|
|
7
27
|
}
|
|
8
28
|
|
|
9
29
|
interface InspectorOptions {
|
|
@@ -35,4 +55,4 @@ interface HydrationInspectorHandle {
|
|
|
35
55
|
}
|
|
36
56
|
declare function createHydrationInspector(options?: InspectorOptions): HydrationInspectorHandle;
|
|
37
57
|
|
|
38
|
-
export { Classifier, HydrationInspector, type HydrationInspectorHandle, type HydrationInspectorProps, HydrationReport, type InspectorOptions, type OverlayOptions, createHydrationInspector };
|
|
58
|
+
export { Classifier, HydrationInspector, type HydrationInspectorHandle, type HydrationInspectorProps, HydrationReport, type InspectorOptions, type OverlayLocale, type OverlayOptions, createHydrationInspector };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { H as HydrationReport, C as Classifier } from './types-
|
|
3
|
-
export { a as Cause, b as DetectionContext, D as Divergence, d as HydrationCauseCategory } from './types-
|
|
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';
|
|
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>`: an Arabic page gets an Arabic, right-to-left panel and
|
|
24
|
+
* every other page gets English. Pass `'en'` or `'ar'` to pin it.
|
|
25
|
+
*/
|
|
26
|
+
locale?: 'auto' | OverlayLocale;
|
|
7
27
|
}
|
|
8
28
|
|
|
9
29
|
interface InspectorOptions {
|
|
@@ -35,4 +55,4 @@ interface HydrationInspectorHandle {
|
|
|
35
55
|
}
|
|
36
56
|
declare function createHydrationInspector(options?: InspectorOptions): HydrationInspectorHandle;
|
|
37
57
|
|
|
38
|
-
export { Classifier, HydrationInspector, type HydrationInspectorHandle, type HydrationInspectorProps, HydrationReport, type InspectorOptions, type OverlayOptions, createHydrationInspector };
|
|
58
|
+
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-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
2
|
+
export { HydrationInspector, createHydrationInspector } from './chunk-MK3TYHKM.js';
|
|
3
|
+
import './chunk-3OAI2ZHY.js';
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "why-hydration",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Tells you which component broke hydration, what differed, and how to fix it — in dev, with zero production cost.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Razan Aboushi (https://www.linkedin.com/in/razan-aboushi/)",
|