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.
- package/LICENSE +21 -0
- package/README.md +394 -0
- package/dist/chunk-EPJM3LH3.cjs +717 -0
- package/dist/chunk-EPJM3LH3.cjs.map +1 -0
- package/dist/chunk-FV3PEJQE.js +42 -0
- package/dist/chunk-FV3PEJQE.js.map +1 -0
- package/dist/chunk-HYG6GVWO.js +16 -0
- package/dist/chunk-HYG6GVWO.js.map +1 -0
- package/dist/chunk-LNVWRW65.js +700 -0
- package/dist/chunk-LNVWRW65.js.map +1 -0
- package/dist/chunk-OGQEPU7G.cjs +49 -0
- package/dist/chunk-OGQEPU7G.cjs.map +1 -0
- package/dist/chunk-PVXOK7GJ.js +418 -0
- package/dist/chunk-PVXOK7GJ.js.map +1 -0
- package/dist/chunk-QGAEURQY.cjs +38 -0
- package/dist/chunk-QGAEURQY.cjs.map +1 -0
- package/dist/chunk-R6344ZUK.cjs +441 -0
- package/dist/chunk-R6344ZUK.cjs.map +1 -0
- package/dist/index.cjs +97 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +65 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/next/index.cjs +23 -0
- package/dist/next/index.cjs.map +1 -0
- package/dist/next/index.d.cts +4 -0
- package/dist/next/index.d.ts +4 -0
- package/dist/next/index.js +6 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/script.cjs +13 -0
- package/dist/next/script.cjs.map +1 -0
- package/dist/next/script.d.cts +9 -0
- package/dist/next/script.d.ts +9 -0
- package/dist/next/script.js +4 -0
- package/dist/next/script.js.map +1 -0
- package/dist/react.cjs +18 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +38 -0
- package/dist/react.d.ts +38 -0
- package/dist/react.js +5 -0
- package/dist/react.js.map +1 -0
- package/dist/types-DTlltJb9.d.cts +53 -0
- package/dist/types-DTlltJb9.d.ts +53 -0
- package/package.json +134 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkEPJM3LH3_cjs = require('./chunk-EPJM3LH3.cjs');
|
|
4
|
+
var chunkOGQEPU7G_cjs = require('./chunk-OGQEPU7G.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "BUILT_IN_RULES", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkEPJM3LH3_cjs.BUILT_IN_RULES; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "CONFIDENCE_THRESHOLD", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkEPJM3LH3_cjs.CONFIDENCE_THRESHOLD; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "ReportCollector", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkEPJM3LH3_cjs.ReportCollector; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "UNKNOWN_CAUSE", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkEPJM3LH3_cjs.UNKNOWN_CAUSE; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "buildReport", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkEPJM3LH3_cjs.buildReport; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "classify", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkEPJM3LH3_cjs.classify; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "diffSnapshotAgainstDom", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return chunkEPJM3LH3_cjs.diffSnapshotAgainstDom; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "diffTrees", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return chunkEPJM3LH3_cjs.diffTrees; }
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "formatConsoleArgs", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return chunkEPJM3LH3_cjs.formatConsoleArgs; }
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "inspectRoot", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return chunkEPJM3LH3_cjs.inspectRoot; }
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "isDev", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return chunkEPJM3LH3_cjs.isDev; }
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "isHydrationMessage", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return chunkEPJM3LH3_cjs.isHydrationMessage; }
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "parseHydrationMessage", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () { return chunkEPJM3LH3_cjs.parseHydrationMessage; }
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "parseServerHtml", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return chunkEPJM3LH3_cjs.parseServerHtml; }
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, "reportFromMessage", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () { return chunkEPJM3LH3_cjs.reportFromMessage; }
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "signatureOf", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () { return chunkEPJM3LH3_cjs.signatureOf; }
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "DEFAULT_SNAPSHOT_SELECTORS", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () { return chunkOGQEPU7G_cjs.DEFAULT_SNAPSHOT_SELECTORS; }
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "SNAPSHOT_KEY", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () { return chunkOGQEPU7G_cjs.SNAPSHOT_KEY; }
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "captureSnapshotNow", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () { return chunkOGQEPU7G_cjs.captureSnapshotNow; }
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "getServerHtmlForRoot", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () { return chunkOGQEPU7G_cjs.getServerHtmlForRoot; }
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, "getSnapshotScriptSource", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () { return chunkOGQEPU7G_cjs.getSnapshotScriptSource; }
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "readSnapshot", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () { return chunkOGQEPU7G_cjs.readSnapshot; }
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=index.cjs.map
|
|
97
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { c as Divergence, C as Classifier, b as Cause, a as HydrationReport, D as DetectionContext } from './types-DTlltJb9.cjs';
|
|
2
|
+
export { d as DivergenceKind, H as HydrationCauseCategory, S as SourceLocation } from './types-DTlltJb9.cjs';
|
|
3
|
+
|
|
4
|
+
declare const isDev: boolean;
|
|
5
|
+
|
|
6
|
+
declare const DEFAULT_SNAPSHOT_SELECTORS: string[];
|
|
7
|
+
declare const SNAPSHOT_KEY = "__WHY_HYDRATION_SNAPSHOT__";
|
|
8
|
+
interface Snapshot {
|
|
9
|
+
version: 1;
|
|
10
|
+
capturedAt: number;
|
|
11
|
+
roots: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface Window {
|
|
15
|
+
[SNAPSHOT_KEY]?: Snapshot;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare function getSnapshotScriptSource(selectors?: readonly string[]): string;
|
|
19
|
+
declare function readSnapshot(): Snapshot | undefined;
|
|
20
|
+
declare function getServerHtmlForRoot(root: Element): string | undefined;
|
|
21
|
+
declare function captureSnapshotNow(selectors?: readonly string[]): Snapshot | undefined;
|
|
22
|
+
|
|
23
|
+
declare function parseServerHtml(html: string, rootTagName: string): Element;
|
|
24
|
+
declare function diffTrees(serverRoot: Element, clientRoot: Element, basePath?: string): Divergence | null;
|
|
25
|
+
declare function diffSnapshotAgainstDom(serverHtml: string, clientRoot: Element): Divergence | null;
|
|
26
|
+
|
|
27
|
+
declare const BUILT_IN_RULES: readonly Classifier[];
|
|
28
|
+
declare const UNKNOWN_CAUSE: Cause;
|
|
29
|
+
|
|
30
|
+
declare const CONFIDENCE_THRESHOLD = 0.5;
|
|
31
|
+
interface ClassifyOptions {
|
|
32
|
+
extra?: readonly Classifier[];
|
|
33
|
+
threshold?: number;
|
|
34
|
+
}
|
|
35
|
+
declare function classify(divergence: Divergence, options?: ClassifyOptions): Cause;
|
|
36
|
+
|
|
37
|
+
type ReportSink = (report: HydrationReport) => void;
|
|
38
|
+
declare function buildReport(divergence: Divergence, cause: Cause, context?: DetectionContext): HydrationReport;
|
|
39
|
+
declare function signatureOf(report: HydrationReport): string;
|
|
40
|
+
interface CollectorOptions extends ClassifyOptions {
|
|
41
|
+
maxReports?: number;
|
|
42
|
+
ignore?: (divergence: Divergence) => boolean;
|
|
43
|
+
}
|
|
44
|
+
declare class ReportCollector {
|
|
45
|
+
private readonly seen;
|
|
46
|
+
private readonly sinks;
|
|
47
|
+
private readonly reports;
|
|
48
|
+
private readonly maxReports;
|
|
49
|
+
private readonly options;
|
|
50
|
+
constructor(options?: CollectorOptions);
|
|
51
|
+
addSink(sink: ReportSink): () => void;
|
|
52
|
+
getReports(): readonly HydrationReport[];
|
|
53
|
+
get isFull(): boolean;
|
|
54
|
+
report(divergence: Divergence, context?: DetectionContext): HydrationReport | null;
|
|
55
|
+
reset(): void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare function inspectRoot(root: Element, collector: ReportCollector, context?: DetectionContext): boolean;
|
|
59
|
+
declare function reportFromMessage(message: string, collector: ReportCollector, context?: DetectionContext): boolean;
|
|
60
|
+
|
|
61
|
+
declare function isHydrationMessage(message: string): boolean;
|
|
62
|
+
declare function formatConsoleArgs(args: readonly unknown[]): string;
|
|
63
|
+
declare function parseHydrationMessage(message: string): Divergence | null;
|
|
64
|
+
|
|
65
|
+
export { BUILT_IN_RULES, CONFIDENCE_THRESHOLD, Cause, Classifier, type ClassifyOptions, type CollectorOptions, DEFAULT_SNAPSHOT_SELECTORS, DetectionContext, Divergence, HydrationReport, ReportCollector, type ReportSink, SNAPSHOT_KEY, type Snapshot, UNKNOWN_CAUSE, buildReport, captureSnapshotNow, classify, diffSnapshotAgainstDom, diffTrees, formatConsoleArgs, getServerHtmlForRoot, getSnapshotScriptSource, inspectRoot, isDev, isHydrationMessage, parseHydrationMessage, parseServerHtml, readSnapshot, reportFromMessage, signatureOf };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { c as Divergence, C as Classifier, b as Cause, a as HydrationReport, D as DetectionContext } from './types-DTlltJb9.js';
|
|
2
|
+
export { d as DivergenceKind, H as HydrationCauseCategory, S as SourceLocation } from './types-DTlltJb9.js';
|
|
3
|
+
|
|
4
|
+
declare const isDev: boolean;
|
|
5
|
+
|
|
6
|
+
declare const DEFAULT_SNAPSHOT_SELECTORS: string[];
|
|
7
|
+
declare const SNAPSHOT_KEY = "__WHY_HYDRATION_SNAPSHOT__";
|
|
8
|
+
interface Snapshot {
|
|
9
|
+
version: 1;
|
|
10
|
+
capturedAt: number;
|
|
11
|
+
roots: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface Window {
|
|
15
|
+
[SNAPSHOT_KEY]?: Snapshot;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare function getSnapshotScriptSource(selectors?: readonly string[]): string;
|
|
19
|
+
declare function readSnapshot(): Snapshot | undefined;
|
|
20
|
+
declare function getServerHtmlForRoot(root: Element): string | undefined;
|
|
21
|
+
declare function captureSnapshotNow(selectors?: readonly string[]): Snapshot | undefined;
|
|
22
|
+
|
|
23
|
+
declare function parseServerHtml(html: string, rootTagName: string): Element;
|
|
24
|
+
declare function diffTrees(serverRoot: Element, clientRoot: Element, basePath?: string): Divergence | null;
|
|
25
|
+
declare function diffSnapshotAgainstDom(serverHtml: string, clientRoot: Element): Divergence | null;
|
|
26
|
+
|
|
27
|
+
declare const BUILT_IN_RULES: readonly Classifier[];
|
|
28
|
+
declare const UNKNOWN_CAUSE: Cause;
|
|
29
|
+
|
|
30
|
+
declare const CONFIDENCE_THRESHOLD = 0.5;
|
|
31
|
+
interface ClassifyOptions {
|
|
32
|
+
extra?: readonly Classifier[];
|
|
33
|
+
threshold?: number;
|
|
34
|
+
}
|
|
35
|
+
declare function classify(divergence: Divergence, options?: ClassifyOptions): Cause;
|
|
36
|
+
|
|
37
|
+
type ReportSink = (report: HydrationReport) => void;
|
|
38
|
+
declare function buildReport(divergence: Divergence, cause: Cause, context?: DetectionContext): HydrationReport;
|
|
39
|
+
declare function signatureOf(report: HydrationReport): string;
|
|
40
|
+
interface CollectorOptions extends ClassifyOptions {
|
|
41
|
+
maxReports?: number;
|
|
42
|
+
ignore?: (divergence: Divergence) => boolean;
|
|
43
|
+
}
|
|
44
|
+
declare class ReportCollector {
|
|
45
|
+
private readonly seen;
|
|
46
|
+
private readonly sinks;
|
|
47
|
+
private readonly reports;
|
|
48
|
+
private readonly maxReports;
|
|
49
|
+
private readonly options;
|
|
50
|
+
constructor(options?: CollectorOptions);
|
|
51
|
+
addSink(sink: ReportSink): () => void;
|
|
52
|
+
getReports(): readonly HydrationReport[];
|
|
53
|
+
get isFull(): boolean;
|
|
54
|
+
report(divergence: Divergence, context?: DetectionContext): HydrationReport | null;
|
|
55
|
+
reset(): void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare function inspectRoot(root: Element, collector: ReportCollector, context?: DetectionContext): boolean;
|
|
59
|
+
declare function reportFromMessage(message: string, collector: ReportCollector, context?: DetectionContext): boolean;
|
|
60
|
+
|
|
61
|
+
declare function isHydrationMessage(message: string): boolean;
|
|
62
|
+
declare function formatConsoleArgs(args: readonly unknown[]): string;
|
|
63
|
+
declare function parseHydrationMessage(message: string): Divergence | null;
|
|
64
|
+
|
|
65
|
+
export { BUILT_IN_RULES, CONFIDENCE_THRESHOLD, Cause, Classifier, type ClassifyOptions, type CollectorOptions, DEFAULT_SNAPSHOT_SELECTORS, DetectionContext, Divergence, HydrationReport, ReportCollector, type ReportSink, SNAPSHOT_KEY, type Snapshot, UNKNOWN_CAUSE, buildReport, captureSnapshotNow, classify, diffSnapshotAgainstDom, diffTrees, formatConsoleArgs, getServerHtmlForRoot, getSnapshotScriptSource, inspectRoot, isDev, isHydrationMessage, parseHydrationMessage, parseServerHtml, readSnapshot, reportFromMessage, signatureOf };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { BUILT_IN_RULES, CONFIDENCE_THRESHOLD, ReportCollector, UNKNOWN_CAUSE, buildReport, classify, diffSnapshotAgainstDom, diffTrees, formatConsoleArgs, inspectRoot, isDev, isHydrationMessage, parseHydrationMessage, parseServerHtml, reportFromMessage, signatureOf } from './chunk-LNVWRW65.js';
|
|
2
|
+
export { DEFAULT_SNAPSHOT_SELECTORS, SNAPSHOT_KEY, captureSnapshotNow, getServerHtmlForRoot, getSnapshotScriptSource, readSnapshot } from './chunk-FV3PEJQE.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkR6344ZUK_cjs = require('../chunk-R6344ZUK.cjs');
|
|
4
|
+
require('../chunk-EPJM3LH3.cjs');
|
|
5
|
+
var chunkQGAEURQY_cjs = require('../chunk-QGAEURQY.cjs');
|
|
6
|
+
require('../chunk-OGQEPU7G.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "HydrationInspector", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunkR6344ZUK_cjs.HydrationInspector; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "createHydrationInspector", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkR6344ZUK_cjs.createHydrationInspector; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "HydrationSnapshotScript", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunkQGAEURQY_cjs.HydrationSnapshotScript; }
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=index.cjs.map
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { HydrationInspector, HydrationInspectorHandle, HydrationInspectorProps, InspectorOptions, OverlayOptions, createHydrationInspector } from '../react.cjs';
|
|
2
|
+
export { HydrationSnapshotScript, HydrationSnapshotScriptProps } from './script.cjs';
|
|
3
|
+
export { H as HydrationCauseCategory, a as HydrationReport } from '../types-DTlltJb9.cjs';
|
|
4
|
+
import 'react';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { HydrationInspector, HydrationInspectorHandle, HydrationInspectorProps, InspectorOptions, OverlayOptions, createHydrationInspector } from '../react.js';
|
|
2
|
+
export { HydrationSnapshotScript, HydrationSnapshotScriptProps } from './script.js';
|
|
3
|
+
export { H as HydrationCauseCategory, a as HydrationReport } from '../types-DTlltJb9.js';
|
|
4
|
+
import 'react';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { HydrationInspector, createHydrationInspector } from '../chunk-PVXOK7GJ.js';
|
|
2
|
+
import '../chunk-LNVWRW65.js';
|
|
3
|
+
export { HydrationSnapshotScript } from '../chunk-HYG6GVWO.js';
|
|
4
|
+
import '../chunk-FV3PEJQE.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkQGAEURQY_cjs = require('../chunk-QGAEURQY.cjs');
|
|
4
|
+
require('../chunk-OGQEPU7G.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "HydrationSnapshotScript", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkQGAEURQY_cjs.HydrationSnapshotScript; }
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=script.cjs.map
|
|
13
|
+
//# sourceMappingURL=script.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"script.cjs"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface HydrationSnapshotScriptProps {
|
|
4
|
+
selectors?: string[];
|
|
5
|
+
nonce?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function HydrationSnapshotScript(props?: HydrationSnapshotScriptProps): React.ReactElement | null;
|
|
8
|
+
|
|
9
|
+
export { HydrationSnapshotScript, type HydrationSnapshotScriptProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface HydrationSnapshotScriptProps {
|
|
4
|
+
selectors?: string[];
|
|
5
|
+
nonce?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function HydrationSnapshotScript(props?: HydrationSnapshotScriptProps): React.ReactElement | null;
|
|
8
|
+
|
|
9
|
+
export { HydrationSnapshotScript, type HydrationSnapshotScriptProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"script.js"}
|
package/dist/react.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkR6344ZUK_cjs = require('./chunk-R6344ZUK.cjs');
|
|
4
|
+
require('./chunk-EPJM3LH3.cjs');
|
|
5
|
+
require('./chunk-OGQEPU7G.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "HydrationInspector", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkR6344ZUK_cjs.HydrationInspector; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "createHydrationInspector", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkR6344ZUK_cjs.createHydrationInspector; }
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=react.cjs.map
|
|
18
|
+
//# sourceMappingURL=react.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"react.cjs"}
|
package/dist/react.d.cts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { a as HydrationReport, C as Classifier } from './types-DTlltJb9.cjs';
|
|
3
|
+
export { b as Cause, D as DetectionContext, c as Divergence, H as HydrationCauseCategory } from './types-DTlltJb9.cjs';
|
|
4
|
+
|
|
5
|
+
interface OverlayOptions {
|
|
6
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface InspectorOptions {
|
|
10
|
+
overlay?: boolean | OverlayOptions;
|
|
11
|
+
onReport?: (report: HydrationReport) => void;
|
|
12
|
+
ignore?: Array<string | ((node: Element) => boolean)>;
|
|
13
|
+
classify?: Classifier[];
|
|
14
|
+
maxReports?: number;
|
|
15
|
+
roots?: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface HydrationInspectorProps {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
overlay?: boolean | OverlayOptions;
|
|
21
|
+
onReport?: (report: HydrationReport) => void;
|
|
22
|
+
ignore?: Array<string | ((node: Element) => boolean)>;
|
|
23
|
+
classify?: Classifier[];
|
|
24
|
+
maxReports?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare const HydrationInspector: (props: HydrationInspectorProps) => React.ReactElement;
|
|
28
|
+
interface HydrationInspectorHandle {
|
|
29
|
+
onRecoverableError: (error: unknown, info?: {
|
|
30
|
+
componentStack?: string;
|
|
31
|
+
}) => void;
|
|
32
|
+
Provider: (props: {
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
}) => React.ReactElement;
|
|
35
|
+
}
|
|
36
|
+
declare function createHydrationInspector(options?: InspectorOptions): HydrationInspectorHandle;
|
|
37
|
+
|
|
38
|
+
export { Classifier, HydrationInspector, type HydrationInspectorHandle, type HydrationInspectorProps, HydrationReport, type InspectorOptions, type OverlayOptions, createHydrationInspector };
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { a as HydrationReport, C as Classifier } from './types-DTlltJb9.js';
|
|
3
|
+
export { b as Cause, D as DetectionContext, c as Divergence, H as HydrationCauseCategory } from './types-DTlltJb9.js';
|
|
4
|
+
|
|
5
|
+
interface OverlayOptions {
|
|
6
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface InspectorOptions {
|
|
10
|
+
overlay?: boolean | OverlayOptions;
|
|
11
|
+
onReport?: (report: HydrationReport) => void;
|
|
12
|
+
ignore?: Array<string | ((node: Element) => boolean)>;
|
|
13
|
+
classify?: Classifier[];
|
|
14
|
+
maxReports?: number;
|
|
15
|
+
roots?: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface HydrationInspectorProps {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
overlay?: boolean | OverlayOptions;
|
|
21
|
+
onReport?: (report: HydrationReport) => void;
|
|
22
|
+
ignore?: Array<string | ((node: Element) => boolean)>;
|
|
23
|
+
classify?: Classifier[];
|
|
24
|
+
maxReports?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare const HydrationInspector: (props: HydrationInspectorProps) => React.ReactElement;
|
|
28
|
+
interface HydrationInspectorHandle {
|
|
29
|
+
onRecoverableError: (error: unknown, info?: {
|
|
30
|
+
componentStack?: string;
|
|
31
|
+
}) => void;
|
|
32
|
+
Provider: (props: {
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
}) => React.ReactElement;
|
|
35
|
+
}
|
|
36
|
+
declare function createHydrationInspector(options?: InspectorOptions): HydrationInspectorHandle;
|
|
37
|
+
|
|
38
|
+
export { Classifier, HydrationInspector, type HydrationInspectorHandle, type HydrationInspectorProps, HydrationReport, type InspectorOptions, type OverlayOptions, createHydrationInspector };
|
package/dist/react.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"react.js"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
type DivergenceKind = 'text' | 'attribute' | 'structure' | 'node-added' | 'node-removed';
|
|
2
|
+
type HydrationCauseCategory = 'non-deterministic-value' | 'date-time' | 'locale-format' | 'browser-only-api' | 'viewport-branching' | 'invalid-html-nesting' | 'whitespace-minification' | 'third-party-dom-mutation' | 'unknown';
|
|
3
|
+
interface Divergence {
|
|
4
|
+
kind: DivergenceKind;
|
|
5
|
+
path: string;
|
|
6
|
+
tagName?: string;
|
|
7
|
+
parentTagName?: string;
|
|
8
|
+
attribute?: string;
|
|
9
|
+
reactMessage?: string;
|
|
10
|
+
server: string | null;
|
|
11
|
+
client: string | null;
|
|
12
|
+
element?: Element | null;
|
|
13
|
+
}
|
|
14
|
+
interface Cause {
|
|
15
|
+
category: HydrationCauseCategory;
|
|
16
|
+
confidence: number;
|
|
17
|
+
explanation: string;
|
|
18
|
+
suggestion: string;
|
|
19
|
+
docsUrl?: string;
|
|
20
|
+
}
|
|
21
|
+
type Classifier = (divergence: Divergence) => Cause | null;
|
|
22
|
+
interface SourceLocation {
|
|
23
|
+
file?: string;
|
|
24
|
+
line?: number;
|
|
25
|
+
column?: number;
|
|
26
|
+
}
|
|
27
|
+
interface HydrationReport {
|
|
28
|
+
id: string;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
component?: string;
|
|
31
|
+
componentStack?: string;
|
|
32
|
+
location?: SourceLocation;
|
|
33
|
+
node: {
|
|
34
|
+
path: string;
|
|
35
|
+
tagName?: string;
|
|
36
|
+
attribute?: string;
|
|
37
|
+
kind: DivergenceKind;
|
|
38
|
+
};
|
|
39
|
+
server: string | null;
|
|
40
|
+
client: string | null;
|
|
41
|
+
cause: Cause;
|
|
42
|
+
raw?: {
|
|
43
|
+
reactMessage?: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
interface DetectionContext {
|
|
47
|
+
componentStack?: string;
|
|
48
|
+
component?: string;
|
|
49
|
+
location?: SourceLocation;
|
|
50
|
+
reactMessage?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type { Classifier as C, DetectionContext as D, HydrationCauseCategory as H, SourceLocation as S, HydrationReport as a, Cause as b, Divergence as c, DivergenceKind as d };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
type DivergenceKind = 'text' | 'attribute' | 'structure' | 'node-added' | 'node-removed';
|
|
2
|
+
type HydrationCauseCategory = 'non-deterministic-value' | 'date-time' | 'locale-format' | 'browser-only-api' | 'viewport-branching' | 'invalid-html-nesting' | 'whitespace-minification' | 'third-party-dom-mutation' | 'unknown';
|
|
3
|
+
interface Divergence {
|
|
4
|
+
kind: DivergenceKind;
|
|
5
|
+
path: string;
|
|
6
|
+
tagName?: string;
|
|
7
|
+
parentTagName?: string;
|
|
8
|
+
attribute?: string;
|
|
9
|
+
reactMessage?: string;
|
|
10
|
+
server: string | null;
|
|
11
|
+
client: string | null;
|
|
12
|
+
element?: Element | null;
|
|
13
|
+
}
|
|
14
|
+
interface Cause {
|
|
15
|
+
category: HydrationCauseCategory;
|
|
16
|
+
confidence: number;
|
|
17
|
+
explanation: string;
|
|
18
|
+
suggestion: string;
|
|
19
|
+
docsUrl?: string;
|
|
20
|
+
}
|
|
21
|
+
type Classifier = (divergence: Divergence) => Cause | null;
|
|
22
|
+
interface SourceLocation {
|
|
23
|
+
file?: string;
|
|
24
|
+
line?: number;
|
|
25
|
+
column?: number;
|
|
26
|
+
}
|
|
27
|
+
interface HydrationReport {
|
|
28
|
+
id: string;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
component?: string;
|
|
31
|
+
componentStack?: string;
|
|
32
|
+
location?: SourceLocation;
|
|
33
|
+
node: {
|
|
34
|
+
path: string;
|
|
35
|
+
tagName?: string;
|
|
36
|
+
attribute?: string;
|
|
37
|
+
kind: DivergenceKind;
|
|
38
|
+
};
|
|
39
|
+
server: string | null;
|
|
40
|
+
client: string | null;
|
|
41
|
+
cause: Cause;
|
|
42
|
+
raw?: {
|
|
43
|
+
reactMessage?: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
interface DetectionContext {
|
|
47
|
+
componentStack?: string;
|
|
48
|
+
component?: string;
|
|
49
|
+
location?: SourceLocation;
|
|
50
|
+
reactMessage?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type { Classifier as C, DetectionContext as D, HydrationCauseCategory as H, SourceLocation as S, HydrationReport as a, Cause as b, Divergence as c, DivergenceKind as d };
|