@tanstack/redact 0.0.21 → 0.1.1
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/dist/core/attributes.js +2 -1
- package/dist/core/attributes.js.map +2 -2
- package/dist/core/browser.d.ts +9 -0
- package/dist/core/browser.js +35 -0
- package/dist/core/browser.js.map +7 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +3 -3
- package/dist/core/internal.d.ts +31 -8
- package/dist/core/internal.js +3 -1
- package/dist/core/internal.js.map +2 -2
- package/dist/core/resource-hints.d.ts +7 -0
- package/dist/core/resource-hints.js +19 -0
- package/dist/core/resource-hints.js.map +7 -0
- package/dist/core/types.js +1 -1
- package/dist/dom/_all.d.ts +11 -16
- package/dist/dom/_all.js +9 -20
- package/dist/dom/_all.js.map +2 -2
- package/dist/dom/client.d.ts +4 -4
- package/dist/dom/client.js +4 -4
- package/dist/dom/commit.d.ts +23 -0
- package/dist/dom/commit.js +191 -0
- package/dist/dom/commit.js.map +7 -0
- package/dist/dom/dispatcher.d.ts +4 -22
- package/dist/dom/dispatcher.js +184 -126
- package/dist/dom/dispatcher.js.map +3 -3
- package/dist/dom/dom.d.ts +2 -0
- package/dist/dom/dom.js +72 -52
- package/dist/dom/dom.js.map +2 -2
- package/dist/dom/error-info.d.ts +2 -0
- package/dist/dom/error-info.js +16 -0
- package/dist/dom/error-info.js.map +7 -0
- package/dist/dom/event-replay.js +1 -1
- package/dist/dom/features/activity/full.d.ts +1 -0
- package/dist/dom/features/activity/full.js +162 -0
- package/dist/dom/features/activity/full.js.map +7 -0
- package/dist/dom/features/activity/index.d.ts +1 -0
- package/dist/dom/features/activity/index.js +3 -0
- package/dist/dom/features/activity/index.js.map +7 -0
- package/dist/dom/features/activity/stub.d.ts +1 -0
- package/dist/dom/features/activity/stub.js +12 -0
- package/dist/dom/features/activity/stub.js.map +7 -0
- package/dist/dom/features/class/full.js +87 -27
- package/dist/dom/features/class/full.js.map +2 -2
- package/dist/dom/features/class/index.d.ts +1 -1
- package/dist/dom/features/class/index.js +2 -2
- package/dist/dom/features/class/stub.js +3 -3
- package/dist/dom/features/context/full.d.ts +4 -1
- package/dist/dom/features/context/full.js +72 -15
- package/dist/dom/features/context/full.js.map +2 -2
- package/dist/dom/features/context/index.d.ts +1 -1
- package/dist/dom/features/context/index.js +2 -2
- package/dist/dom/features/context/stub.d.ts +4 -1
- package/dist/dom/features/context/stub.js +17 -8
- package/dist/dom/features/context/stub.js.map +2 -2
- package/dist/dom/features/forward-ref/full.js +12 -21
- package/dist/dom/features/forward-ref/full.js.map +2 -2
- package/dist/dom/features/forward-ref/index.d.ts +1 -1
- package/dist/dom/features/forward-ref/index.js +2 -2
- package/dist/dom/features/forward-ref/stub.js +4 -4
- package/dist/dom/features/fragment-refs/index.d.ts +1 -0
- package/dist/dom/features/fragment-refs/index.js +8 -0
- package/dist/dom/features/fragment-refs/index.js.map +7 -0
- package/dist/dom/features/fragment-refs/stub.d.ts +3 -0
- package/dist/dom/features/fragment-refs/stub.js +14 -0
- package/dist/dom/features/fragment-refs/stub.js.map +7 -0
- package/dist/dom/features/hydration/full.d.ts +11 -6
- package/dist/dom/features/hydration/full.js +76 -77
- package/dist/dom/features/hydration/full.js.map +2 -2
- package/dist/dom/features/hydration/index.d.ts +1 -1
- package/dist/dom/features/hydration/index.js +2 -2
- package/dist/dom/features/hydration/stub.d.ts +7 -2
- package/dist/dom/features/hydration/stub.js +1 -1
- package/dist/dom/features/hydration/stub.js.map +1 -1
- package/dist/dom/features/index.d.ts +8 -7
- package/dist/dom/features/index.js +9 -8
- package/dist/dom/features/index.js.map +2 -2
- package/dist/dom/features/lazy/full.js +4 -4
- package/dist/dom/features/lazy/index.d.ts +1 -1
- package/dist/dom/features/lazy/index.js +2 -2
- package/dist/dom/features/lazy/stub.js +4 -4
- package/dist/dom/features/memo/full.js +8 -6
- package/dist/dom/features/memo/full.js.map +2 -2
- package/dist/dom/features/memo/index.d.ts +1 -1
- package/dist/dom/features/memo/index.js +2 -2
- package/dist/dom/features/memo/stub.js +4 -4
- package/dist/dom/features/portal/full.js +4 -4
- package/dist/dom/features/portal/index.d.ts +1 -1
- package/dist/dom/features/portal/index.js +2 -2
- package/dist/dom/features/portal/stub.js +4 -4
- package/dist/dom/features/suspense/full.js +197 -52
- package/dist/dom/features/suspense/full.js.map +2 -2
- package/dist/dom/features/suspense/index.d.ts +1 -1
- package/dist/dom/features/suspense/index.js +2 -2
- package/dist/dom/features/suspense/stub.js +4 -4
- package/dist/dom/features/view-transition/full.d.ts +6 -0
- package/dist/dom/features/view-transition/full.js +280 -0
- package/dist/dom/features/view-transition/full.js.map +7 -0
- package/dist/dom/features/view-transition/index.d.ts +1 -0
- package/dist/dom/features/view-transition/index.js +3 -0
- package/dist/dom/features/view-transition/index.js.map +7 -0
- package/dist/dom/features/view-transition/resources.d.ts +11 -0
- package/dist/dom/features/view-transition/resources.js +108 -0
- package/dist/dom/features/view-transition/resources.js.map +7 -0
- package/dist/dom/features/view-transition/stub.d.ts +6 -0
- package/dist/dom/features/view-transition/stub.js +22 -0
- package/dist/dom/features/view-transition/stub.js.map +7 -0
- package/dist/dom/features/view-transition/visual.d.ts +14 -0
- package/dist/dom/features/view-transition/visual.js +356 -0
- package/dist/dom/features/view-transition/visual.js.map +7 -0
- package/dist/dom/fragment-instance.d.ts +40 -0
- package/dist/dom/fragment-instance.js +324 -0
- package/dist/dom/fragment-instance.js.map +7 -0
- package/dist/dom/index.d.ts +11 -11
- package/dist/dom/index.js +11 -18
- package/dist/dom/index.js.map +3 -3
- package/dist/dom/portal.d.ts +2 -2
- package/dist/dom/portal.js +2 -2
- package/dist/dom/portal.js.map +1 -1
- package/dist/dom/reconcile.d.ts +32 -3
- package/dist/dom/reconcile.js +689 -221
- package/dist/dom/reconcile.js.map +2 -2
- package/dist/dom/resource-hints.d.ts +6 -0
- package/dist/dom/resource-hints.js +115 -0
- package/dist/dom/resource-hints.js.map +7 -0
- package/dist/dom/resource-store.d.ts +13 -0
- package/dist/dom/resource-store.js +43 -0
- package/dist/dom/resource-store.js.map +7 -0
- package/dist/dom/resources.d.ts +1 -0
- package/dist/dom/resources.js +44 -0
- package/dist/dom/resources.js.map +7 -0
- package/dist/dom/retained-effects.d.ts +6 -0
- package/dist/dom/retained-effects.js +49 -0
- package/dist/dom/retained-effects.js.map +7 -0
- package/dist/dom/root-internal.d.ts +4 -4
- package/dist/dom/root-internal.js +2 -2
- package/dist/dom/root-internal.js.map +2 -2
- package/dist/dom/root.d.ts +5 -5
- package/dist/dom/root.js +11 -11
- package/dist/dom/root.js.map +2 -2
- package/dist/dom/test-utils.js +1 -1
- package/dist/react/activity.d.ts +7 -0
- package/dist/react/activity.js +8 -0
- package/dist/react/activity.js.map +7 -0
- package/dist/react/children.d.ts +1 -1
- package/dist/react/children.js +3 -3
- package/dist/react/children.js.map +1 -1
- package/dist/react/class.d.ts +1 -1
- package/dist/react/class.js +3 -3
- package/dist/react/class.js.map +1 -1
- package/dist/react/compiler-runtime.js +2 -2
- package/dist/react/context.d.ts +7 -2
- package/dist/react/context.js +3 -11
- package/dist/react/context.js.map +3 -3
- package/dist/react/element.d.ts +6 -3
- package/dist/react/element.js +7 -11
- package/dist/react/element.js.map +2 -2
- package/dist/react/hooks.d.ts +26 -7
- package/dist/react/hooks.js +13 -3
- package/dist/react/hooks.js.map +2 -2
- package/dist/react/index.d.ts +39 -24
- package/dist/react/index.js +39 -19
- package/dist/react/index.js.map +3 -3
- package/dist/react/jsx-runtime.d.ts +2 -2
- package/dist/react/jsx-runtime.js +3 -3
- package/dist/react/memo.d.ts +1 -1
- package/dist/react/memo.js +1 -1
- package/dist/react/portal.js +1 -1
- package/dist/react/shared-internals.d.ts +15 -5
- package/dist/react/shared-internals.js +2 -3
- package/dist/react/shared-internals.js.map +2 -2
- package/dist/react/suspense.js +1 -1
- package/dist/react/view-transition.d.ts +32 -0
- package/dist/react/view-transition.js +13 -0
- package/dist/react/view-transition.js.map +7 -0
- package/dist/scheduler/index.js +1 -1
- package/dist/server/bootstrap-script.d.ts +1 -23
- package/dist/server/bootstrap-script.js +7 -6
- package/dist/server/bootstrap-script.js.map +2 -2
- package/dist/server/dispatcher.d.ts +28 -6
- package/dist/server/dispatcher.js +33 -15
- package/dist/server/dispatcher.js.map +2 -2
- package/dist/server/escape.js +16 -15
- package/dist/server/escape.js.map +2 -2
- package/dist/server/index.d.ts +6 -6
- package/dist/server/index.js +7 -7
- package/dist/server/renderToString.d.ts +1 -1
- package/dist/server/renderToString.js +12 -8
- package/dist/server/renderToString.js.map +2 -2
- package/dist/server/resource-hints.d.ts +22 -0
- package/dist/server/resource-hints.js +148 -0
- package/dist/server/resource-hints.js.map +7 -0
- package/dist/server/stream.d.ts +15 -2
- package/dist/server/stream.js +155 -63
- package/dist/server/stream.js.map +2 -2
- package/dist/server/walk.d.ts +15 -2
- package/dist/server/walk.js +150 -110
- package/dist/server/walk.js.map +2 -2
- package/dist/vite/index.d.ts +6 -0
- package/dist/vite/index.js +22 -6
- package/dist/vite/index.js.map +2 -2
- package/package.json +1 -1
- package/src/core/attributes.ts +1 -0
- package/src/core/browser.ts +33 -0
- package/src/core/internal.ts +24 -6
- package/src/core/resource-hints.ts +36 -0
- package/src/dom/_all.ts +1 -7
- package/src/dom/commit.ts +186 -0
- package/src/dom/dispatcher.ts +190 -134
- package/src/dom/dom.ts +70 -54
- package/src/dom/error-info.ts +15 -0
- package/src/dom/features/activity/full.ts +166 -0
- package/src/dom/features/activity/index.ts +1 -0
- package/src/dom/features/activity/stub.ts +14 -0
- package/src/dom/features/class/full.ts +72 -28
- package/src/dom/features/context/full.ts +70 -13
- package/src/dom/features/context/stub.ts +10 -5
- package/src/dom/features/forward-ref/full.ts +9 -19
- package/src/dom/features/fragment-refs/index.ts +1 -0
- package/src/dom/features/fragment-refs/stub.ts +3 -0
- package/src/dom/features/hydration/full.ts +84 -85
- package/src/dom/features/hydration/stub.ts +1 -1
- package/src/dom/features/index.ts +1 -0
- package/src/dom/features/memo/full.ts +4 -3
- package/src/dom/features/suspense/full.ts +192 -55
- package/src/dom/features/view-transition/full.ts +288 -0
- package/src/dom/features/view-transition/index.ts +1 -0
- package/src/dom/features/view-transition/resources.ts +107 -0
- package/src/dom/features/view-transition/stub.ts +7 -0
- package/src/dom/features/view-transition/visual.ts +406 -0
- package/src/dom/fragment-instance.ts +337 -0
- package/src/dom/index.ts +6 -7
- package/src/dom/portal.ts +1 -1
- package/src/dom/reconcile.ts +695 -242
- package/src/dom/resource-hints.ts +115 -0
- package/src/dom/resource-store.ts +52 -0
- package/src/dom/resources.ts +39 -0
- package/src/dom/retained-effects.ts +38 -0
- package/src/dom/root-internal.ts +4 -4
- package/src/dom/root.ts +12 -14
- package/src/react/activity.ts +10 -0
- package/src/react/context.ts +4 -11
- package/src/react/element.ts +11 -12
- package/src/react/hooks.ts +12 -3
- package/src/react/index.ts +18 -0
- package/src/react/shared-internals.ts +3 -3
- package/src/react/view-transition.ts +41 -0
- package/src/server/bootstrap-script.ts +36 -5
- package/src/server/dispatcher.ts +35 -13
- package/src/server/escape.ts +15 -12
- package/src/server/renderToString.ts +7 -5
- package/src/server/resource-hints.ts +165 -0
- package/src/server/stream.ts +154 -62
- package/src/server/walk.ts +79 -26
- package/src/vite/index.ts +30 -13
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/dom/features/fragment-refs/stub.ts"],
|
|
4
|
+
"sourcesContent": ["export function createFragmentInstance(_fiber: unknown): any { return null }\nexport function updateFragmentHost(_fiber: unknown, _adding: boolean): void {}\nexport function refreshFragmentInstances(_root: unknown): void {}\n"],
|
|
5
|
+
"mappings": ";AAAO,SAAS,uBAAuB,QAAsB;AAAE,SAAO;AAAK;AACpE,SAAS,mBAAmB,QAAiB,SAAwB;AAAC;AACtE,SAAS,yBAAyB,OAAsB;AAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Fiber, type FiberRoot, type ReactNode } from
|
|
2
|
-
import { drainReplayQueue } from
|
|
1
|
+
import { type Fiber, type FiberRoot, type ReactNode } from "../../../core/index.js";
|
|
2
|
+
import { drainReplayQueue } from "../../event-replay.js";
|
|
3
3
|
export { drainReplayQueue };
|
|
4
4
|
/**
|
|
5
5
|
* Preserve the user's scroll position across hydration. If the user scrolled
|
|
@@ -42,9 +42,9 @@ export declare function isHydrationBailout(error: unknown): error is HydrationBa
|
|
|
42
42
|
export declare function abortHydration(cause: unknown, fiber?: Fiber | null): never;
|
|
43
43
|
interface HydrateRootOptions {
|
|
44
44
|
identifierPrefix?: string;
|
|
45
|
-
onRecoverableError?: (
|
|
46
|
-
onCaughtError?: (
|
|
47
|
-
onUncaughtError?: (
|
|
45
|
+
onRecoverableError?: import("../../../core/index.js").RecoverableErrorHandler;
|
|
46
|
+
onCaughtError?: import("../../../core/index.js").RecoverableErrorHandler;
|
|
47
|
+
onUncaughtError?: import("../../../core/index.js").RecoverableErrorHandler;
|
|
48
48
|
}
|
|
49
49
|
interface HydratedRoot {
|
|
50
50
|
render(children: ReactNode): void;
|
|
@@ -58,7 +58,12 @@ export declare function endHydration(root: FiberRoot): void;
|
|
|
58
58
|
* marker emitted by the server. Returns info + advances the cursor past the
|
|
59
59
|
* marker pair (start comment + fallback/real content + end comment).
|
|
60
60
|
*/
|
|
61
|
-
export type BoundaryInfo = [
|
|
61
|
+
export type BoundaryInfo = [
|
|
62
|
+
0 | 1 | 2 | 3,
|
|
63
|
+
number,
|
|
64
|
+
Comment,
|
|
65
|
+
Comment
|
|
66
|
+
];
|
|
62
67
|
export declare function tryConsumeBoundary(parent: Fiber): BoundaryInfo | null;
|
|
63
68
|
export declare function advanceCursorPast(parent: Fiber, node: Node): void;
|
|
64
69
|
export declare function getHydrationCursor(hostFiber: Fiber): HydrationCursor | undefined;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/dom/features/hydration/full.ts
|
|
2
2
|
import {
|
|
3
3
|
FiberTag,
|
|
4
4
|
REACT_ELEMENT_TYPE
|
|
5
|
-
} from "../../../core";
|
|
6
|
-
import { attributeName, STRING_BOOLEAN_ATTRS } from "../../../core/attributes";
|
|
7
|
-
import { createHostNode, setProp } from "../../dom";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
} from "../../../core/index.js";
|
|
6
|
+
import { attributeName, STRING_BOOLEAN_ATTRS } from "../../../core/attributes.js";
|
|
7
|
+
import { createHostNode, setProp, syncTextareaValue } from "../../dom.js";
|
|
8
|
+
import { queueMutation, queueProp, queueText } from "../../commit.js";
|
|
9
|
+
import { drainReplayQueue } from "../../event-replay.js";
|
|
10
|
+
import { discardPendingWork, discardPendingEffects, findRoot, flushSyncWork, renderRoot, scheduleRootRender, recoverRootError, unmountFiber } from "../../reconcile.js";
|
|
11
|
+
import { attachRootFiber, createFiberRoot } from "../../root-internal.js";
|
|
12
|
+
import { componentStack } from "../../error-info.js";
|
|
11
13
|
function installHydrationScrollGuard() {
|
|
12
14
|
if (typeof window === "undefined") return;
|
|
13
15
|
const w = window;
|
|
@@ -122,7 +124,7 @@ function hydrateRootImpl(container, initialChildren, options) {
|
|
|
122
124
|
drainReplayQueue();
|
|
123
125
|
return {
|
|
124
126
|
render(children) {
|
|
125
|
-
|
|
127
|
+
scheduleRootRender(root, () => {
|
|
126
128
|
const normalized = isDocument ? normalizeDocumentChildren(children) : children;
|
|
127
129
|
renderRoot(
|
|
128
130
|
root,
|
|
@@ -150,12 +152,15 @@ function headAttrsMatch(el, props, keys) {
|
|
|
150
152
|
if (!keys) return true;
|
|
151
153
|
for (const k of keys) {
|
|
152
154
|
const propVal = props[k];
|
|
153
|
-
const elVal = el
|
|
155
|
+
const elVal = hydrationAttribute(el, attributeName(k));
|
|
154
156
|
if (propVal == null && elVal == null) continue;
|
|
155
157
|
if (propVal == null || elVal == null || String(propVal) !== elVal) return false;
|
|
156
158
|
}
|
|
157
159
|
return true;
|
|
158
160
|
}
|
|
161
|
+
function hydrationAttribute(el, name) {
|
|
162
|
+
return name === "nonce" && "nonce" in el && el.hasAttribute(name) ? el.nonce ?? "" : el.getAttribute(name);
|
|
163
|
+
}
|
|
159
164
|
function beginHydration(root) {
|
|
160
165
|
root.ic = 0;
|
|
161
166
|
root.h = true;
|
|
@@ -171,16 +176,23 @@ function tryConsumeBoundary(parent) {
|
|
|
171
176
|
const peek = cursor.n;
|
|
172
177
|
if (!peek || peek.nodeType !== 8) return null;
|
|
173
178
|
const data = peek.data;
|
|
174
|
-
const m = /^(
|
|
179
|
+
const m = /^(\$[?!E]?)(\d+)$/.exec(data);
|
|
175
180
|
if (!m) return null;
|
|
176
|
-
const kind = m[1] === "$?" ? 1 : 0;
|
|
181
|
+
const kind = m[1] === "$?" ? 1 : m[1] === "$!" ? 2 : m[1] === "$E" ? 3 : 0;
|
|
177
182
|
const id = Number(m[2]);
|
|
178
183
|
const startMark = peek;
|
|
179
184
|
cursor.n = startMark.nextSibling;
|
|
180
185
|
let endMark = null;
|
|
181
186
|
let scan = startMark.nextSibling;
|
|
187
|
+
let depth = 0;
|
|
182
188
|
while (scan) {
|
|
189
|
+
if (scan.nodeType === 8 && /^\$[?!E]?\d+$/.test(scan.data)) depth++;
|
|
183
190
|
if (scan.nodeType === 8 && scan.data === "/$") {
|
|
191
|
+
if (depth) {
|
|
192
|
+
depth--;
|
|
193
|
+
scan = scan.nextSibling;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
184
196
|
endMark = scan;
|
|
185
197
|
break;
|
|
186
198
|
}
|
|
@@ -236,15 +248,29 @@ function adoptHostDom(fiber, parent) {
|
|
|
236
248
|
const isSvg = tag === "svg" || candidate.namespaceURI === "http://www.w3.org/2000/svg" && tag !== "foreignobject";
|
|
237
249
|
const syncHydrationProps = !props.suppressHydrationWarning && canRecoverHydrationPropMismatch(candidate, tag);
|
|
238
250
|
validateHydrationProps(fiber, candidate, props, tag, isSvg);
|
|
251
|
+
if (tag === "input" || tag === "textarea") queueHydrationFormState(candidate, props, tag);
|
|
239
252
|
for (const k in props) {
|
|
240
|
-
if (k
|
|
241
|
-
if (syncHydrationProps || k[0] === "o" && k[1] === "n" && typeof props[k] == "function") {
|
|
242
|
-
setProp(candidate, k, props[k], void 0, isSvg);
|
|
243
|
-
}
|
|
253
|
+
if (syncHydrationProps && k !== "children" && k !== "key" && k !== "ref" && (k !== "nonce" || hydrationAttribute(candidate, k) !== props[k]) && k !== "suppressHydrationWarning" && k !== "suppressContentEditableWarning" && !isHydrationFormProp(tag, k) || k[0] === "o" && k[1] === "n" && typeof props[k] == "function") queueProp(candidate, k, props[k], void 0, isSvg);
|
|
244
254
|
}
|
|
245
255
|
hydrationCursors.set(fiber, new HydrationCursor(candidate));
|
|
246
256
|
return true;
|
|
247
257
|
}
|
|
258
|
+
function queueHydrationFormState(el, props, tag) {
|
|
259
|
+
queueMutation(() => {
|
|
260
|
+
if (tag === "input") {
|
|
261
|
+
const input = el;
|
|
262
|
+
if (props.type != null) input.type = props.type;
|
|
263
|
+
const value = props.value ?? props.defaultValue;
|
|
264
|
+
if (value != null && (props.value != null || input.type !== "submit" && input.type !== "reset")) {
|
|
265
|
+
input.defaultValue = "" + value;
|
|
266
|
+
}
|
|
267
|
+
input.checked = input.checked;
|
|
268
|
+
input.defaultChecked = !!(props.checked ?? props.defaultChecked);
|
|
269
|
+
} else {
|
|
270
|
+
syncTextareaValue(el, props, true);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
248
274
|
function adoptTextDom(fiber, parent, text) {
|
|
249
275
|
const cursor = hydrationCursors.get(findHostParent(parent));
|
|
250
276
|
if (!cursor) return false;
|
|
@@ -257,14 +283,13 @@ function adoptTextDom(fiber, parent, text) {
|
|
|
257
283
|
if (candidate.data !== text) {
|
|
258
284
|
const recovered = failHydration(
|
|
259
285
|
fiber,
|
|
260
|
-
|
|
286
|
+
process.env.NODE_ENV !== "production" ? new Error(
|
|
261
287
|
`Hydration text mismatch: expected "${text}" but found "${candidate.data}".`
|
|
262
288
|
) : void 0,
|
|
263
289
|
canRecoverHydrationPropMismatch(candidate)
|
|
264
290
|
);
|
|
265
291
|
if (recovered) {
|
|
266
|
-
;
|
|
267
|
-
candidate.data = text;
|
|
292
|
+
queueText(candidate, text);
|
|
268
293
|
}
|
|
269
294
|
}
|
|
270
295
|
fiber.dom = candidate;
|
|
@@ -282,7 +307,7 @@ function findHostParent(fiber) {
|
|
|
282
307
|
}
|
|
283
308
|
f = f.parent;
|
|
284
309
|
}
|
|
285
|
-
if (
|
|
310
|
+
if (process.env.NODE_ENV !== "production") {
|
|
286
311
|
throw new Error("No host parent found");
|
|
287
312
|
}
|
|
288
313
|
throw new Error();
|
|
@@ -290,7 +315,7 @@ function findHostParent(fiber) {
|
|
|
290
315
|
function onMismatch(fiber, actualNode) {
|
|
291
316
|
failHydration(
|
|
292
317
|
fiber,
|
|
293
|
-
|
|
318
|
+
process.env.NODE_ENV !== "production" ? new Error(
|
|
294
319
|
`Hydration mismatch: expected <${fiber.type ?? "text"}> but found ${actualNode ? actualNode.nodeType === 1 ? actualNode.tagName : "text" : "nothing"}.`
|
|
295
320
|
) : void 0
|
|
296
321
|
);
|
|
@@ -298,7 +323,7 @@ function onMismatch(fiber, actualNode) {
|
|
|
298
323
|
function failHydration(fiber, error = new Error(PROD_HYDRATION_ERROR), recoverInPlace = false) {
|
|
299
324
|
const root = findRoot(fiber);
|
|
300
325
|
if (root?.re) {
|
|
301
|
-
root.re(error);
|
|
326
|
+
root.re(error, { componentStack: componentStack(fiber) });
|
|
302
327
|
}
|
|
303
328
|
if (recoverInPlace) return true;
|
|
304
329
|
abortHydration(error, findHostRecoveryParent(fiber) ?? fiber);
|
|
@@ -367,31 +392,35 @@ function recoverHydration(root, error) {
|
|
|
367
392
|
flushSyncWork(() => renderRoot(root, children));
|
|
368
393
|
} catch (clientError) {
|
|
369
394
|
resetAfterHydrationFailure(root, container);
|
|
395
|
+
if (recoverRootError(clientError)) return true;
|
|
370
396
|
throw clientError;
|
|
371
397
|
}
|
|
372
398
|
return true;
|
|
373
399
|
}
|
|
374
400
|
function resetAfterHydrationFailure(root, container) {
|
|
375
|
-
unmountFiber(root.r, false);
|
|
401
|
+
unmountFiber(root.r, container, false);
|
|
376
402
|
discardPendingWork(root);
|
|
403
|
+
discardPendingEffects(root);
|
|
377
404
|
clearHydrationContainer(container);
|
|
378
405
|
attachRootFiber(root, container);
|
|
379
406
|
root.h = false;
|
|
380
407
|
}
|
|
381
408
|
function clearHydrationContainer(container) {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
409
|
+
queueMutation(() => {
|
|
410
|
+
if (container.nodeType === 9) {
|
|
411
|
+
let node = container.firstChild;
|
|
412
|
+
while (node) {
|
|
413
|
+
const next = node.nextSibling;
|
|
414
|
+
if (node.nodeType !== 10) {
|
|
415
|
+
container.removeChild(node);
|
|
416
|
+
}
|
|
417
|
+
node = next;
|
|
388
418
|
}
|
|
389
|
-
|
|
419
|
+
return;
|
|
390
420
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
;
|
|
394
|
-
container.textContent = "";
|
|
421
|
+
;
|
|
422
|
+
container.textContent = "";
|
|
423
|
+
});
|
|
395
424
|
}
|
|
396
425
|
function getRecoverableHostChildren(error) {
|
|
397
426
|
const host = error.f;
|
|
@@ -490,6 +519,9 @@ function createHostElement(type, props) {
|
|
|
490
519
|
props
|
|
491
520
|
};
|
|
492
521
|
}
|
|
522
|
+
function isHydrationFormProp(tag, key) {
|
|
523
|
+
return (tag === "input" || tag === "textarea" || tag === "select") && (key === "value" || key === "defaultValue") || tag === "input" && (key === "checked" || key === "defaultChecked") || tag === "option" && key === "selected";
|
|
524
|
+
}
|
|
493
525
|
function validateHydrationProps(fiber, el, props, tag, isSvg) {
|
|
494
526
|
if (props.suppressHydrationWarning) return;
|
|
495
527
|
const recoverInPlace = canRecoverHydrationPropMismatch(el, tag);
|
|
@@ -498,58 +530,23 @@ function validateHydrationProps(fiber, el, props, tag, isSvg) {
|
|
|
498
530
|
const value = props[k];
|
|
499
531
|
if (k === "children" || k === "key" || k === "ref" || k === "suppressHydrationWarning" || k === "suppressContentEditableWarning" || k[0] === "o" && k[1] === "n" && typeof value == "function") continue;
|
|
500
532
|
if (k === "dangerouslySetInnerHTML") {
|
|
501
|
-
let html =
|
|
533
|
+
let html = value?.__html;
|
|
534
|
+
if (html == null) continue;
|
|
502
535
|
if (tag !== "script" && tag !== "style") {
|
|
503
|
-
const probe =
|
|
536
|
+
const probe = createHostNode(tag, isSvg);
|
|
504
537
|
probe.innerHTML = html;
|
|
505
538
|
html = probe.innerHTML;
|
|
506
539
|
}
|
|
507
|
-
if (el.innerHTML !== html) {
|
|
508
|
-
failHydration(
|
|
509
|
-
fiber,
|
|
510
|
-
true ? new Error(`Hydration HTML mismatch inside <${tag}>.`) : void 0,
|
|
511
|
-
recoverInPlace
|
|
512
|
-
);
|
|
513
|
-
}
|
|
514
|
-
continue;
|
|
515
|
-
}
|
|
516
|
-
if (k === "value" || k === "defaultValue") {
|
|
517
|
-
if (tag === "select") continue;
|
|
518
|
-
if (tag === "input" || tag === "textarea") {
|
|
519
|
-
if (k === "value" || props.value == null) {
|
|
520
|
-
if (value != null && el.value !== "" + value) {
|
|
521
|
-
failHydration(
|
|
522
|
-
fiber,
|
|
523
|
-
true ? new Error(`Hydration ${tag} value mismatch on <${tag}>.`) : void 0,
|
|
524
|
-
recoverInPlace
|
|
525
|
-
);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
continue;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
if (tag === "input" && (k === "checked" || k === "defaultChecked")) {
|
|
532
|
-
if (k === "checked" || props.checked == null) {
|
|
533
|
-
if (value != null && el.checked !== !!value) {
|
|
534
|
-
failHydration(
|
|
535
|
-
fiber,
|
|
536
|
-
true ? new Error(`Hydration checked mismatch on <input>.`) : void 0,
|
|
537
|
-
recoverInPlace
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
continue;
|
|
542
|
-
}
|
|
543
|
-
if (tag === "option" && k === "selected") {
|
|
544
|
-
if (value != null && el.selected !== !!value) {
|
|
540
|
+
if (el.innerHTML !== "" + html) {
|
|
545
541
|
failHydration(
|
|
546
542
|
fiber,
|
|
547
|
-
|
|
543
|
+
process.env.NODE_ENV !== "production" ? new Error(`Hydration HTML mismatch inside <${tag}>.`) : void 0,
|
|
548
544
|
recoverInPlace
|
|
549
545
|
);
|
|
550
546
|
}
|
|
551
547
|
continue;
|
|
552
548
|
}
|
|
549
|
+
if (isHydrationFormProp(tag, k)) continue;
|
|
553
550
|
if (k === "style") {
|
|
554
551
|
expected ??= createHostNode(tag, isSvg);
|
|
555
552
|
setProp(expected, k, value, void 0, isSvg);
|
|
@@ -559,7 +556,7 @@ function validateHydrationProps(fiber, el, props, tag, isSvg) {
|
|
|
559
556
|
)) {
|
|
560
557
|
failHydration(
|
|
561
558
|
fiber,
|
|
562
|
-
|
|
559
|
+
process.env.NODE_ENV !== "production" ? new Error(`Hydration style mismatch on <${tag}>.`) : void 0,
|
|
563
560
|
recoverInPlace
|
|
564
561
|
);
|
|
565
562
|
}
|
|
@@ -572,16 +569,18 @@ function validateHydrationProps(fiber, el, props, tag, isSvg) {
|
|
|
572
569
|
expectedValue = null;
|
|
573
570
|
} else if (k === "muted" && !isSvg && (tag === "video" || tag === "audio")) {
|
|
574
571
|
expectedValue = value ? "" : null;
|
|
572
|
+
} else if (stringifiedBoolean && k.length > 5) {
|
|
573
|
+
expectedValue = "" + value;
|
|
575
574
|
} else {
|
|
576
575
|
expected ??= createHostNode(tag, isSvg);
|
|
577
576
|
setProp(expected, k, value, void 0, isSvg);
|
|
578
577
|
expectedValue = expected.getAttribute(attr);
|
|
579
578
|
}
|
|
580
|
-
const actualValue = el
|
|
579
|
+
const actualValue = hydrationAttribute(el, attr);
|
|
581
580
|
if (expectedValue !== actualValue) {
|
|
582
581
|
failHydration(
|
|
583
582
|
fiber,
|
|
584
|
-
|
|
583
|
+
process.env.NODE_ENV !== "production" ? new Error(
|
|
585
584
|
`Hydration attribute mismatch on <${tag}> for "${attr}": expected ${formatHydrationValue(expectedValue)} but found ${formatHydrationValue(actualValue)}.`
|
|
586
585
|
) : void 0,
|
|
587
586
|
recoverInPlace
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/dom/features/hydration/full.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n FiberTag,\n REACT_ELEMENT_TYPE,\n type Fiber,\n type FiberRoot,\n type ReactElement,\n type ReactNode,\n} from '../../../core'\nimport { attributeName, STRING_BOOLEAN_ATTRS } from '../../../core/attributes'\nimport { createHostNode, setProp } from '../../dom'\nimport { drainReplayQueue } from '../../event-replay'\nimport { discardPendingWork, findRoot, flushSyncWork, renderRoot, unmountFiber } from '../../reconcile'\nimport { attachRootFiber, createFiberRoot } from '../../root-internal'\n\n// Re-export from event-replay so all hydration concerns live behind one\n// feature boundary \u2014 the plugin's stub swap strips drainReplayQueue too.\nexport { drainReplayQueue }\n\n/**\n * Preserve the user's scroll position across hydration. If the user scrolled\n * between SSR paint and hydrate (common in dev where JS takes seconds to\n * load), libraries that wire scroll-restoration into a `useLayoutEffect`\n * near the root (e.g. TanStack Router) will run during our synchronous\n * hydrate and call `window.scrollTo(savedFromLastVisit)` \u2014 overwriting the\n * user's fresh scroll. We install a short-lived wrapper around scrollTo that\n * suppresses programmatic calls when a user-initiated scroll happened\n * recently. Only runs in the hydration feature \u2014 the stub skips it.\n */\nexport function installHydrationScrollGuard(): void {\n if (typeof window === 'undefined') return\n const w = window as any\n if (w._r) return\n const time = Date.now\n const guardStartedAt = w._r = time()\n let lastUserScrollAt = 0\n let programmatic = false\n w.addEventListener(\n 'scroll',\n () => {\n if (!programmatic) {\n lastUserScrollAt = time()\n }\n },\n { capture: true, passive: true },\n )\n const origScrollTo = w.scrollTo\n w.scrollTo = function (...args: any[]) {\n const now = time()\n if (\n now - guardStartedAt < 3000 &&\n now - lastUserScrollAt < 1500\n ) {\n return\n }\n programmatic = true\n try {\n return (origScrollTo as any).apply(w, args)\n } finally {\n queueMicrotask(() => {\n programmatic = false\n })\n }\n }\n}\n\n/**\n * Hydration cursor: walks existing DOM children in document order so we can\n * adopt them during fiber tree construction. One cursor per host parent.\n *\n * `endBefore` scopes the cursor to a subrange \u2014 used by rehydrateBoundary()\n * so we only adopt DOM up to the closing `/$` marker for that boundary.\n */\nexport class HydrationCursor {\n n: ChildNode | null\n p: Node\n e: ChildNode | null\n constructor(parent: Node, start: ChildNode | null = null, endBefore: ChildNode | null = null) {\n this.p = parent\n this.n = start ?? parent.firstChild\n this.e = endBefore\n }\n take(): ChildNode | null {\n while (this.n && this.n !== this.e) {\n const n = this.n\n // Skip anything that isn't an element (1) or text (3):\n // comments (8), doctype (10), processing instructions (7), cdata (4).\n if (n.nodeType !== 1 && n.nodeType !== 3) {\n this.n = n.nextSibling\n continue\n }\n this.n = n.nextSibling\n return n\n }\n return null\n }\n /**\n * Position-insensitive lookup for head/html adoption. Scans forward past\n * non-matching nodes without removing them, matching by tag AND the key\n * attributes that identify head elements uniquely (rel/href for links,\n * name/property for meta, src for script). Non-matching nodes stay in\n * place so the SSR'd stylesheet/script order is preserved.\n */\n head(tag: string, props: Record<string, any>): ChildNode | null {\n const target = tag.toLowerCase()\n const keyAttrs = HEAD_KEY_ATTRS[target]\n let scan = this.p.firstChild\n while (scan) {\n if (\n scan.nodeType === 1 &&\n (scan as Element).tagName.toLowerCase() === target &&\n headAttrsMatch(scan as Element, props, keyAttrs)\n ) {\n CLAIMED.add(scan)\n return scan\n }\n scan = scan.nextSibling\n }\n return null\n }\n has(): boolean {\n let n = this.n\n while (n && n !== this.e) {\n if (n.nodeType === 1 || n.nodeType === 3) return true\n n = n.nextSibling\n }\n return false\n }\n}\n\nconst hydrationCursors = new WeakMap<Fiber, HydrationCursor>()\nconst PROD_HYDRATION_ERROR = 'Hydration mismatch.'\n\nexport interface HydrationBailoutError extends Error {\n f: Fiber | null\n}\n\nexport function isHydrationBailout(error: unknown): error is HydrationBailoutError {\n return !!error && (error as any).f !== undefined\n}\n\nexport function abortHydration(cause: unknown, fiber: Fiber | null = null): never {\n const error = (cause instanceof Error ? cause : new Error(PROD_HYDRATION_ERROR)) as HydrationBailoutError\n ;(error as any).f = fiber\n throw error\n}\n\ninterface HydrateRootOptions {\n identifierPrefix?: string\n onRecoverableError?: (error: unknown) => void\n onCaughtError?: (error: unknown) => void\n onUncaughtError?: (error: unknown) => void\n}\n\ninterface HydratedRoot {\n render(children: ReactNode): void\n unmount(): void\n}\n\nexport function hydrateRootImpl(\n container: Element | Document,\n initialChildren: ReactNode,\n options: HydrateRootOptions,\n): HydratedRoot {\n const target = container as any as Element | Document\n const isDocument = (container as Node).nodeType === 9\n const body = isDocument ? (target as Document).body : null\n const root = createFiberRoot(target, options)\n\n installHydrationScrollGuard()\n\n const normalizedInitialChildren =\n isDocument ? normalizeDocumentChildren(initialChildren) : initialChildren\n let hydrationError: unknown = null\n beginHydration(root)\n try {\n flushSyncWork(() => {\n renderRoot(root, normalizedInitialChildren)\n })\n } catch (e) {\n hydrationError = e\n }\n endHydration(root)\n\n if (hydrationError && !recoverHydration(root, hydrationError)) throw hydrationError\n drainReplayQueue()\n\n return {\n render(children) {\n flushSyncWork(() => {\n const normalized = isDocument ? normalizeDocumentChildren(children) : children\n renderRoot(\n root,\n root.c === body ? getStaticDocumentBodyChildren(normalized) ?? normalized : normalized,\n )\n })\n },\n unmount() {\n flushSyncWork(() => {\n renderRoot(root, null)\n })\n },\n }\n}\n\n// Head elements that we match against server DOM by attribute signature.\nconst HEAD_KEY_ATTRS: Record<string, ReadonlyArray<string>> = {\n link: ['rel', 'href', 'sizes', 'type'],\n meta: ['name', 'property', 'charSet', 'httpEquiv'],\n script: ['src', 'type'],\n style: ['id', 'media', 'nonce', 'title'],\n}\n\nconst DOCUMENT_HEAD_TAGS = new Set(['base', 'link', 'meta', 'script', 'style', 'title'])\n\n// DOM elements already claimed by some fiber during this hydration pass.\nconst CLAIMED = new WeakSet<Node>()\n\nfunction headAttrsMatch(\n el: Element,\n props: Record<string, any>,\n keys: ReadonlyArray<string> | undefined,\n): boolean {\n if (CLAIMED.has(el)) return false\n if (!keys) return true\n for (const k of keys) {\n const propVal = props[k]\n const elVal = el.getAttribute(attributeName(k))\n if (propVal == null && elVal == null) continue\n if (propVal == null || elVal == null || String(propVal) !== elVal) return false\n }\n return true\n}\n\nexport function beginHydration(root: FiberRoot): void {\n root.ic = 0\n root.h = true\n hydrationCursors.set(root.r, new HydrationCursor(root.c))\n}\n\nexport function endHydration(root: FiberRoot): void {\n root.h = false\n hydrationCursors.delete(root.r)\n}\n\n/**\n * Inspect the current cursor position for a streaming-suspense boundary\n * marker emitted by the server. Returns info + advances the cursor past the\n * marker pair (start comment + fallback/real content + end comment).\n */\nexport type BoundaryInfo = [0 | 1, number, Comment, Comment]\n\nexport function tryConsumeBoundary(parent: Fiber): BoundaryInfo | null {\n const cursor = hydrationCursors.get(findHostParent(parent))\n if (!cursor) return null\n const peek = cursor.n\n if (!peek || peek.nodeType !== 8) return null\n const data = (peek as Comment).data\n const m = /^(\\$\\??)(\\d+)$/.exec(data)\n if (!m) return null\n const kind = m[1] === '$?' ? 1 : 0\n const id = Number(m[2])\n const startMark = peek as Comment\n // Advance past the start comment\n cursor.n = startMark.nextSibling\n // Locate end comment: closest <!--/$-->\n let endMark: Comment | null = null\n let scan = startMark.nextSibling\n while (scan) {\n if (scan.nodeType === 8 && (scan as Comment).data === '/$') {\n endMark = scan as Comment\n break\n }\n scan = scan.nextSibling\n }\n if (!endMark) return null\n return [kind, id, startMark, endMark]\n}\n\nexport function advanceCursorPast(parent: Fiber, node: Node): void {\n const cursor = hydrationCursors.get(findHostParent(parent))\n if (!cursor) return\n cursor.n = node.nextSibling\n}\n\nexport function getHydrationCursor(hostFiber: Fiber): HydrationCursor | undefined {\n return hydrationCursors.get(hostFiber)\n}\n\nexport function setHydrationCursor(hostFiber: Fiber, cursor: HydrationCursor): void {\n hydrationCursors.set(hostFiber, cursor)\n}\n\nexport function clearHydrationCursor(hostFiber: Fiber): void {\n hydrationCursors.delete(hostFiber)\n}\n\n/**\n * Try to adopt a DOM node for this host fiber. Returns true if adopted.\n * Attaches existing attrs/children via separate hydrate pass.\n */\nexport function adoptHostDom(fiber: Fiber, parent: Fiber): boolean {\n const hostParent = findHostParent(parent)\n const cursor = hydrationCursors.get(hostParent)\n if (!cursor) return false\n\n const tag = (fiber.type as string).toLowerCase()\n const documentHeadParent =\n cursor.p.nodeType === 9 && DOCUMENT_HEAD_TAGS.has(tag)\n ? (cursor.p as Document).head\n : null\n const parentEl = cursor.p as Element\n const parentTag =\n parentEl.nodeType === 1 ? (parentEl as Element).tagName.toLowerCase() : ''\n const isHeadish = parentTag === 'head' || parentTag === 'html' || !!documentHeadParent\n\n let candidate: ChildNode | null\n if (documentHeadParent) {\n // React 19 can project <meta>/<title>/<link> from anywhere in the tree into\n // document.head. Redact does not have that projection yet, so when a\n // document-root hydration pass sees a top-level head element, adopt it\n // from <head> rather than trying to append it beside <html>.\n candidate = new HydrationCursor(documentHeadParent).head(\n tag,\n fiber.pp ?? {},\n )\n } else if (isHeadish) {\n // Head/html children are position-insensitive \u2014 server may emit them in\n // a different order than the React tree (React 19 head hoisting, etc.).\n // Scan forward without removing non-matching nodes; match on attribute\n // signature so we don't adopt the wrong <link> and clobber its props.\n candidate = cursor.head(tag, fiber.pp ?? {})\n } else {\n candidate = cursor.take()\n }\n\n if (!candidate) {\n // Client expected a host here but the cursor is exhausted \u2014 server gave\n // fewer children than the client tree. Report the structural gap (React\n // fires `onRecoverableError` for this exact case) and let the reconciler\n // mount a fresh DOM for this fiber below.\n // Exception: <head> children are position-insensitive; a missing match\n // there means \"server didn't hoist this one yet\", which we silently mount.\n if (!isHeadish) onMismatch(fiber, null)\n return false\n }\n\n if (candidate.nodeType !== 1 || (candidate as Element).tagName.toLowerCase() !== tag) {\n // mismatch \u2014 log and re-render fresh from this point\n onMismatch(fiber, candidate)\n return false\n }\n fiber.dom = candidate\n // Apply props (attach events, sync IDL props). Don't re-set existing attrs.\n const props = fiber.pp ?? {}\n const isSvg =\n tag === 'svg' ||\n ((candidate as Element).namespaceURI === 'http://www.w3.org/2000/svg' &&\n tag !== 'foreignobject')\n const syncHydrationProps =\n !props.suppressHydrationWarning &&\n canRecoverHydrationPropMismatch(candidate, tag)\n validateHydrationProps(fiber, candidate as Element, props, tag, isSvg)\n for (const k in props) {\n if (\n k === 'children' ||\n k === 'key' ||\n k === 'ref' ||\n k === 'suppressHydrationWarning' ||\n k === 'suppressContentEditableWarning'\n ) continue\n if (\n syncHydrationProps ||\n (k[0] === 'o' && k[1] === 'n' && typeof props[k] == 'function')\n ) {\n setProp(candidate as Element, k, props[k], undefined, isSvg)\n }\n }\n // Set up child cursor for this host's children\n hydrationCursors.set(fiber, new HydrationCursor(candidate))\n return true\n}\n\nexport function adoptTextDom(fiber: Fiber, parent: Fiber, text: string): boolean {\n const cursor = hydrationCursors.get(findHostParent(parent))\n if (!cursor) return false\n const candidate = cursor.take()\n if (!candidate) {\n onMismatch(fiber, null)\n return false\n }\n if (candidate.nodeType === 3) {\n if ((candidate as Text).data !== text) {\n const recovered = failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(\n `Hydration text mismatch: expected \"${text}\" but found \"${(candidate as Text).data}\".`,\n )\n : undefined,\n canRecoverHydrationPropMismatch(candidate),\n )\n if (recovered) {\n ;(candidate as Text).data = text\n }\n }\n fiber.dom = candidate\n return true\n }\n onMismatch(fiber, candidate)\n return false\n}\n\nexport function findHostParent(fiber: Fiber): Fiber {\n let f: Fiber | null = fiber\n while (f) {\n // A fiber explicitly holding a cursor acts as a boundary for hydration\n // (e.g. Suspense with a scoped cursor during fallback/boundary hydration).\n if (hydrationCursors.has(f)) return f\n if (f.tag === FiberTag.Host || f.tag === FiberTag.Root || f.tag === FiberTag.Portal) {\n return f\n }\n f = f.parent\n }\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('No host parent found')\n }\n throw new Error()\n}\n\nfunction onMismatch(fiber: Fiber, actualNode: ChildNode | null): void {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(\n `Hydration mismatch: expected <${(fiber.type as string) ?? 'text'}> but found ${\n actualNode ? (actualNode.nodeType === 1 ? (actualNode as Element).tagName : 'text') : 'nothing'\n }.`,\n )\n : undefined,\n )\n}\n\nfunction failHydration(\n fiber: Fiber,\n error: Error = new Error(PROD_HYDRATION_ERROR),\n recoverInPlace = false,\n): boolean {\n const root = findRoot(fiber)\n if (root?.re) {\n root.re(error)\n }\n if (recoverInPlace) return true\n abortHydration(error, findHostRecoveryParent(fiber) ?? fiber)\n}\n\nfunction canRecoverHydrationPropMismatch(node: Node, tag?: string): boolean {\n return (\n tag === 'html' ||\n tag === 'head' ||\n tag === 'body' ||\n !!node.ownerDocument?.head?.contains(node)\n )\n}\n\nfunction findHostRecoveryParent(fiber: Fiber): Fiber | null {\n if (fiber.tag === FiberTag.Text) {\n let directHost = fiber.parent\n while (directHost && (directHost.tag !== FiberTag.Host || !directHost.dom)) {\n directHost = directHost.parent\n }\n if (!directHost) return null\n let hasEvent\n const props = directHost.pp ?? directHost.mp\n if (props) {\n for (const k in props) {\n if (k[0] === 'o' && k[1] === 'n' && typeof props[k] == 'function') {\n hasEvent = true\n }\n }\n }\n return findNearestSafeHostAboveComposite(\n hasEvent\n ? directHost.parent\n : directHost.parent?.tag === FiberTag.Host\n ? directHost.parent\n : directHost,\n )\n }\n\n return findNearestSafeHostAboveComposite(fiber.parent)\n}\n\nfunction findNearestSafeHostAboveComposite(fiber: Fiber | null): Fiber | null {\n let host: Fiber | null = null\n let f = fiber\n while (f) {\n if (f.tag === FiberTag.Host && f.dom) {\n if (!isSafeHostRecoveryElement(f)) return null\n const parentTag = f.parent?.tag as number\n if (!host || (parentTag > FiberTag.Text && parentTag < FiberTag.Suspense)) {\n host = f\n }\n }\n f = f.parent\n }\n return host\n}\n\nfunction isSafeHostRecoveryElement(fiber: Fiber): boolean {\n const tag = fiber.type.toLowerCase()\n return tag !== 'html' && tag !== 'head' && tag !== 'body'\n}\n\nexport function recoverHydration(root: FiberRoot, error: unknown): boolean {\n if (!isHydrationBailout(error)) return false\n\n let container = root.c as Element | Document\n let children = root.r.pp?.children ?? null\n const hostRecovery = getRecoverableHostChildren(error)\n if (hostRecovery) {\n container = hostRecovery[0]\n children = hostRecovery[1]\n } else if (container.nodeType === 9) {\n const bodyChildren = getRecoverableDocumentBodyChildren(error)\n if (bodyChildren != null) {\n container = (container as Document).body\n children = bodyChildren\n }\n }\n\n resetAfterHydrationFailure(root, container)\n try {\n flushSyncWork(() => renderRoot(root, children))\n } catch (clientError) {\n resetAfterHydrationFailure(root, container)\n throw clientError\n }\n return true\n}\n\nfunction resetAfterHydrationFailure(\n root: FiberRoot,\n container: Element | Document,\n): void {\n // Retire subscriptions and queued effects without removing the document shell\n // or host ancestors retained by the recovery container.\n unmountFiber(root.r, false)\n discardPendingWork(root)\n clearHydrationContainer(container)\n attachRootFiber(root, container)\n root.h = false\n}\n\nfunction clearHydrationContainer(container: Element | Document): void {\n if (container.nodeType === 9) {\n let node = container.firstChild\n while (node) {\n const next = node.nextSibling\n if (node.nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {\n container.removeChild(node)\n }\n node = next\n }\n return\n }\n ;(container as Element).textContent = ''\n}\n\nfunction getRecoverableHostChildren(\n error: HydrationBailoutError,\n): [Element, ReactNode] | null {\n const host = error.f\n if (\n host?.tag !== FiberTag.Host ||\n !host.dom ||\n !findNearestSafeHostAboveComposite(host.parent)\n ) {\n return null\n }\n return [host.dom as Element, (host.pp ?? host.mp)?.children ?? null]\n}\n\nfunction getRecoverableDocumentBodyChildren(error: HydrationBailoutError): ReactNode | null {\n const bodyFiber = findBodyAncestor(error.f)\n if (!bodyFiber) return null\n return (bodyFiber.pp ?? bodyFiber.mp)?.children ?? null\n}\n\nfunction findBodyAncestor(fiber: Fiber | null): Fiber | null {\n let f = fiber\n while (f) {\n if (f.tag === FiberTag.Host && f.type === 'body') {\n return f === fiber ? null : f\n }\n f = f.parent\n }\n return null\n}\n\nfunction getStaticDocumentBodyChildren(children: ReactNode): ReactNode | null {\n const list = toChildArray(children)\n const html = list.find((child) => isHostElement(child, 'html')) as ReactElement | undefined\n if (!html) return null\n const htmlChildren = toChildArray(html.props?.children)\n const body = htmlChildren.find((child) => isHostElement(child, 'body')) as ReactElement | undefined\n return body ? body.props?.children ?? null : null\n}\n\nfunction normalizeDocumentChildren(children: ReactNode): ReactNode {\n const list = toChildArray(children)\n const htmlIndex = list.findIndex((child) => isHostElement(child, 'html'))\n if (htmlIndex === -1) return children\n\n const headNodes = list.filter(isHeadElement)\n if (headNodes.length === 0) return children\n\n const htmlElement = list[htmlIndex] as ReactElement\n const normalizedHtml = hoistIntoHtmlHead(htmlElement, headNodes)\n return list\n .filter((child, index) => index === htmlIndex || !isHeadElement(child))\n .map((child) => (child === htmlElement ? normalizedHtml : child))\n}\n\nfunction hoistIntoHtmlHead(htmlElement: ReactElement, headNodes: ReactNode[]): ReactElement {\n const htmlChildren = toChildArray(htmlElement.props?.children)\n const headIndex = htmlChildren.findIndex((child) => isHostElement(child, 'head'))\n let nextChildren: ReactNode[]\n\n if (headIndex === -1) {\n nextChildren = [\n createHostElement('head', { children: headNodes }),\n ...htmlChildren,\n ]\n } else {\n const headElement = htmlChildren[headIndex] as ReactElement\n const existingHeadChildren = toChildArray(headElement.props?.children)\n const nextHead = {\n ...headElement,\n props: {\n ...headElement.props,\n children: [...headNodes, ...existingHeadChildren],\n },\n }\n nextChildren = htmlChildren.map((child, index) => (index === headIndex ? nextHead : child))\n }\n\n return {\n ...htmlElement,\n props: {\n ...htmlElement.props,\n children: nextChildren,\n },\n }\n}\n\nfunction toChildArray(children: unknown): ReactNode[] {\n if (children == null || typeof children === 'boolean') return []\n if (Array.isArray(children)) return children as ReactNode[]\n if (isReactElement(children)) return [children]\n if (typeof children !== 'string' && isIterable(children)) return Array.from(children) as ReactNode[]\n return [children as ReactNode]\n}\n\nfunction isHeadElement(value: ReactNode): boolean {\n return isReactElement(value) && typeof value.type === 'string' && DOCUMENT_HEAD_TAGS.has(value.type)\n}\n\nfunction isHostElement(value: ReactNode, tag: string): boolean {\n return isReactElement(value) && value.type === tag\n}\n\nfunction isReactElement(value: unknown): value is ReactElement {\n return !!value && typeof value === 'object' && (value as ReactElement).$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction isIterable(value: unknown): value is Iterable<ReactNode> {\n return !!value && typeof (value as { [Symbol.iterator]?: unknown })[Symbol.iterator] == 'function'\n}\n\nfunction createHostElement(type: string, props: Record<string, unknown>): ReactElement {\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type,\n key: null,\n ref: null,\n props,\n }\n}\n\nfunction validateHydrationProps(\n fiber: Fiber,\n el: Element,\n props: Record<string, any>,\n tag: string,\n isSvg: boolean,\n): void {\n if (props.suppressHydrationWarning) return\n\n const recoverInPlace = canRecoverHydrationPropMismatch(el, tag)\n let expected: Element | undefined\n\n for (const k in props) {\n const value = props[k]\n if (\n k === 'children' ||\n k === 'key' ||\n k === 'ref' ||\n k === 'suppressHydrationWarning' ||\n k === 'suppressContentEditableWarning' ||\n (k[0] === 'o' && k[1] === 'n' && typeof value == 'function')\n ) continue\n\n if (k === 'dangerouslySetInnerHTML') {\n let html = '' + (value?.__html ?? '')\n if (tag !== 'script' && tag !== 'style') {\n const probe = document.createElement('div')\n probe.innerHTML = html\n html = probe.innerHTML\n }\n if ((el as HTMLElement).innerHTML !== html) {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(`Hydration HTML mismatch inside <${tag}>.`)\n : undefined,\n recoverInPlace,\n )\n }\n continue\n }\n\n if (k === 'value' || k === 'defaultValue') {\n if (tag === 'select') continue\n if (tag === 'input' || tag === 'textarea') {\n if (k === 'value' || props.value == null) {\n if (value != null && (el as HTMLInputElement).value !== '' + value) {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(`Hydration ${tag} value mismatch on <${tag}>.`)\n : undefined,\n recoverInPlace,\n )\n }\n }\n continue\n }\n }\n\n if (tag === 'input' && (k === 'checked' || k === 'defaultChecked')) {\n if (k === 'checked' || props.checked == null) {\n if (value != null && (el as HTMLInputElement).checked !== !!value) {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(`Hydration checked mismatch on <input>.`)\n : undefined,\n recoverInPlace,\n )\n }\n }\n continue\n }\n\n if (tag === 'option' && k === 'selected') {\n if (value != null && (el as HTMLOptionElement).selected !== !!value) {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(`Hydration selected mismatch on <option>.`)\n : undefined,\n recoverInPlace,\n )\n }\n continue\n }\n\n if (k === 'style') {\n expected ??= createHostNode(tag, isSvg)\n setProp(expected, k, value, undefined, isSvg)\n if (\n !hydrationStylesMatch(\n (el as HTMLElement).style,\n (expected as HTMLElement).style,\n )\n ) {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(`Hydration style mismatch on <${tag}>.`)\n : undefined,\n recoverInPlace,\n )\n }\n continue\n }\n\n const attr = attributeName(k, isSvg)\n const stringifiedBoolean =\n STRING_BOOLEAN_ATTRS.has(attr) || k.startsWith('aria-') || k.startsWith('data-')\n\n let expectedValue: string | null\n if (value == null || (value === false && !stringifiedBoolean)) {\n expectedValue = null\n } else if (k === 'muted' && !isSvg && (tag === 'video' || tag === 'audio')) {\n // The muted property controls playback; defaultMuted reflects the SSR attribute.\n expectedValue = value ? '' : null\n } else {\n expected ??= createHostNode(tag, isSvg)\n setProp(expected, k, value, undefined, isSvg)\n expectedValue = expected.getAttribute(attr)\n }\n const actualValue = el.getAttribute(attr)\n if (expectedValue !== actualValue) {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(\n `Hydration attribute mismatch on <${tag}> for \"${attr}\": ` +\n `expected ${formatHydrationValue(expectedValue)} but found ${formatHydrationValue(actualValue)}.`,\n )\n : undefined,\n recoverInPlace,\n )\n }\n }\n}\n\nfunction hydrationStylesMatch(\n actual: CSSStyleDeclaration,\n expected: CSSStyleDeclaration,\n): boolean {\n for (let index = 0; index < expected.length; index++) {\n const property = expected.item(index)\n if (\n actual.getPropertyValue(property) !== expected.getPropertyValue(property) ||\n actual.getPropertyPriority(property) !== expected.getPropertyPriority(property)\n ) {\n return false\n }\n }\n return true\n}\n\nfunction formatHydrationValue(value: string | null): string {\n return value == null ? 'nothing' : JSON.stringify(value)\n}\n"],
|
|
5
|
-
"mappings": ";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAKK;AACP,SAAS,eAAe,4BAA4B;AACpD,SAAS,gBAAgB,eAAe;AACxC,SAAS,wBAAwB;AACjC,SAAS,oBAAoB,UAAU,eAAe,YAAY,oBAAoB;AACtF,SAAS,iBAAiB,uBAAuB;AAgB1C,SAAS,8BAAoC;AAClD,MAAI,OAAO,WAAW,YAAa;AACnC,QAAM,IAAI;AACV,MAAI,EAAE,GAAI;AACV,QAAM,OAAO,KAAK;AAClB,QAAM,iBAAiB,EAAE,KAAK,KAAK;AACnC,MAAI,mBAAmB;AACvB,MAAI,eAAe;AACnB,IAAE;AAAA,IACA;AAAA,IACA,MAAM;AACJ,UAAI,CAAC,cAAc;AACjB,2BAAmB,KAAK;AAAA,MAC1B;AAAA,IACF;AAAA,IACA,EAAE,SAAS,MAAM,SAAS,KAAK;AAAA,EACjC;AACA,QAAM,eAAe,EAAE;AACvB,IAAE,WAAW,YAAa,MAAa;AACrC,UAAM,MAAM,KAAK;AACjB,QACE,MAAM,iBAAiB,OACvB,MAAM,mBAAmB,MACzB;AACA;AAAA,IACF;AACA,mBAAe;AACf,QAAI;AACF,aAAQ,aAAqB,MAAM,GAAG,IAAI;AAAA,IAC5C,U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,UACJ;AAAA,QACF;AAAA,MACF;AACA;AAAA,IACF;AAEA,UAAM,OAAO,cAAc,GAAG,KAAK;AACnC,UAAM,qBACJ,qBAAqB,IAAI,IAAI,KAAK,EAAE,WAAW,OAAO,KAAK,EAAE,WAAW,OAAO;AAEjF,QAAI;AACJ,QAAI,SAAS,QAAS,UAAU,SAAS,CAAC,oBAAqB;AAC7D,sBAAgB;AAAA,IAClB,WAAW,MAAM,WAAW,CAAC,UAAU,QAAQ,WAAW,QAAQ,UAAU;AAE1E,sBAAgB,QAAQ,KAAK;AAAA,IAC/B,OAAO;AACL,mBAAa,eAAe,KAAK,KAAK;AACtC,cAAQ,UAAU,GAAG,OAAO,QAAW,KAAK;AAC5C,sBAAgB,SAAS,aAAa,IAAI;AAAA,IAC5C;AACA,UAAM,cAAc,GAAG,aAAa,IAAI;AACxC,QAAI,kBAAkB,aAAa;AACjC;AAAA,QACE;AAAA,QACA,OACI,IAAI;AAAA,UACF,oCAAoC,GAAG,UAAU,IAAI,eACvC,qBAAqB,aAAa,CAAC,cAAc,qBAAqB,WAAW,CAAC;AAAA,QAClG,IACA;AAAA,QACJ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,qBACP,QACA,UACS;AACT,WAAS,QAAQ,GAAG,QAAQ,SAAS,QAAQ,SAAS;AACpD,UAAM,WAAW,SAAS,KAAK,KAAK;AACpC,QACE,OAAO,iBAAiB,QAAQ,MAAM,SAAS,iBAAiB,QAAQ,KACxE,OAAO,oBAAoB,QAAQ,MAAM,SAAS,oBAAoB,QAAQ,GAC9E;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,qBAAqB,OAA8B;AAC1D,SAAO,SAAS,OAAO,YAAY,KAAK,UAAU,KAAK;AACzD;",
|
|
4
|
+
"sourcesContent": ["import {\n FiberTag,\n REACT_ELEMENT_TYPE,\n type Fiber,\n type FiberRoot,\n type ReactElement,\n type ReactNode,\n} from '../../../core'\nimport { attributeName, STRING_BOOLEAN_ATTRS } from '../../../core/attributes'\nimport { createHostNode, setProp, syncTextareaValue } from '../../dom'\nimport { queueMutation, queueProp, queueText } from '../../commit'\nimport { drainReplayQueue } from '../../event-replay'\nimport { discardPendingWork, discardPendingEffects, findRoot, flushSyncWork, renderRoot, scheduleRootRender, recoverRootError, unmountFiber } from '../../reconcile'\nimport { attachRootFiber, createFiberRoot } from '../../root-internal'\nimport { componentStack } from '../../error-info'\n\n// Re-export from event-replay so all hydration concerns live behind one\n// feature boundary \u2014 the plugin's stub swap strips drainReplayQueue too.\nexport { drainReplayQueue }\n\n/**\n * Preserve the user's scroll position across hydration. If the user scrolled\n * between SSR paint and hydrate (common in dev where JS takes seconds to\n * load), libraries that wire scroll-restoration into a `useLayoutEffect`\n * near the root (e.g. TanStack Router) will run during our synchronous\n * hydrate and call `window.scrollTo(savedFromLastVisit)` \u2014 overwriting the\n * user's fresh scroll. We install a short-lived wrapper around scrollTo that\n * suppresses programmatic calls when a user-initiated scroll happened\n * recently. Only runs in the hydration feature \u2014 the stub skips it.\n */\nexport function installHydrationScrollGuard(): void {\n if (typeof window === 'undefined') return\n const w = window as any\n if (w._r) return\n const time = Date.now\n const guardStartedAt = w._r = time()\n let lastUserScrollAt = 0\n let programmatic = false\n w.addEventListener(\n 'scroll',\n () => {\n if (!programmatic) {\n lastUserScrollAt = time()\n }\n },\n { capture: true, passive: true },\n )\n const origScrollTo = w.scrollTo\n w.scrollTo = function (...args: any[]) {\n const now = time()\n if (\n now - guardStartedAt < 3000 &&\n now - lastUserScrollAt < 1500\n ) {\n return\n }\n programmatic = true\n try {\n return (origScrollTo as any).apply(w, args)\n } finally {\n queueMicrotask(() => {\n programmatic = false\n })\n }\n }\n}\n\n/**\n * Hydration cursor: walks existing DOM children in document order so we can\n * adopt them during fiber tree construction. One cursor per host parent.\n *\n * `endBefore` scopes the cursor to a subrange \u2014 used by rehydrateBoundary()\n * so we only adopt DOM up to the closing `/$` marker for that boundary.\n */\nexport class HydrationCursor {\n n: ChildNode | null\n p: Node\n e: ChildNode | null\n constructor(parent: Node, start: ChildNode | null = null, endBefore: ChildNode | null = null) {\n this.p = parent\n this.n = start ?? parent.firstChild\n this.e = endBefore\n }\n take(): ChildNode | null {\n while (this.n && this.n !== this.e) {\n const n = this.n\n // Skip anything that isn't an element (1) or text (3):\n // comments (8), doctype (10), processing instructions (7), cdata (4).\n if (n.nodeType !== 1 && n.nodeType !== 3) {\n this.n = n.nextSibling\n continue\n }\n this.n = n.nextSibling\n return n\n }\n return null\n }\n /**\n * Position-insensitive lookup for head/html adoption. Scans forward past\n * non-matching nodes without removing them, matching by tag AND the key\n * attributes that identify head elements uniquely (rel/href for links,\n * name/property for meta, src for script). Non-matching nodes stay in\n * place so the SSR'd stylesheet/script order is preserved.\n */\n head(tag: string, props: Record<string, any>): ChildNode | null {\n const target = tag.toLowerCase()\n const keyAttrs = HEAD_KEY_ATTRS[target]\n let scan = this.p.firstChild\n while (scan) {\n if (\n scan.nodeType === 1 &&\n (scan as Element).tagName.toLowerCase() === target &&\n headAttrsMatch(scan as Element, props, keyAttrs)\n ) {\n CLAIMED.add(scan)\n return scan\n }\n scan = scan.nextSibling\n }\n return null\n }\n has(): boolean {\n let n = this.n\n while (n && n !== this.e) {\n if (n.nodeType === 1 || n.nodeType === 3) return true\n n = n.nextSibling\n }\n return false\n }\n}\n\nconst hydrationCursors = new WeakMap<Fiber, HydrationCursor>()\nconst PROD_HYDRATION_ERROR = 'Hydration mismatch.'\n\nexport interface HydrationBailoutError extends Error {\n f: Fiber | null\n}\n\nexport function isHydrationBailout(error: unknown): error is HydrationBailoutError {\n return !!error && (error as any).f !== undefined\n}\n\nexport function abortHydration(cause: unknown, fiber: Fiber | null = null): never {\n const error = (cause instanceof Error ? cause : new Error(PROD_HYDRATION_ERROR)) as HydrationBailoutError\n ;(error as any).f = fiber\n throw error\n}\n\ninterface HydrateRootOptions {\n identifierPrefix?: string\n onRecoverableError?: import('../../../core').RecoverableErrorHandler\n onCaughtError?: import('../../../core').RecoverableErrorHandler\n onUncaughtError?: import('../../../core').RecoverableErrorHandler\n}\n\ninterface HydratedRoot {\n render(children: ReactNode): void\n unmount(): void\n}\n\nexport function hydrateRootImpl(\n container: Element | Document,\n initialChildren: ReactNode,\n options: HydrateRootOptions,\n): HydratedRoot {\n const target = container as any as Element | Document\n const isDocument = (container as Node).nodeType === 9\n const body = isDocument ? (target as Document).body : null\n const root = createFiberRoot(target, options)\n\n installHydrationScrollGuard()\n\n const normalizedInitialChildren =\n isDocument ? normalizeDocumentChildren(initialChildren) : initialChildren\n let hydrationError: unknown = null\n beginHydration(root)\n try {\n flushSyncWork(() => {\n renderRoot(root, normalizedInitialChildren)\n })\n } catch (e) {\n hydrationError = e\n }\n endHydration(root)\n\n if (hydrationError && !recoverHydration(root, hydrationError)) throw hydrationError\n drainReplayQueue()\n\n return {\n render(children) {\n scheduleRootRender(root, () => {\n const normalized = isDocument ? normalizeDocumentChildren(children) : children\n renderRoot(\n root,\n root.c === body ? getStaticDocumentBodyChildren(normalized) ?? normalized : normalized,\n )\n })\n },\n unmount() {\n flushSyncWork(() => {\n renderRoot(root, null)\n })\n },\n }\n}\n\n// Head elements that we match against server DOM by attribute signature.\nconst HEAD_KEY_ATTRS: Record<string, ReadonlyArray<string>> = {\n link: ['rel', 'href', 'sizes', 'type'],\n meta: ['name', 'property', 'charSet', 'httpEquiv'],\n script: ['src', 'type'],\n style: ['id', 'media', 'nonce', 'title'],\n}\n\nconst DOCUMENT_HEAD_TAGS = new Set(['base', 'link', 'meta', 'script', 'style', 'title'])\n\n// DOM elements already claimed by some fiber during this hydration pass.\nconst CLAIMED = new WeakSet<Node>()\n\nfunction headAttrsMatch(\n el: Element,\n props: Record<string, any>,\n keys: ReadonlyArray<string> | undefined,\n): boolean {\n if (CLAIMED.has(el)) return false\n if (!keys) return true\n for (const k of keys) {\n const propVal = props[k]\n const elVal = hydrationAttribute(el, attributeName(k))\n if (propVal == null && elVal == null) continue\n if (propVal == null || elVal == null || String(propVal) !== elVal) return false\n }\n return true\n}\n\nfunction hydrationAttribute(el: Element, name: string): string | null {\n return name === 'nonce' && 'nonce' in el && el.hasAttribute(name)\n ? (el as HTMLElement).nonce ?? ''\n : el.getAttribute(name)\n}\n\nexport function beginHydration(root: FiberRoot): void {\n root.ic = 0\n root.h = true\n hydrationCursors.set(root.r, new HydrationCursor(root.c))\n}\n\nexport function endHydration(root: FiberRoot): void {\n root.h = false\n hydrationCursors.delete(root.r)\n}\n\n/**\n * Inspect the current cursor position for a streaming-suspense boundary\n * marker emitted by the server. Returns info + advances the cursor past the\n * marker pair (start comment + fallback/real content + end comment).\n */\nexport type BoundaryInfo = [0 | 1 | 2 | 3, number, Comment, Comment]\n\nexport function tryConsumeBoundary(parent: Fiber): BoundaryInfo | null {\n const cursor = hydrationCursors.get(findHostParent(parent))\n if (!cursor) return null\n const peek = cursor.n\n if (!peek || peek.nodeType !== 8) return null\n const data = (peek as Comment).data\n const m = /^(\\$[?!E]?)(\\d+)$/.exec(data)\n if (!m) return null\n const kind = m[1] === '$?' ? 1 : m[1] === '$!' ? 2 : m[1] === '$E' ? 3 : 0\n const id = Number(m[2])\n const startMark = peek as Comment\n // Advance past the start comment\n cursor.n = startMark.nextSibling\n // Locate end comment: closest <!--/$-->\n let endMark: Comment | null = null\n let scan = startMark.nextSibling\n let depth = 0\n while (scan) {\n if (scan.nodeType === 8 && /^\\$[?!E]?\\d+$/.test((scan as Comment).data)) depth++\n if (scan.nodeType === 8 && (scan as Comment).data === '/$') {\n if (depth) { depth--; scan = scan.nextSibling; continue }\n endMark = scan as Comment\n break\n }\n scan = scan.nextSibling\n }\n if (!endMark) return null\n return [kind, id, startMark, endMark]\n}\n\nexport function advanceCursorPast(parent: Fiber, node: Node): void {\n const cursor = hydrationCursors.get(findHostParent(parent))\n if (!cursor) return\n cursor.n = node.nextSibling\n}\n\nexport function getHydrationCursor(hostFiber: Fiber): HydrationCursor | undefined {\n return hydrationCursors.get(hostFiber)\n}\n\nexport function setHydrationCursor(hostFiber: Fiber, cursor: HydrationCursor): void {\n hydrationCursors.set(hostFiber, cursor)\n}\n\nexport function clearHydrationCursor(hostFiber: Fiber): void {\n hydrationCursors.delete(hostFiber)\n}\n\n/**\n * Try to adopt a DOM node for this host fiber. Returns true if adopted.\n * Attaches existing attrs/children via separate hydrate pass.\n */\nexport function adoptHostDom(fiber: Fiber, parent: Fiber): boolean {\n const hostParent = findHostParent(parent)\n const cursor = hydrationCursors.get(hostParent)\n if (!cursor) return false\n\n const tag = (fiber.type as string).toLowerCase()\n const documentHeadParent =\n cursor.p.nodeType === 9 && DOCUMENT_HEAD_TAGS.has(tag)\n ? (cursor.p as Document).head\n : null\n const parentEl = cursor.p as Element\n const parentTag =\n parentEl.nodeType === 1 ? (parentEl as Element).tagName.toLowerCase() : ''\n const isHeadish = parentTag === 'head' || parentTag === 'html' || !!documentHeadParent\n\n let candidate: ChildNode | null\n if (documentHeadParent) {\n // React 19 can project <meta>/<title>/<link> from anywhere in the tree into\n // document.head. Redact does not have that projection yet, so when a\n // document-root hydration pass sees a top-level head element, adopt it\n // from <head> rather than trying to append it beside <html>.\n candidate = new HydrationCursor(documentHeadParent).head(\n tag,\n fiber.pp ?? {},\n )\n } else if (isHeadish) {\n // Head/html children are position-insensitive \u2014 server may emit them in\n // a different order than the React tree (React 19 head hoisting, etc.).\n // Scan forward without removing non-matching nodes; match on attribute\n // signature so we don't adopt the wrong <link> and clobber its props.\n candidate = cursor.head(tag, fiber.pp ?? {})\n } else {\n candidate = cursor.take()\n }\n\n if (!candidate) {\n // Client expected a host here but the cursor is exhausted \u2014 server gave\n // fewer children than the client tree. Report the structural gap (React\n // fires `onRecoverableError` for this exact case) and let the reconciler\n // mount a fresh DOM for this fiber below.\n // Exception: <head> children are position-insensitive; a missing match\n // there means \"server didn't hoist this one yet\", which we silently mount.\n if (!isHeadish) onMismatch(fiber, null)\n return false\n }\n\n if (candidate.nodeType !== 1 || (candidate as Element).tagName.toLowerCase() !== tag) {\n // mismatch \u2014 log and re-render fresh from this point\n onMismatch(fiber, candidate)\n return false\n }\n fiber.dom = candidate\n // Apply props (attach events, sync IDL props). Don't re-set existing attrs.\n const props = fiber.pp ?? {}\n const isSvg =\n tag === 'svg' ||\n ((candidate as Element).namespaceURI === 'http://www.w3.org/2000/svg' &&\n tag !== 'foreignobject')\n const syncHydrationProps =\n !props.suppressHydrationWarning &&\n canRecoverHydrationPropMismatch(candidate, tag)\n validateHydrationProps(fiber, candidate as Element, props, tag, isSvg)\n // Form state can change between server paint and hydration. Initialize reset\n // defaults without treating the live value or selection as a mismatch.\n if (tag === 'input' || tag === 'textarea') queueHydrationFormState(candidate as Element, props, tag)\n for (const k in props) {\n if (\n (syncHydrationProps &&\n k !== 'children' && k !== 'key' && k !== 'ref' &&\n (k !== 'nonce' || hydrationAttribute(candidate as Element, k) !== props[k]) &&\n k !== 'suppressHydrationWarning' && k !== 'suppressContentEditableWarning' &&\n !isHydrationFormProp(tag, k)) ||\n (k[0] === 'o' && k[1] === 'n' && typeof props[k] == 'function')\n ) queueProp(candidate as Element, k, props[k], undefined, isSvg)\n }\n // Set up child cursor for this host's children\n hydrationCursors.set(fiber, new HydrationCursor(candidate))\n return true\n}\n\nfunction queueHydrationFormState(el: Element, props: any, tag: string): void {\n queueMutation(() => {\n if (tag === 'input') {\n const input = el as HTMLInputElement\n if (props.type != null) input.type = props.type\n const value = props.value ?? props.defaultValue\n if (value != null && (props.value != null || (input.type !== 'submit' && input.type !== 'reset'))) {\n input.defaultValue = '' + value\n }\n // Mark checked as dirty before changing its default, including clean SSR\n // inputs whose client default differs. This also preserves radio groups.\n input.checked = input.checked\n input.defaultChecked = !!(props.checked ?? props.defaultChecked)\n } else {\n syncTextareaValue(el as HTMLTextAreaElement, props, true)\n }\n })\n}\n\nexport function adoptTextDom(fiber: Fiber, parent: Fiber, text: string): boolean {\n const cursor = hydrationCursors.get(findHostParent(parent))\n if (!cursor) return false\n const candidate = cursor.take()\n if (!candidate) {\n onMismatch(fiber, null)\n return false\n }\n if (candidate.nodeType === 3) {\n if ((candidate as Text).data !== text) {\n const recovered = failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(\n `Hydration text mismatch: expected \"${text}\" but found \"${(candidate as Text).data}\".`,\n )\n : undefined,\n canRecoverHydrationPropMismatch(candidate),\n )\n if (recovered) {\n queueText(candidate as Text, text)\n }\n }\n fiber.dom = candidate\n return true\n }\n onMismatch(fiber, candidate)\n return false\n}\n\nexport function findHostParent(fiber: Fiber): Fiber {\n let f: Fiber | null = fiber\n while (f) {\n // A fiber explicitly holding a cursor acts as a boundary for hydration\n // (e.g. Suspense with a scoped cursor during fallback/boundary hydration).\n if (hydrationCursors.has(f)) return f\n if (f.tag === FiberTag.Host || f.tag === FiberTag.Root || f.tag === FiberTag.Portal) {\n return f\n }\n f = f.parent\n }\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('No host parent found')\n }\n throw new Error()\n}\n\nfunction onMismatch(fiber: Fiber, actualNode: ChildNode | null): void {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(\n `Hydration mismatch: expected <${(fiber.type as string) ?? 'text'}> but found ${\n actualNode ? (actualNode.nodeType === 1 ? (actualNode as Element).tagName : 'text') : 'nothing'\n }.`,\n )\n : undefined,\n )\n}\n\nfunction failHydration(\n fiber: Fiber,\n error: Error = new Error(PROD_HYDRATION_ERROR),\n recoverInPlace = false,\n): boolean {\n const root = findRoot(fiber)\n if (root?.re) {\n root.re(error, { componentStack: componentStack(fiber) })\n }\n if (recoverInPlace) return true\n abortHydration(error, findHostRecoveryParent(fiber) ?? fiber)\n}\n\nfunction canRecoverHydrationPropMismatch(node: Node, tag?: string): boolean {\n return (\n tag === 'html' ||\n tag === 'head' ||\n tag === 'body' ||\n !!node.ownerDocument?.head?.contains(node)\n )\n}\n\nfunction findHostRecoveryParent(fiber: Fiber): Fiber | null {\n if (fiber.tag === FiberTag.Text) {\n let directHost = fiber.parent\n while (directHost && (directHost.tag !== FiberTag.Host || !directHost.dom)) {\n directHost = directHost.parent\n }\n if (!directHost) return null\n let hasEvent\n const props = directHost.pp ?? directHost.mp\n if (props) {\n for (const k in props) {\n if (k[0] === 'o' && k[1] === 'n' && typeof props[k] == 'function') {\n hasEvent = true\n }\n }\n }\n return findNearestSafeHostAboveComposite(\n hasEvent\n ? directHost.parent\n : directHost.parent?.tag === FiberTag.Host\n ? directHost.parent\n : directHost,\n )\n }\n\n return findNearestSafeHostAboveComposite(fiber.parent)\n}\n\nfunction findNearestSafeHostAboveComposite(fiber: Fiber | null): Fiber | null {\n let host: Fiber | null = null\n let f = fiber\n while (f) {\n if (f.tag === FiberTag.Host && f.dom) {\n if (!isSafeHostRecoveryElement(f)) return null\n const parentTag = f.parent?.tag as number\n if (!host || (parentTag > FiberTag.Text && parentTag < FiberTag.Suspense)) {\n host = f\n }\n }\n f = f.parent\n }\n return host\n}\n\nfunction isSafeHostRecoveryElement(fiber: Fiber): boolean {\n const tag = fiber.type.toLowerCase()\n return tag !== 'html' && tag !== 'head' && tag !== 'body'\n}\n\nexport function recoverHydration(root: FiberRoot, error: unknown): boolean {\n if (!isHydrationBailout(error)) return false\n\n let container = root.c as Element | Document\n let children = root.r.pp?.children ?? null\n const hostRecovery = getRecoverableHostChildren(error)\n if (hostRecovery) {\n container = hostRecovery[0]\n children = hostRecovery[1]\n } else if (container.nodeType === 9) {\n const bodyChildren = getRecoverableDocumentBodyChildren(error)\n if (bodyChildren != null) {\n container = (container as Document).body\n children = bodyChildren\n }\n }\n\n resetAfterHydrationFailure(root, container)\n try {\n flushSyncWork(() => renderRoot(root, children))\n } catch (clientError) {\n resetAfterHydrationFailure(root, container)\n if (recoverRootError(clientError)) return true\n throw clientError\n }\n return true\n}\n\nfunction resetAfterHydrationFailure(\n root: FiberRoot,\n container: Element | Document,\n): void {\n // Retire committed subscriptions and portals without removing the document shell.\n unmountFiber(root.r, container, false)\n discardPendingWork(root)\n discardPendingEffects(root)\n clearHydrationContainer(container)\n attachRootFiber(root, container)\n root.h = false\n}\n\nfunction clearHydrationContainer(container: Element | Document): void {\n queueMutation(() => {\n if (container.nodeType === 9) {\n let node = container.firstChild\n while (node) {\n const next = node.nextSibling\n if (node.nodeType !== 10 /* DOCUMENT_TYPE_NODE */) {\n container.removeChild(node)\n }\n node = next\n }\n return\n }\n ;(container as Element).textContent = ''\n })\n}\n\nfunction getRecoverableHostChildren(\n error: HydrationBailoutError,\n): [Element, ReactNode] | null {\n const host = error.f\n if (\n host?.tag !== FiberTag.Host ||\n !host.dom ||\n !findNearestSafeHostAboveComposite(host.parent)\n ) {\n return null\n }\n return [host.dom as Element, (host.pp ?? host.mp)?.children ?? null]\n}\n\nfunction getRecoverableDocumentBodyChildren(error: HydrationBailoutError): ReactNode | null {\n const bodyFiber = findBodyAncestor(error.f)\n if (!bodyFiber) return null\n return (bodyFiber.pp ?? bodyFiber.mp)?.children ?? null\n}\n\nfunction findBodyAncestor(fiber: Fiber | null): Fiber | null {\n let f = fiber\n while (f) {\n if (f.tag === FiberTag.Host && f.type === 'body') {\n return f === fiber ? null : f\n }\n f = f.parent\n }\n return null\n}\n\nfunction getStaticDocumentBodyChildren(children: ReactNode): ReactNode | null {\n const list = toChildArray(children)\n const html = list.find((child) => isHostElement(child, 'html')) as ReactElement | undefined\n if (!html) return null\n const htmlChildren = toChildArray(html.props?.children)\n const body = htmlChildren.find((child) => isHostElement(child, 'body')) as ReactElement | undefined\n return body ? body.props?.children ?? null : null\n}\n\nfunction normalizeDocumentChildren(children: ReactNode): ReactNode {\n const list = toChildArray(children)\n const htmlIndex = list.findIndex((child) => isHostElement(child, 'html'))\n if (htmlIndex === -1) return children\n\n const headNodes = list.filter(isHeadElement)\n if (headNodes.length === 0) return children\n\n const htmlElement = list[htmlIndex] as ReactElement\n const normalizedHtml = hoistIntoHtmlHead(htmlElement, headNodes)\n return list\n .filter((child, index) => index === htmlIndex || !isHeadElement(child))\n .map((child) => (child === htmlElement ? normalizedHtml : child))\n}\n\nfunction hoistIntoHtmlHead(htmlElement: ReactElement, headNodes: ReactNode[]): ReactElement {\n const htmlChildren = toChildArray(htmlElement.props?.children)\n const headIndex = htmlChildren.findIndex((child) => isHostElement(child, 'head'))\n let nextChildren: ReactNode[]\n\n if (headIndex === -1) {\n nextChildren = [\n createHostElement('head', { children: headNodes }),\n ...htmlChildren,\n ]\n } else {\n const headElement = htmlChildren[headIndex] as ReactElement\n const existingHeadChildren = toChildArray(headElement.props?.children)\n const nextHead = {\n ...headElement,\n props: {\n ...headElement.props,\n children: [...headNodes, ...existingHeadChildren],\n },\n }\n nextChildren = htmlChildren.map((child, index) => (index === headIndex ? nextHead : child))\n }\n\n return {\n ...htmlElement,\n props: {\n ...htmlElement.props,\n children: nextChildren,\n },\n }\n}\n\nfunction toChildArray(children: unknown): ReactNode[] {\n if (children == null || typeof children === 'boolean') return []\n if (Array.isArray(children)) return children as ReactNode[]\n if (isReactElement(children)) return [children]\n if (typeof children !== 'string' && isIterable(children)) return Array.from(children) as ReactNode[]\n return [children as ReactNode]\n}\n\nfunction isHeadElement(value: ReactNode): boolean {\n return isReactElement(value) && typeof value.type === 'string' && DOCUMENT_HEAD_TAGS.has(value.type)\n}\n\nfunction isHostElement(value: ReactNode, tag: string): boolean {\n return isReactElement(value) && value.type === tag\n}\n\nfunction isReactElement(value: unknown): value is ReactElement {\n return !!value && typeof value === 'object' && (value as ReactElement).$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction isIterable(value: unknown): value is Iterable<ReactNode> {\n return !!value && typeof (value as { [Symbol.iterator]?: unknown })[Symbol.iterator] == 'function'\n}\n\nfunction createHostElement(type: string, props: Record<string, unknown>): ReactElement {\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type,\n key: null,\n ref: null,\n props,\n }\n}\n\nfunction isHydrationFormProp(tag: string, key: string): boolean {\n return (\n ((tag === 'input' || tag === 'textarea' || tag === 'select') && (key === 'value' || key === 'defaultValue')) ||\n (tag === 'input' && (key === 'checked' || key === 'defaultChecked')) ||\n (tag === 'option' && key === 'selected')\n )\n}\n\nfunction validateHydrationProps(\n fiber: Fiber,\n el: Element,\n props: Record<string, any>,\n tag: string,\n isSvg: boolean,\n): void {\n if (props.suppressHydrationWarning) return\n\n const recoverInPlace = canRecoverHydrationPropMismatch(el, tag)\n let expected: Element | undefined\n\n for (const k in props) {\n const value = props[k]\n if (\n k === 'children' ||\n k === 'key' ||\n k === 'ref' ||\n k === 'suppressHydrationWarning' ||\n k === 'suppressContentEditableWarning' ||\n (k[0] === 'o' && k[1] === 'n' && typeof value == 'function')\n ) continue\n\n if (k === 'dangerouslySetInnerHTML') {\n let html = value?.__html\n if (html == null) continue\n if (tag !== 'script' && tag !== 'style') {\n const probe = createHostNode(tag, isSvg)\n probe.innerHTML = html\n html = probe.innerHTML\n }\n if ((el as HTMLElement).innerHTML !== '' + html) {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(`Hydration HTML mismatch inside <${tag}>.`)\n : undefined,\n recoverInPlace,\n )\n }\n continue\n }\n\n if (isHydrationFormProp(tag, k)) continue\n\n if (k === 'style') {\n expected ??= createHostNode(tag, isSvg)\n setProp(expected, k, value, undefined, isSvg)\n if (\n !hydrationStylesMatch(\n (el as HTMLElement).style,\n (expected as HTMLElement).style,\n )\n ) {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(`Hydration style mismatch on <${tag}>.`)\n : undefined,\n recoverInPlace,\n )\n }\n continue\n }\n\n const attr = attributeName(k, isSvg)\n const stringifiedBoolean =\n STRING_BOOLEAN_ATTRS.has(attr) || k.startsWith('aria-') || k.startsWith('data-')\n\n let expectedValue: string | null\n if (value == null || (value === false && !stringifiedBoolean)) {\n expectedValue = null\n } else if (k === 'muted' && !isSvg && (tag === 'video' || tag === 'audio')) {\n // The muted property controls playback; defaultMuted reflects the SSR attribute.\n expectedValue = value ? '' : null\n } else if (stringifiedBoolean && k.length > 5) {\n // These attributes use setAttribute string coercion, not DOM property normalization.\n expectedValue = '' + value\n } else {\n expected ??= createHostNode(tag, isSvg)\n setProp(expected, k, value, undefined, isSvg)\n expectedValue = expected.getAttribute(attr)\n }\n const actualValue = hydrationAttribute(el, attr)\n if (expectedValue !== actualValue) {\n failHydration(\n fiber,\n process.env.NODE_ENV !== 'production'\n ? new Error(\n `Hydration attribute mismatch on <${tag}> for \"${attr}\": ` +\n `expected ${formatHydrationValue(expectedValue)} but found ${formatHydrationValue(actualValue)}.`,\n )\n : undefined,\n recoverInPlace,\n )\n }\n }\n}\n\nfunction hydrationStylesMatch(\n actual: CSSStyleDeclaration,\n expected: CSSStyleDeclaration,\n): boolean {\n for (let index = 0; index < expected.length; index++) {\n const property = expected.item(index)\n if (\n actual.getPropertyValue(property) !== expected.getPropertyValue(property) ||\n actual.getPropertyPriority(property) !== expected.getPropertyPriority(property)\n ) {\n return false\n }\n }\n return true\n}\n\nfunction formatHydrationValue(value: string | null): string {\n return value == null ? 'nothing' : JSON.stringify(value)\n}\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAKK;AACP,SAAS,eAAe,4BAA4B;AACpD,SAAS,gBAAgB,SAAS,yBAAyB;AAC3D,SAAS,eAAe,WAAW,iBAAiB;AACpD,SAAS,wBAAwB;AACjC,SAAS,oBAAoB,uBAAuB,UAAU,eAAe,YAAY,oBAAoB,kBAAkB,oBAAoB;AACnJ,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,sBAAsB;AAgBxB,SAAS,8BAAoC;AAClD,MAAI,OAAO,WAAW,YAAa;AACnC,QAAM,IAAI;AACV,MAAI,EAAE,GAAI;AACV,QAAM,OAAO,KAAK;AAClB,QAAM,iBAAiB,EAAE,KAAK,KAAK;AACnC,MAAI,mBAAmB;AACvB,MAAI,eAAe;AACnB,IAAE;AAAA,IACA;AAAA,IACA,MAAM;AACJ,UAAI,CAAC,cAAc;AACjB,2BAAmB,KAAK;AAAA,MAC1B;AAAA,IACF;AAAA,IACA,EAAE,SAA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AA,IACvB,OAAO;AACL,mBAAa,eAAe,KAAK,KAAK;AACtC,cAAQ,UAAU,GAAG,OAAO,QAAW,KAAK;AAC5C,sBAAgB,SAAS,aAAa,IAAI;AAAA,IAC5C;AACA,UAAM,cAAc,mBAAmB,IAAI,IAAI;AAC/C,QAAI,kBAAkB,aAAa;AACjC;AAAA,QACE;AAAA,QACA,yBAAyB,eACrB,IAAI;AAAA,UACF,oCAAoC,GAAG,UAAU,IAAI,eACvC,qBAAqB,aAAa,CAAC,cAAc,qBAAqB,WAAW,CAAC;AAAA,QAClG,IACA;AAAA,QACJ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,qBACP,QACA,UACS;AACT,WAAS,QAAQ,GAAG,QAAQ,SAAS,QAAQ,SAAS;AACpD,UAAM,WAAW,SAAS,KAAK,KAAK;AACpC,QACE,OAAO,iBAAiB,QAAQ,MAAM,SAAS,iBAAiB,QAAQ,KACxE,OAAO,oBAAoB,QAAQ,MAAM,SAAS,oBAAoB,QAAQ,GAC9E;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,qBAAqB,OAA8B;AAC1D,SAAO,SAAS,OAAO,YAAY,KAAK,UAAU,KAAK;AACzD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./full.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
export * from "./full";
|
|
1
|
+
// src/dom/features/hydration/index.ts
|
|
2
|
+
export * from "./full.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fiber, FiberRoot } from
|
|
1
|
+
import type { Fiber, FiberRoot } from "../../../core/index.js";
|
|
2
2
|
export declare class HydrationCursor {
|
|
3
3
|
n: ChildNode | null;
|
|
4
4
|
p: Node;
|
|
@@ -8,7 +8,12 @@ export declare class HydrationCursor {
|
|
|
8
8
|
head(): ChildNode | null;
|
|
9
9
|
has(): boolean;
|
|
10
10
|
}
|
|
11
|
-
export type BoundaryInfo = [
|
|
11
|
+
export type BoundaryInfo = [
|
|
12
|
+
0 | 1 | 2 | 3,
|
|
13
|
+
number,
|
|
14
|
+
Comment,
|
|
15
|
+
Comment
|
|
16
|
+
];
|
|
12
17
|
export declare function beginHydration(_root: FiberRoot): void;
|
|
13
18
|
export declare function endHydration(_root: FiberRoot): void;
|
|
14
19
|
export declare function tryConsumeBoundary(_parent: Fiber): BoundaryInfo | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/dom/features/hydration/stub.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Fiber, FiberRoot } from '../../../core'\n\n// Stub: Hydration feature disabled. Every adoption attempt returns \"no match\",\n// all cursor operations no-op, and `beginHydration` throws so `hydrateRoot`\n// fails loudly \u2014 apps that opt out of hydration should use `createRoot`.\n// The SSR walk-the-DOM machinery, streaming-boundary coordination, head\n// element matching, and the WeakMap of cursors per fiber are all stripped.\n\nexport class HydrationCursor {\n n: ChildNode | null = null\n p: Node\n e: ChildNode | null = null\n constructor(parent?: Node, _s?: ChildNode | null, _e?: ChildNode | null) {\n this.p = parent as Node\n }\n take(): ChildNode | null {\n return null\n }\n head(): ChildNode | null {\n return null\n }\n has(): boolean {\n return false\n }\n}\n\nexport type BoundaryInfo = [0 | 1, number, Comment, Comment]\n\nexport function beginHydration(_root: FiberRoot): void {\n throw new Error(\n '`hydrateRoot` requires the `hydration` feature. ' +\n 'Enable it via @tanstack/redact/vite `features.hydration = true`, ' +\n 'or use `createRoot` for a SPA (no SSR hydration).',\n )\n}\n\nexport function endHydration(_root: FiberRoot): void {}\n\nexport function tryConsumeBoundary(_parent: Fiber): BoundaryInfo | null {\n return null\n}\n\nexport function advanceCursorPast(_parent: Fiber, _node: Node): void {}\n\nexport function getHydrationCursor(_hostFiber: Fiber): HydrationCursor | undefined {\n return undefined\n}\n\nexport function setHydrationCursor(_hostFiber: Fiber, _cursor: HydrationCursor): void {}\n\nexport function clearHydrationCursor(_hostFiber: Fiber): void {}\n\nexport function adoptHostDom(_fiber: Fiber, _parent: Fiber): boolean {\n return false\n}\n\nexport function adoptTextDom(_fiber: Fiber, _parent: Fiber, _text: string): boolean {\n return false\n}\n\nexport function findHostParent(fiber: Fiber): Fiber {\n return fiber\n}\n\nexport function installHydrationScrollGuard(): void {}\n\nexport function drainReplayQueue(): void {}\n\nexport interface HydrationBailoutError extends Error {\n f: Fiber | null\n}\n\nexport function isHydrationBailout(_error: unknown): _error is HydrationBailoutError {\n return false\n}\n\nexport function recoverHydration(_root: FiberRoot, _error: unknown): boolean {\n return false\n}\n\nexport function abortHydration(cause: unknown, fiber: Fiber | null = null): never {\n const error = (cause instanceof Error ? cause : new Error('Hydration mismatch.')) as HydrationBailoutError\n ;(error as any).f = fiber\n throw error\n}\n\nexport function hydrateRootImpl(): never {\n beginHydration(null as any)\n throw new Error('`hydrateRoot` requires the `hydration` feature.')\n}\n"],
|
|
4
|
+
"sourcesContent": ["import type { Fiber, FiberRoot } from '../../../core'\n\n// Stub: Hydration feature disabled. Every adoption attempt returns \"no match\",\n// all cursor operations no-op, and `beginHydration` throws so `hydrateRoot`\n// fails loudly \u2014 apps that opt out of hydration should use `createRoot`.\n// The SSR walk-the-DOM machinery, streaming-boundary coordination, head\n// element matching, and the WeakMap of cursors per fiber are all stripped.\n\nexport class HydrationCursor {\n n: ChildNode | null = null\n p: Node\n e: ChildNode | null = null\n constructor(parent?: Node, _s?: ChildNode | null, _e?: ChildNode | null) {\n this.p = parent as Node\n }\n take(): ChildNode | null {\n return null\n }\n head(): ChildNode | null {\n return null\n }\n has(): boolean {\n return false\n }\n}\n\nexport type BoundaryInfo = [0 | 1 | 2 | 3, number, Comment, Comment]\n\nexport function beginHydration(_root: FiberRoot): void {\n throw new Error(\n '`hydrateRoot` requires the `hydration` feature. ' +\n 'Enable it via @tanstack/redact/vite `features.hydration = true`, ' +\n 'or use `createRoot` for a SPA (no SSR hydration).',\n )\n}\n\nexport function endHydration(_root: FiberRoot): void {}\n\nexport function tryConsumeBoundary(_parent: Fiber): BoundaryInfo | null {\n return null\n}\n\nexport function advanceCursorPast(_parent: Fiber, _node: Node): void {}\n\nexport function getHydrationCursor(_hostFiber: Fiber): HydrationCursor | undefined {\n return undefined\n}\n\nexport function setHydrationCursor(_hostFiber: Fiber, _cursor: HydrationCursor): void {}\n\nexport function clearHydrationCursor(_hostFiber: Fiber): void {}\n\nexport function adoptHostDom(_fiber: Fiber, _parent: Fiber): boolean {\n return false\n}\n\nexport function adoptTextDom(_fiber: Fiber, _parent: Fiber, _text: string): boolean {\n return false\n}\n\nexport function findHostParent(fiber: Fiber): Fiber {\n return fiber\n}\n\nexport function installHydrationScrollGuard(): void {}\n\nexport function drainReplayQueue(): void {}\n\nexport interface HydrationBailoutError extends Error {\n f: Fiber | null\n}\n\nexport function isHydrationBailout(_error: unknown): _error is HydrationBailoutError {\n return false\n}\n\nexport function recoverHydration(_root: FiberRoot, _error: unknown): boolean {\n return false\n}\n\nexport function abortHydration(cause: unknown, fiber: Fiber | null = null): never {\n const error = (cause instanceof Error ? cause : new Error('Hydration mismatch.')) as HydrationBailoutError\n ;(error as any).f = fiber\n throw error\n}\n\nexport function hydrateRootImpl(): never {\n beginHydration(null as any)\n throw new Error('`hydrateRoot` requires the `hydration` feature.')\n}\n"],
|
|
5
5
|
"mappings": ";AAQO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,IAAsB;AAAA,EACtB;AAAA,EACA,IAAsB;AAAA,EACtB,YAAY,QAAe,IAAuB,IAAuB;AACvE,SAAK,IAAI;AAAA,EACX;AAAA,EACA,OAAyB;AACvB,WAAO;AAAA,EACT;AAAA,EACA,OAAyB;AACvB,WAAO;AAAA,EACT;AAAA,EACA,MAAe;AACb,WAAO;AAAA,EACT;AACF;AAIO,SAAS,eAAe,OAAwB;AACrD,QAAM,IAAI;AAAA,IACR;AAAA,EAGF;AACF;AAEO,SAAS,aAAa,OAAwB;AAAC;AAE/C,SAAS,mBAAmB,SAAqC;AACtE,SAAO;AACT;AAEO,SAAS,kBAAkB,SAAgB,OAAmB;AAAC;AAE/D,SAAS,mBAAmB,YAAgD;AACjF,SAAO;AACT;AAEO,SAAS,mBAAmB,YAAmB,SAAgC;AAAC;AAEhF,SAAS,qBAAqB,YAAyB;AAAC;AAExD,SAAS,aAAa,QAAe,SAAyB;AACnE,SAAO;AACT;AAEO,SAAS,aAAa,QAAe,SAAgB,OAAwB;AAClF,SAAO;AACT;AAEO,SAAS,eAAe,OAAqB;AAClD,SAAO;AACT;AAEO,SAAS,8BAAoC;AAAC;AAE9C,SAAS,mBAAyB;AAAC;AAMnC,SAAS,mBAAmB,QAAkD;AACnF,SAAO;AACT;AAEO,SAAS,iBAAiB,OAAkB,QAA0B;AAC3E,SAAO;AACT;AAEO,SAAS,eAAe,OAAgB,QAAsB,MAAa;AAChF,QAAM,QAAS,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,qBAAqB;AAC9E,EAAC,MAAc,IAAI;AACpB,QAAM;AACR;AAEO,SAAS,kBAAyB;AACvC,iBAAe,IAAW;AAC1B,QAAM,IAAI,MAAM,iDAAiD;AACnE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|