@bleedingdev/tanstack-redact 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/dist/cloudflare/index.d.ts +6 -0
- package/dist/cloudflare/index.js +39 -0
- package/dist/cloudflare/index.js.map +7 -0
- package/dist/core/attributes.d.ts +4 -0
- package/dist/core/attributes.js +30 -0
- package/dist/core/attributes.js.map +7 -0
- package/dist/core/browser.d.ts +9 -0
- package/dist/core/browser.js +32 -0
- package/dist/core/browser.js.map +7 -0
- package/dist/core/class-props.d.ts +1 -0
- package/dist/core/class-props.js +15 -0
- package/dist/core/class-props.js.map +7 -0
- package/dist/core/devtools.d.ts +26 -0
- package/dist/core/devtools.js +70 -0
- package/dist/core/devtools.js.map +7 -0
- package/dist/core/functions.d.ts +6 -0
- package/dist/core/functions.js +14 -0
- package/dist/core/functions.js.map +7 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +7 -0
- package/dist/core/internal.d.ts +103 -0
- package/dist/core/internal.js +43 -0
- package/dist/core/internal.js.map +7 -0
- package/dist/core/resource-hints.d.ts +7 -0
- package/dist/core/resource-hints.js +20 -0
- package/dist/core/resource-hints.js.map +7 -0
- package/dist/core/types.d.ts +23 -0
- package/dist/core/types.js +8 -0
- package/dist/core/types.js.map +7 -0
- package/dist/core/unitless-style.d.ts +1 -0
- package/dist/core/unitless-style.js +5 -0
- package/dist/core/unitless-style.js.map +7 -0
- package/dist/dom/_all.d.ts +27 -0
- package/dist/dom/_all.js +51 -0
- package/dist/dom/_all.js.map +7 -0
- package/dist/dom/client.d.ts +9 -0
- package/dist/dom/client.js +13 -0
- package/dist/dom/client.js.map +7 -0
- package/dist/dom/commit.d.ts +27 -0
- package/dist/dom/commit.js +237 -0
- package/dist/dom/commit.js.map +7 -0
- package/dist/dom/devtools-effects.d.ts +8 -0
- package/dist/dom/devtools-effects.js +80 -0
- package/dist/dom/devtools-effects.js.map +7 -0
- package/dist/dom/devtools.d.ts +33 -0
- package/dist/dom/devtools.js +635 -0
- package/dist/dom/devtools.js.map +7 -0
- package/dist/dom/dispatcher.d.ts +4 -0
- package/dist/dom/dispatcher.js +437 -0
- package/dist/dom/dispatcher.js.map +7 -0
- package/dist/dom/document-metadata.d.ts +7 -0
- package/dist/dom/document-metadata.js +44 -0
- package/dist/dom/document-metadata.js.map +7 -0
- package/dist/dom/dom.d.ts +11 -0
- package/dist/dom/dom.js +165 -0
- package/dist/dom/dom.js.map +7 -0
- package/dist/dom/error-info.d.ts +2 -0
- package/dist/dom/error-info.js +19 -0
- package/dist/dom/error-info.js.map +7 -0
- package/dist/dom/event-replay.d.ts +13 -0
- package/dist/dom/event-replay.js +24 -0
- package/dist/dom/event-replay.js.map +7 -0
- package/dist/dom/features/activity/full.d.ts +1 -0
- package/dist/dom/features/activity/full.js +140 -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 +2 -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 +10 -0
- package/dist/dom/features/activity/stub.js.map +7 -0
- package/dist/dom/features/class/full.d.ts +1 -0
- package/dist/dom/features/class/full.js +208 -0
- package/dist/dom/features/class/full.js.map +7 -0
- package/dist/dom/features/class/index.d.ts +1 -0
- package/dist/dom/features/class/index.js +2 -0
- package/dist/dom/features/class/index.js.map +7 -0
- package/dist/dom/features/class/stub.d.ts +1 -0
- package/dist/dom/features/class/stub.js +46 -0
- package/dist/dom/features/class/stub.js.map +7 -0
- package/dist/dom/features/context/full.d.ts +4 -0
- package/dist/dom/features/context/full.js +103 -0
- package/dist/dom/features/context/full.js.map +7 -0
- package/dist/dom/features/context/index.d.ts +1 -0
- package/dist/dom/features/context/index.js +2 -0
- package/dist/dom/features/context/index.js.map +7 -0
- package/dist/dom/features/context/stub.d.ts +4 -0
- package/dist/dom/features/context/stub.js +21 -0
- package/dist/dom/features/context/stub.js.map +7 -0
- package/dist/dom/features/forward-ref/full.d.ts +1 -0
- package/dist/dom/features/forward-ref/full.js +9 -0
- package/dist/dom/features/forward-ref/full.js.map +7 -0
- package/dist/dom/features/forward-ref/index.d.ts +1 -0
- package/dist/dom/features/forward-ref/index.js +2 -0
- package/dist/dom/features/forward-ref/index.js.map +7 -0
- package/dist/dom/features/forward-ref/stub.d.ts +1 -0
- package/dist/dom/features/forward-ref/stub.js +9 -0
- package/dist/dom/features/forward-ref/stub.js.map +7 -0
- package/dist/dom/features/fragment-refs/index.d.ts +1 -0
- package/dist/dom/features/fragment-refs/index.js +9 -0
- package/dist/dom/features/fragment-refs/index.js.map +7 -0
- package/dist/dom/features/fragment-refs/stub.d.ts +5 -0
- package/dist/dom/features/fragment-refs/stub.js +17 -0
- package/dist/dom/features/fragment-refs/stub.js.map +7 -0
- package/dist/dom/features/hydration/full.d.ts +68 -0
- package/dist/dom/features/hydration/full.js +493 -0
- package/dist/dom/features/hydration/full.js.map +7 -0
- package/dist/dom/features/hydration/index.d.ts +1 -0
- package/dist/dom/features/hydration/index.js +2 -0
- package/dist/dom/features/hydration/index.js.map +7 -0
- package/dist/dom/features/hydration/stub.d.ts +36 -0
- package/dist/dom/features/hydration/stub.js +80 -0
- package/dist/dom/features/hydration/stub.js.map +7 -0
- package/dist/dom/features/index.d.ts +8 -0
- package/dist/dom/features/index.js +9 -0
- package/dist/dom/features/index.js.map +7 -0
- package/dist/dom/features/lazy/full.d.ts +1 -0
- package/dist/dom/features/lazy/full.js +23 -0
- package/dist/dom/features/lazy/full.js.map +7 -0
- package/dist/dom/features/lazy/index.d.ts +1 -0
- package/dist/dom/features/lazy/index.js +2 -0
- package/dist/dom/features/lazy/index.js.map +7 -0
- package/dist/dom/features/lazy/stub.d.ts +1 -0
- package/dist/dom/features/lazy/stub.js +19 -0
- package/dist/dom/features/lazy/stub.js.map +7 -0
- package/dist/dom/features/memo/full.d.ts +1 -0
- package/dist/dom/features/memo/full.js +34 -0
- package/dist/dom/features/memo/full.js.map +7 -0
- package/dist/dom/features/memo/index.d.ts +1 -0
- package/dist/dom/features/memo/index.js +2 -0
- package/dist/dom/features/memo/index.js.map +7 -0
- package/dist/dom/features/memo/stub.d.ts +1 -0
- package/dist/dom/features/memo/stub.js +9 -0
- package/dist/dom/features/memo/stub.js.map +7 -0
- package/dist/dom/features/portal/full.d.ts +1 -0
- package/dist/dom/features/portal/full.js +11 -0
- package/dist/dom/features/portal/full.js.map +7 -0
- package/dist/dom/features/portal/index.d.ts +1 -0
- package/dist/dom/features/portal/index.js +2 -0
- package/dist/dom/features/portal/index.js.map +7 -0
- package/dist/dom/features/portal/stub.d.ts +1 -0
- package/dist/dom/features/portal/stub.js +5 -0
- package/dist/dom/features/portal/stub.js.map +7 -0
- package/dist/dom/features/suspense/full.d.ts +1 -0
- package/dist/dom/features/suspense/full.js +389 -0
- package/dist/dom/features/suspense/full.js.map +7 -0
- package/dist/dom/features/suspense/index.d.ts +1 -0
- package/dist/dom/features/suspense/index.js +2 -0
- package/dist/dom/features/suspense/index.js.map +7 -0
- package/dist/dom/features/suspense/stub.d.ts +1 -0
- package/dist/dom/features/suspense/stub.js +4 -0
- package/dist/dom/features/suspense/stub.js.map +7 -0
- package/dist/dom/features/suspense-runtime/index.d.ts +1 -0
- package/dist/dom/features/suspense-runtime/index.js +2 -0
- package/dist/dom/features/suspense-runtime/index.js.map +7 -0
- package/dist/dom/features/suspense-runtime/stub.d.ts +1 -0
- package/dist/dom/features/suspense-runtime/stub.js +11 -0
- package/dist/dom/features/suspense-runtime/stub.js.map +7 -0
- package/dist/dom/features/view-transition/full.d.ts +7 -0
- package/dist/dom/features/view-transition/full.js +324 -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 +2 -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 +117 -0
- package/dist/dom/features/view-transition/resources.js.map +7 -0
- package/dist/dom/features/view-transition/stub.d.ts +7 -0
- package/dist/dom/features/view-transition/stub.js +21 -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 +404 -0
- package/dist/dom/features/view-transition/visual.js.map +7 -0
- package/dist/dom/form-actions.d.ts +4 -0
- package/dist/dom/form-actions.js +74 -0
- package/dist/dom/form-actions.js.map +7 -0
- package/dist/dom/form-controls.d.ts +3 -0
- package/dist/dom/form-controls.js +91 -0
- package/dist/dom/form-controls.js.map +7 -0
- package/dist/dom/fragment-instance.d.ts +33 -0
- package/dist/dom/fragment-instance.js +449 -0
- package/dist/dom/fragment-instance.js.map +7 -0
- package/dist/dom/index.d.ts +61 -0
- package/dist/dom/index.js +71 -0
- package/dist/dom/index.js.map +7 -0
- package/dist/dom/portal.d.ts +2 -0
- package/dist/dom/portal.js +14 -0
- package/dist/dom/portal.js.map +7 -0
- package/dist/dom/react-ids.d.ts +6 -0
- package/dist/dom/react-ids.js +38 -0
- package/dist/dom/react-ids.js.map +7 -0
- package/dist/dom/reconcile.d.ts +86 -0
- package/dist/dom/reconcile.js +1305 -0
- package/dist/dom/reconcile.js.map +7 -0
- package/dist/dom/refresh.d.ts +12 -0
- package/dist/dom/refresh.js +174 -0
- package/dist/dom/refresh.js.map +7 -0
- package/dist/dom/resource-hints.d.ts +6 -0
- package/dist/dom/resource-hints.js +107 -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 +47 -0
- package/dist/dom/resource-store.js.map +7 -0
- package/dist/dom/resources.d.ts +1 -0
- package/dist/dom/resources.js +46 -0
- package/dist/dom/resources.js.map +7 -0
- package/dist/dom/retained-effects.d.ts +6 -0
- package/dist/dom/retained-effects.js +67 -0
- package/dist/dom/retained-effects.js.map +7 -0
- package/dist/dom/root-internal.d.ts +11 -0
- package/dist/dom/root-internal.js +35 -0
- package/dist/dom/root-internal.js.map +7 -0
- package/dist/dom/root.d.ts +17 -0
- package/dist/dom/root.js +38 -0
- package/dist/dom/root.js.map +7 -0
- package/dist/dom/synthetic-event.d.ts +1 -0
- package/dist/dom/synthetic-event.js +35 -0
- package/dist/dom/synthetic-event.js.map +7 -0
- package/dist/dom/test-utils.d.ts +1 -0
- package/dist/dom/test-utils.js +5 -0
- package/dist/dom/test-utils.js.map +7 -0
- package/dist/dom/transitions.d.ts +9 -0
- package/dist/dom/transitions.js +147 -0
- package/dist/dom/transitions.js.map +7 -0
- package/dist/dom/tree.d.ts +5 -0
- package/dist/dom/tree.js +62 -0
- package/dist/dom/tree.js.map +7 -0
- package/dist/dom/walk.d.ts +2 -0
- package/dist/dom/walk.js +14 -0
- package/dist/dom/walk.js.map +7 -0
- package/dist/next/client.d.ts +9 -0
- package/dist/next/client.js +14 -0
- package/dist/next/client.js.map +7 -0
- package/dist/next/dev-cache-loader.cjs +13 -0
- package/dist/next/index.d.ts +2 -0
- package/dist/next/index.js +97 -0
- package/dist/next/index.js.map +7 -0
- package/dist/next/loader.cjs +10 -0
- package/dist/next/react.d.ts +71 -0
- package/dist/next/react.js +9 -0
- package/dist/next/react.js.map +7 -0
- package/dist/react/act.d.ts +3 -0
- package/dist/react/act.js +124 -0
- package/dist/react/act.js.map +7 -0
- package/dist/react/action-scope.d.ts +17 -0
- package/dist/react/action-scope.js +60 -0
- package/dist/react/action-scope.js.map +7 -0
- package/dist/react/activity.d.ts +7 -0
- package/dist/react/activity.js +7 -0
- package/dist/react/activity.js.map +7 -0
- package/dist/react/children.d.ts +8 -0
- package/dist/react/children.js +76 -0
- package/dist/react/children.js.map +7 -0
- package/dist/react/class.d.ts +36 -0
- package/dist/react/class.js +39 -0
- package/dist/react/class.js.map +7 -0
- package/dist/react/compiler-runtime.d.ts +1 -0
- package/dist/react/compiler-runtime.js +9 -0
- package/dist/react/compiler-runtime.js.map +7 -0
- package/dist/react/context.d.ts +32 -0
- package/dist/react/context.js +25 -0
- package/dist/react/context.js.map +7 -0
- package/dist/react/element.d.ts +13 -0
- package/dist/react/element.js +70 -0
- package/dist/react/element.js.map +7 -0
- package/dist/react/form-state.d.ts +26 -0
- package/dist/react/form-state.js +30 -0
- package/dist/react/form-state.js.map +7 -0
- package/dist/react/hooks.d.ts +67 -0
- package/dist/react/hooks.js +165 -0
- package/dist/react/hooks.js.map +7 -0
- package/dist/react/index.d.ts +99 -0
- package/dist/react/index.js +143 -0
- package/dist/react/index.js.map +7 -0
- package/dist/react/jsx-runtime.d.ts +24 -0
- package/dist/react/jsx-runtime.js +37 -0
- package/dist/react/jsx-runtime.js.map +7 -0
- package/dist/react/memo.d.ts +20 -0
- package/dist/react/memo.js +27 -0
- package/dist/react/memo.js.map +7 -0
- package/dist/react/portal.d.ts +1 -0
- package/dist/react/portal.js +5 -0
- package/dist/react/portal.js.map +7 -0
- package/dist/react/shared-internals.d.ts +52 -0
- package/dist/react/shared-internals.js +22 -0
- package/dist/react/shared-internals.js.map +7 -0
- package/dist/react/suspense.d.ts +15 -0
- package/dist/react/suspense.js +15 -0
- package/dist/react/suspense.js.map +7 -0
- package/dist/react/thenable.d.ts +1 -0
- package/dist/react/thenable.js +25 -0
- package/dist/react/thenable.js.map +7 -0
- package/dist/react/view-transition.d.ts +32 -0
- package/dist/react/view-transition.js +12 -0
- package/dist/react/view-transition.js.map +7 -0
- package/dist/scheduler/index.d.ts +44 -0
- package/dist/scheduler/index.js +109 -0
- package/dist/scheduler/index.js.map +7 -0
- package/dist/server/bootstrap-script.d.ts +3 -0
- package/dist/server/bootstrap-script.js +17 -0
- package/dist/server/bootstrap-script.js.map +7 -0
- package/dist/server/dispatcher.d.ts +57 -0
- package/dist/server/dispatcher.js +157 -0
- package/dist/server/dispatcher.js.map +7 -0
- package/dist/server/escape.d.ts +6 -0
- package/dist/server/escape.js +75 -0
- package/dist/server/escape.js.map +7 -0
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.js +25 -0
- package/dist/server/index.js.map +7 -0
- package/dist/server/insertion-context.d.ts +3 -0
- package/dist/server/insertion-context.js +32 -0
- package/dist/server/renderToString.d.ts +7 -0
- package/dist/server/renderToString.js +33 -0
- package/dist/server/renderToString.js.map +7 -0
- package/dist/server/resource-hints.d.ts +22 -0
- package/dist/server/resource-hints.js +168 -0
- package/dist/server/resource-hints.js.map +7 -0
- package/dist/server/stream-ids.d.ts +3 -0
- package/dist/server/stream-ids.js +8 -0
- package/dist/server/stream.d.ts +61 -0
- package/dist/server/stream.js +418 -0
- package/dist/server/stream.js.map +7 -0
- package/dist/server/walk.d.ts +58 -0
- package/dist/server/walk.js +378 -0
- package/dist/server/walk.js.map +7 -0
- package/dist/vinext/compatibility.d.ts +23 -0
- package/dist/vinext/compatibility.js +127 -0
- package/dist/vinext/compatibility.js.map +7 -0
- package/dist/vinext/flight-timing.d.ts +1 -0
- package/dist/vinext/flight-timing.js +46 -0
- package/dist/vinext/flight-timing.js.map +7 -0
- package/dist/vinext/index.d.ts +5 -0
- package/dist/vinext/index.js +50 -0
- package/dist/vinext/index.js.map +7 -0
- package/dist/vite/index.d.ts +102 -0
- package/dist/vite/index.js +291 -0
- package/dist/vite/index.js.map +7 -0
- package/dist/vite/react18.d.ts +4 -0
- package/dist/vite/react18.js +74 -0
- package/dist/vite/react18.js.map +7 -0
- package/package.json +121 -4
- package/src/cloudflare/index.ts +44 -0
- package/src/core/attributes.ts +20 -0
- package/src/core/browser.ts +34 -0
- package/src/core/class-props.ts +12 -0
- package/src/core/devtools.ts +69 -0
- package/src/core/functions.ts +11 -0
- package/src/core/index.ts +2 -0
- package/src/core/internal.ts +123 -0
- package/src/core/resource-hints.ts +39 -0
- package/src/core/types.ts +39 -0
- package/src/core/unitless-style.ts +1 -0
- package/src/dom/_all.ts +46 -0
- package/src/dom/client.ts +17 -0
- package/src/dom/commit.ts +223 -0
- package/src/dom/devtools-effects.ts +78 -0
- package/src/dom/devtools.ts +527 -0
- package/src/dom/dispatcher.ts +476 -0
- package/src/dom/document-metadata.ts +41 -0
- package/src/dom/dom.ts +181 -0
- package/src/dom/error-info.ts +20 -0
- package/src/dom/event-replay.ts +39 -0
- package/src/dom/features/activity/full.ts +150 -0
- package/src/dom/features/activity/index.ts +1 -0
- package/src/dom/features/activity/stub.ts +12 -0
- package/src/dom/features/class/full.ts +202 -0
- package/src/dom/features/class/index.ts +1 -0
- package/src/dom/features/class/stub.ts +58 -0
- package/src/dom/features/context/full.ts +107 -0
- package/src/dom/features/context/index.ts +1 -0
- package/src/dom/features/context/stub.ts +26 -0
- package/src/dom/features/forward-ref/full.ts +9 -0
- package/src/dom/features/forward-ref/index.ts +1 -0
- package/src/dom/features/forward-ref/stub.ts +15 -0
- package/src/dom/features/fragment-refs/index.ts +1 -0
- package/src/dom/features/fragment-refs/stub.ts +6 -0
- package/src/dom/features/hydration/full.ts +563 -0
- package/src/dom/features/hydration/index.ts +1 -0
- package/src/dom/features/hydration/stub.ts +86 -0
- package/src/dom/features/index.ts +12 -0
- package/src/dom/features/lazy/full.ts +27 -0
- package/src/dom/features/lazy/index.ts +1 -0
- package/src/dom/features/lazy/stub.ts +24 -0
- package/src/dom/features/memo/full.ts +39 -0
- package/src/dom/features/memo/index.ts +1 -0
- package/src/dom/features/memo/stub.ts +13 -0
- package/src/dom/features/portal/full.ts +14 -0
- package/src/dom/features/portal/index.ts +1 -0
- package/src/dom/features/portal/stub.ts +11 -0
- package/src/dom/features/suspense/full.ts +469 -0
- package/src/dom/features/suspense/index.ts +1 -0
- package/src/dom/features/suspense/stub.ts +13 -0
- package/src/dom/features/suspense-runtime/index.ts +1 -0
- package/src/dom/features/suspense-runtime/stub.ts +1 -0
- package/src/dom/features/view-transition/full.ts +292 -0
- package/src/dom/features/view-transition/index.ts +1 -0
- package/src/dom/features/view-transition/resources.ts +123 -0
- package/src/dom/features/view-transition/stub.ts +8 -0
- package/src/dom/features/view-transition/visual.ts +454 -0
- package/src/dom/form-actions.ts +69 -0
- package/src/dom/form-controls.ts +91 -0
- package/src/dom/fragment-instance.ts +462 -0
- package/src/dom/index.ts +49 -0
- package/src/dom/portal.ts +16 -0
- package/src/dom/react-ids.ts +36 -0
- package/src/dom/reconcile.ts +1423 -0
- package/src/dom/refresh.ts +171 -0
- package/src/dom/resource-hints.ts +104 -0
- package/src/dom/resource-store.ts +50 -0
- package/src/dom/resources.ts +47 -0
- package/src/dom/retained-effects.ts +57 -0
- package/src/dom/root-internal.ts +37 -0
- package/src/dom/root.ts +59 -0
- package/src/dom/synthetic-event.ts +22 -0
- package/src/dom/test-utils.ts +1 -0
- package/src/dom/transitions.ts +141 -0
- package/src/dom/tree.ts +56 -0
- package/src/dom/walk.ts +8 -0
- package/src/next/client.ts +10 -0
- package/src/next/dev-cache-loader.cjs +13 -0
- package/src/next/index.ts +95 -0
- package/src/next/loader.cjs +10 -0
- package/src/next/react.ts +7 -0
- package/src/react/act.ts +105 -0
- package/src/react/action-scope.ts +57 -0
- package/src/react/activity.ts +10 -0
- package/src/react/children.ts +86 -0
- package/src/react/class.ts +66 -0
- package/src/react/compiler-runtime.ts +8 -0
- package/src/react/context.ts +46 -0
- package/src/react/element.ts +82 -0
- package/src/react/form-state.ts +35 -0
- package/src/react/hooks.ts +214 -0
- package/src/react/index.ts +91 -0
- package/src/react/jsx-runtime.ts +50 -0
- package/src/react/memo.ts +42 -0
- package/src/react/portal.ts +1 -0
- package/src/react/shared-internals.ts +80 -0
- package/src/react/suspense.ts +18 -0
- package/src/react/thenable.ts +21 -0
- package/src/react/view-transition.ts +41 -0
- package/src/scheduler/index.ts +124 -0
- package/src/server/bootstrap-script.ts +92 -0
- package/src/server/dispatcher.ts +168 -0
- package/src/server/escape.ts +102 -0
- package/src/server/index.ts +26 -0
- package/src/server/insertion-context.ts +28 -0
- package/src/server/renderToString.ts +35 -0
- package/src/server/resource-hints.ts +166 -0
- package/src/server/stream-ids.ts +5 -0
- package/src/server/stream.ts +525 -0
- package/src/server/walk.ts +555 -0
- package/src/vinext/compatibility.ts +122 -0
- package/src/vinext/flight-timing.ts +37 -0
- package/src/vinext/index.ts +47 -0
- package/src/vite/index.ts +476 -0
- package/src/vite/react18.ts +74 -0
- package/vendor/cloudflare-vite-plugin/LICENSE +25 -0
- package/vendor/cloudflare-vite-plugin/README.md +9 -0
- package/vendor/cloudflare-vite-plugin/dist/chunk-U6NEESU5-BmLHqeIt.mjs +43 -0
- package/vendor/cloudflare-vite-plugin/dist/index.d.mts +155 -0
- package/vendor/cloudflare-vite-plugin/dist/index.mjs +94700 -0
- package/vendor/cloudflare-vite-plugin/dist/open-PCXX3ZDZ-DYH87NhH.mjs +530 -0
- package/vendor/cloudflare-vite-plugin/dist/package-4cnqy5mM.mjs +84 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/asset-worker/index.js +5996 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/router-worker/index.js +6414 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/index.js +457 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/module-runner-legacy.js +1129 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/module-runner.js +1259 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/vite-proxy-worker/index.js +31 -0
- package/vendor/cloudflare-vite-plugin/package.json +90 -0
- package/vendor/cloudflare-vite-plugin/provenance.json +26 -0
- package/README.md +0 -3
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
import { devToolsMetadata, readOwnerStack, runWithOwnerStack } from '../../../core/devtools';
|
|
2
|
+
import { drainReplayQueue } from '../../event-replay';
|
|
3
|
+
import { attachRootFiber, createFiberRoot } from '../../root-internal';
|
|
4
|
+
import { createHostNode, setProp } from '../../dom';
|
|
5
|
+
import { attributeName, attributeValue, STRING_BOOLEAN_ATTRS } from '../../../core/attributes';
|
|
6
|
+
import { getCurrentRoot, scheduleUpdate, discardPendingWork, discardPendingEffects, isThenable, findRoot, flushSyncWork, renderRoot, scheduleRootRender, recoverRootError, removeFiber } from '../../reconcile';
|
|
7
|
+
import { isFunction, isReservedProp } from '../../../core/functions';
|
|
8
|
+
import { clearHostContainer, documentMetadataParent, DOCUMENT_HEAD_TAGS, DOCUMENT_SHELL_TAGS } from '../../document-metadata';
|
|
9
|
+
import { componentStack } from '../../error-info';
|
|
10
|
+
export { reactId, forkId, assignReactIds } from '../../react-ids';
|
|
11
|
+
import { FiberTag, type Fiber, type FiberRoot, type ReactNode, } from '../../../core';
|
|
12
|
+
import { hydratedFormStates } from '../../../react/form-state';
|
|
13
|
+
import { queueBeforeMutation, queueMutation, queueProp, queueText, onCommitRollback, onCommitFailure } from '../../commit';
|
|
14
|
+
import { syncTextareaValue } from '../../form-controls';
|
|
15
|
+
// Re-export from event-replay so all hydration concerns live behind one
|
|
16
|
+
// feature boundary — the plugin's stub swap strips drainReplayQueue too.
|
|
17
|
+
export { drainReplayQueue };
|
|
18
|
+
function findNearestSafeHostAboveComposite(fiber: Fiber | null): Fiber | null {
|
|
19
|
+
let host: Fiber | null = null;
|
|
20
|
+
let f = fiber;
|
|
21
|
+
while (f) {
|
|
22
|
+
if (f.t === FiberTag.Host && f.n) {
|
|
23
|
+
if (DOCUMENT_SHELL_TAGS.test(f.type.toLowerCase()))
|
|
24
|
+
return null;
|
|
25
|
+
const parentTag = f.p?.t as number;
|
|
26
|
+
if (!host || (parentTag > FiberTag.Text && parentTag < FiberTag.Suspense)) {
|
|
27
|
+
host = f;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
f = f.p;
|
|
31
|
+
}
|
|
32
|
+
return host;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Hydration cursor: walks existing DOM children in document order so we can
|
|
36
|
+
* adopt them during fiber tree construction. One cursor per host parent.
|
|
37
|
+
*
|
|
38
|
+
* `endBefore` scopes the cursor to a subrange — used by rehydrateBoundary()
|
|
39
|
+
* so we only adopt DOM up to the closing `/$` marker for that boundary.
|
|
40
|
+
*/
|
|
41
|
+
export class HydrationCursor {
|
|
42
|
+
n: ChildNode | null;
|
|
43
|
+
p: Node;
|
|
44
|
+
e: ChildNode | null;
|
|
45
|
+
constructor(parent: Node, start: ChildNode | null = null, endBefore: ChildNode | null = null) {
|
|
46
|
+
this.p = parent;
|
|
47
|
+
this.n = start ?? parent.firstChild;
|
|
48
|
+
this.e = endBefore;
|
|
49
|
+
}
|
|
50
|
+
skipClaimedMarkers(): void {
|
|
51
|
+
while (this.n && (CLAIMED.has(this.n) || (this.n.nodeType === 8 && /^\/?&$/.test((this.n as Comment).data))))
|
|
52
|
+
this.n = this.n.nextSibling;
|
|
53
|
+
}
|
|
54
|
+
take(): ChildNode | null {
|
|
55
|
+
while (this.n && this.n !== this.e) {
|
|
56
|
+
const n = this.n;
|
|
57
|
+
// Skip anything that isn't an element (1) or text (3):
|
|
58
|
+
// comments (8), doctype (10), processing instructions (7), cdata (4).
|
|
59
|
+
this.n = n.nextSibling;
|
|
60
|
+
if (!CLAIMED.has(n) && (n.nodeType === 1 || n.nodeType === 3))
|
|
61
|
+
return n;
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
has(): boolean {
|
|
66
|
+
const position = this.n;
|
|
67
|
+
const found = this.take() !== null;
|
|
68
|
+
this.n = position;
|
|
69
|
+
return found;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Position-insensitive lookup for head/html adoption. Scans forward past
|
|
74
|
+
* non-matching nodes without removing them, matching by tag AND the key
|
|
75
|
+
* attributes that identify head elements uniquely (rel/href for links,
|
|
76
|
+
* name/property for meta, src for script). Non-matching nodes stay in
|
|
77
|
+
* place so the SSR'd stylesheet/script order is preserved.
|
|
78
|
+
*/
|
|
79
|
+
function findMetadata(parent: Node | undefined, tag: string, props: Record<string, any>, fallback?: HydrationCursor): ChildNode | null {
|
|
80
|
+
const keys = HEAD_KEY_ATTRS[tag] ?? [];
|
|
81
|
+
for (const location of [parent, fallback]) {
|
|
82
|
+
if (!location) continue;
|
|
83
|
+
const cursor = location instanceof HydrationCursor ? location : null;
|
|
84
|
+
scan: for (let node = cursor ? cursor.n : (location as Node).firstChild; node && node !== cursor?.e; node = node.nextSibling) {
|
|
85
|
+
const el = node as Element;
|
|
86
|
+
if (el.localName !== tag || CLAIMED.has(el))
|
|
87
|
+
continue;
|
|
88
|
+
for (const key of keys) {
|
|
89
|
+
const value = props[key];
|
|
90
|
+
if (hydrationAttribute(el, attributeName(key)) !== (value == null ? null : String(value)))
|
|
91
|
+
continue scan;
|
|
92
|
+
}
|
|
93
|
+
claimHydrationNode(el);
|
|
94
|
+
return el;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const PROD_HYDRATION_ERROR = 'Hydration mismatch.';
|
|
100
|
+
const BOUNDARY_MARKER = /^(\$[?!E~]?)(\d*)$/;
|
|
101
|
+
export interface HydrationBailoutError extends Error {
|
|
102
|
+
f: Fiber | null;
|
|
103
|
+
}
|
|
104
|
+
export const isHydrationBailout = (error: unknown): error is HydrationBailoutError => (!!error && (error as any).f !== undefined);
|
|
105
|
+
export function endHydration(root: FiberRoot): void {
|
|
106
|
+
root.h = false;
|
|
107
|
+
root.r.hc = undefined;
|
|
108
|
+
}
|
|
109
|
+
interface HydrateRootOptions {
|
|
110
|
+
formState?: unknown[] | null;
|
|
111
|
+
identifierStrategy?: 'react';
|
|
112
|
+
identifierPrefix?: string;
|
|
113
|
+
onRecoverableError?: import('../../../core').RecoverableErrorHandler;
|
|
114
|
+
onCaughtError?: import('../../../core').RecoverableErrorHandler;
|
|
115
|
+
onUncaughtError?: import('../../../core').RecoverableErrorHandler;
|
|
116
|
+
}
|
|
117
|
+
interface HydratedRoot {
|
|
118
|
+
render(children: ReactNode): void;
|
|
119
|
+
unmount(): void;
|
|
120
|
+
}
|
|
121
|
+
// Complete hydration before layout effects can synchronously update a store.
|
|
122
|
+
export function queueHydrationEnd(root: FiberRoot): void {
|
|
123
|
+
if (root.h) queueBeforeMutation(() => endHydration(root));
|
|
124
|
+
}
|
|
125
|
+
export function beginHydration(root: FiberRoot): void {
|
|
126
|
+
if (process.env.NODE_ENV !== 'production') devToolsMetadata.hydratedRoots.add(root);
|
|
127
|
+
root.ic = 0;
|
|
128
|
+
root.h = true;
|
|
129
|
+
root.r.hc = new HydrationCursor(root.c);
|
|
130
|
+
}
|
|
131
|
+
// Head elements that we match against server DOM by attribute signature.
|
|
132
|
+
const HEAD_KEY_ATTRS: Record<string, ReadonlyArray<string>> = {
|
|
133
|
+
link: ['rel', 'href', 'sizes', 'type'],
|
|
134
|
+
meta: ['name', 'property', 'charSet', 'httpEquiv'],
|
|
135
|
+
script: ['src', 'type'],
|
|
136
|
+
style: ['id', 'media', 'nonce', 'title'],
|
|
137
|
+
};
|
|
138
|
+
// DOM elements already claimed by some fiber during this hydration pass.
|
|
139
|
+
const CLAIMED = new WeakSet<Node>();
|
|
140
|
+
function claimHydrationNode(node: Node): void {
|
|
141
|
+
CLAIMED.add(node);
|
|
142
|
+
const release = () => { CLAIMED.delete(node); };
|
|
143
|
+
onCommitRollback(release);
|
|
144
|
+
onCommitFailure(release);
|
|
145
|
+
}
|
|
146
|
+
const hydrationAttribute = (el: Element, name: string): string | null => (name === 'nonce' && 'nonce' in el && el.hasAttribute(name)
|
|
147
|
+
? (el as HTMLElement).nonce ?? ''
|
|
148
|
+
: el.getAttribute(name));
|
|
149
|
+
function failHydration(fiber: Fiber, error: Error = new Error(PROD_HYDRATION_ERROR), recoverInPlace?: boolean): boolean {
|
|
150
|
+
const root = findRoot(fiber);
|
|
151
|
+
if (root?.re) {
|
|
152
|
+
if (process.env.NODE_ENV !== 'production') runWithOwnerStack(readOwnerStack(fiber), () => root.re!(error, { componentStack: componentStack(fiber) }));
|
|
153
|
+
else root.re(error, { componentStack: componentStack(fiber) });
|
|
154
|
+
}
|
|
155
|
+
if (recoverInPlace)
|
|
156
|
+
return true;
|
|
157
|
+
abortHydration(error, findHostRecoveryParent(fiber) ?? fiber);
|
|
158
|
+
}
|
|
159
|
+
function onMismatch(fiber: Fiber, actualNode: ChildNode | null): void {
|
|
160
|
+
failHydration(fiber, process.env.NODE_ENV !== 'production'
|
|
161
|
+
? new Error(`Hydration mismatch: expected <${(fiber.type as string) ?? 'text'}> but found ${actualNode ? (actualNode.nodeType === 1 ? (actualNode as Element).tagName : 'text') : 'nothing'}.`)
|
|
162
|
+
: undefined);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Inspect the current cursor position for a streaming-suspense boundary
|
|
166
|
+
* marker emitted by the server. Returns info + advances the cursor past the
|
|
167
|
+
* marker pair (start comment + fallback/real content + end comment).
|
|
168
|
+
*/
|
|
169
|
+
export type BoundaryInfo = [
|
|
170
|
+
0 | 1 | 2 | 3,
|
|
171
|
+
number,
|
|
172
|
+
Comment,
|
|
173
|
+
Comment
|
|
174
|
+
];
|
|
175
|
+
export function finishHydration(fiber: Fiber, isTextarea: boolean): void {
|
|
176
|
+
const root = fiber.r!;
|
|
177
|
+
if (!root.h || isTextarea || fiber.v?.dangerouslySetInnerHTML != null)
|
|
178
|
+
return;
|
|
179
|
+
const tag = fiber.type.toLowerCase();
|
|
180
|
+
if (!DOCUMENT_SHELL_TAGS.test(tag) && fiber.hc?.has()) {
|
|
181
|
+
const error = new Error(process.env.NODE_ENV !== 'production'
|
|
182
|
+
? `Hydration mismatch: server rendered extra nodes inside <${tag}>.` : PROD_HYDRATION_ERROR);
|
|
183
|
+
root.re?.(error, { componentStack: null });
|
|
184
|
+
abortHydration(error, fiber);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
export function adoptTextDom(fiber: Fiber, parent: Fiber, text: string): boolean {
|
|
188
|
+
const cursor = findHostParent(parent).hc;
|
|
189
|
+
if (!cursor)
|
|
190
|
+
return false;
|
|
191
|
+
const candidate = cursor.take();
|
|
192
|
+
if (candidate?.nodeType !== 3) {
|
|
193
|
+
onMismatch(fiber, candidate);
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
if ((candidate as Text).data !== text) {
|
|
197
|
+
failHydration(fiber, process.env.NODE_ENV !== 'production'
|
|
198
|
+
? new Error(`Hydration text mismatch: expected "${text}" but found "${(candidate as Text).data}".`)
|
|
199
|
+
: undefined, canRecoverHydrationPropMismatch(candidate));
|
|
200
|
+
queueText(candidate as Text, text);
|
|
201
|
+
}
|
|
202
|
+
fiber.n = candidate;
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
export const getHydrationCursor = (hostFiber: Fiber): HydrationCursor | undefined => (hostFiber.hc);
|
|
206
|
+
let hydrationProbeDocument: Document | undefined;
|
|
207
|
+
function hydrateProps(fiber: Fiber, el: Element, props: Record<string, any>, tag: string, isSvg: boolean): void {
|
|
208
|
+
const recoverInPlace = canRecoverHydrationPropMismatch(el, tag);
|
|
209
|
+
let expected: Element | undefined;
|
|
210
|
+
for (const k in props) {
|
|
211
|
+
const value = props[k];
|
|
212
|
+
if (isReservedProp(k) || k === 'suppressHydrationWarning' || k === 'suppressContentEditableWarning' || isHydrationFormProp(tag, k)) continue;
|
|
213
|
+
const event = isFunction(value) && (k === 'action' || k === 'formAction' || k[0] === 'o' && k[1] === 'n');
|
|
214
|
+
if (event) queueProp(el, k, value, undefined, isSvg);
|
|
215
|
+
if (event || props.suppressHydrationWarning) continue;
|
|
216
|
+
let mismatch: boolean;
|
|
217
|
+
if (k === 'dangerouslySetInnerHTML') {
|
|
218
|
+
let html = value?.__html;
|
|
219
|
+
if (html == null || html === el.innerHTML) continue;
|
|
220
|
+
if (tag !== 'script' && tag !== 'style') {
|
|
221
|
+
// Raw HTML must use the live document's parsing context.
|
|
222
|
+
// Template content treats noscript differently when scripting is enabled.
|
|
223
|
+
const probe = createHostNode(tag, isSvg, el.ownerDocument);
|
|
224
|
+
probe.innerHTML = html;
|
|
225
|
+
html = probe.innerHTML;
|
|
226
|
+
}
|
|
227
|
+
mismatch = (el as HTMLElement).innerHTML !== '' + html;
|
|
228
|
+
} else {
|
|
229
|
+
const attr = attributeName(k, isSvg);
|
|
230
|
+
if (k === 'style' || k === 'value' && value != null && value !== false) {
|
|
231
|
+
expected ??= createHostNode(tag, isSvg, hydrationProbeDocument ??= el.ownerDocument.implementation.createHTMLDocument(''));
|
|
232
|
+
setProp(expected, k, value, undefined, isSvg);
|
|
233
|
+
mismatch = k === 'style'
|
|
234
|
+
? !hydrationStylesMatch((el as HTMLElement).style, (expected as HTMLElement).style)
|
|
235
|
+
: expected.getAttribute(attr) !== hydrationAttribute(el, attr);
|
|
236
|
+
} else {
|
|
237
|
+
const stringified = STRING_BOOLEAN_ATTRS.test(attr) || /^(aria|data)-./.test(k);
|
|
238
|
+
const desired = stringified ? value == null ? null : '' + value
|
|
239
|
+
: value === false ? null : attributeValue(k, value, attr);
|
|
240
|
+
mismatch = desired !== hydrationAttribute(el, attr);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (mismatch) {
|
|
245
|
+
if (recoverInPlace) queueProp(el, k, value, undefined, isSvg);
|
|
246
|
+
failHydration(fiber, process.env.NODE_ENV !== 'production' ? new Error(`Hydration mismatch on <${tag}> for "${k}".`) : undefined, recoverInPlace);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Try to adopt a DOM node for this host fiber. Returns true if adopted.
|
|
252
|
+
* Attaches existing attrs/children via separate hydrate pass.
|
|
253
|
+
*/
|
|
254
|
+
export function adoptHostDom(fiber: Fiber, parent: Fiber): boolean {
|
|
255
|
+
const hostParent = findHostParent(parent);
|
|
256
|
+
const cursor = hostParent.hc;
|
|
257
|
+
if (!cursor)
|
|
258
|
+
return false;
|
|
259
|
+
const tag = (fiber.type as string).toLowerCase();
|
|
260
|
+
const props = fiber.v ?? {};
|
|
261
|
+
const documentHeadParent = documentMetadataParent(fiber) || (cursor.p.nodeType === 9 && DOCUMENT_HEAD_TAGS.test(tag)
|
|
262
|
+
? (cursor.p as Document).head
|
|
263
|
+
: null);
|
|
264
|
+
const parentTag = (cursor.p as Element).localName;
|
|
265
|
+
const isHeadish = parentTag === 'head' || parentTag === 'html' || !!documentHeadParent;
|
|
266
|
+
const metadataParent = documentHeadParent || (isHeadish ? cursor.p
|
|
267
|
+
: cursor.p.nodeType === 9 && tag !== 'html' ? (cursor.p as Document).body : null);
|
|
268
|
+
// Prefer hoisted metadata, then claim its original host position.
|
|
269
|
+
const candidate = metadataParent ? findMetadata(metadataParent, tag, props, documentHeadParent ? cursor : undefined) : cursor.take();
|
|
270
|
+
if (!candidate) {
|
|
271
|
+
// Client expected a host here but the cursor is exhausted — server gave
|
|
272
|
+
// fewer children than the client tree. Report the structural gap (React
|
|
273
|
+
// fires `onRecoverableError` for this exact case) and let the reconciler
|
|
274
|
+
// mount a fresh DOM for this fiber below.
|
|
275
|
+
// Exception: <head> children are position-insensitive; a missing match
|
|
276
|
+
// there means "server didn't hoist this one yet", which we silently mount.
|
|
277
|
+
if (!isHeadish)
|
|
278
|
+
onMismatch(fiber, null);
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
if ((candidate as Element).localName?.toLowerCase() !== tag) {
|
|
282
|
+
// mismatch — log and re-render fresh from this point
|
|
283
|
+
onMismatch(fiber, candidate);
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
fiber.n = candidate;
|
|
287
|
+
// Apply props (attach events, sync IDL props). Don't re-set existing attrs.
|
|
288
|
+
const isSvg = tag === 'svg' ||
|
|
289
|
+
((candidate as Element).namespaceURI === 'http://www.w3.org/2000/svg' &&
|
|
290
|
+
tag !== 'foreignobject');
|
|
291
|
+
// Form defaults precede event registration so input type owns event mapping.
|
|
292
|
+
if (tag === 'input' || tag === 'textarea')
|
|
293
|
+
queueHydrationFormState(candidate as Element, props, tag);
|
|
294
|
+
hydrateProps(fiber, candidate as Element, props, tag, isSvg);
|
|
295
|
+
// React SSR adds transport fields for progressively enhanced Server Actions.
|
|
296
|
+
// They have no corresponding client fibers and must not consume child slots.
|
|
297
|
+
if (isFunction(tag === 'form' ? props.action : props.formAction)) {
|
|
298
|
+
for (const child of (candidate as Element).children) {
|
|
299
|
+
if (child.tagName === 'INPUT' && child.getAttribute('type') === 'hidden' && child.getAttribute('name')?.startsWith('$ACTION_'))
|
|
300
|
+
claimHydrationNode(child);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
// Set up child cursor for this host's children
|
|
304
|
+
// Recovery keeps the whole component tree, but mounts fresh children inside
|
|
305
|
+
// the failed host. Hosts outside it still adopt the existing document shell.
|
|
306
|
+
if (fiber.r!.hr !== candidate) {
|
|
307
|
+
fiber.hc = new HydrationCursor(candidate);
|
|
308
|
+
}
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
export function findHostParent(fiber: Fiber): Fiber {
|
|
312
|
+
let f: Fiber | null = fiber;
|
|
313
|
+
while (f) {
|
|
314
|
+
// A fiber explicitly holding a cursor acts as a boundary for hydration
|
|
315
|
+
// (e.g. Suspense with a scoped cursor during fallback/boundary hydration).
|
|
316
|
+
if (f.hc || f.t === FiberTag.Host || f.t === FiberTag.Root || f.t === FiberTag.Portal) {
|
|
317
|
+
return f;
|
|
318
|
+
}
|
|
319
|
+
f = f.p;
|
|
320
|
+
}
|
|
321
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
322
|
+
throw new Error('No host parent found');
|
|
323
|
+
}
|
|
324
|
+
throw new Error();
|
|
325
|
+
}
|
|
326
|
+
export function clearHydrationCursor(hostFiber: Fiber): void {
|
|
327
|
+
hostFiber.hc = undefined;
|
|
328
|
+
}
|
|
329
|
+
export function abortHydration(cause: unknown, fiber: Fiber | null = null): never {
|
|
330
|
+
throw Object.assign(new Error(PROD_HYDRATION_ERROR, { cause }), { f: fiber });
|
|
331
|
+
}
|
|
332
|
+
export function setHydrationCursor(hostFiber: Fiber, cursor: HydrationCursor): void {
|
|
333
|
+
hostFiber.hc = cursor;
|
|
334
|
+
}
|
|
335
|
+
function resetAfterHydrationFailure(root: FiberRoot, container: Element | Document, recoveryContainer: Element | Document = container): void {
|
|
336
|
+
// Retire committed subscriptions and portals without removing the document shell.
|
|
337
|
+
removeFiber(root.r, false);
|
|
338
|
+
discardPendingWork(root);
|
|
339
|
+
discardPendingEffects(root);
|
|
340
|
+
clearHydrationContainer(recoveryContainer);
|
|
341
|
+
attachRootFiber(root, container);
|
|
342
|
+
root.h = false;
|
|
343
|
+
}
|
|
344
|
+
const canRecoverHydrationPropMismatch = (node: Node, tag?: string): boolean => ((DOCUMENT_SHELL_TAGS.test(tag!) ||
|
|
345
|
+
!!node.ownerDocument?.head?.contains(node)));
|
|
346
|
+
function findHostRecoveryParent(fiber: Fiber): Fiber | null {
|
|
347
|
+
if (fiber.t === FiberTag.Text) {
|
|
348
|
+
let directHost = fiber.p;
|
|
349
|
+
while (directHost && (directHost.t !== FiberTag.Host || !directHost.n)) {
|
|
350
|
+
directHost = directHost.p;
|
|
351
|
+
}
|
|
352
|
+
if (!directHost)
|
|
353
|
+
return null;
|
|
354
|
+
let hasEvent;
|
|
355
|
+
const props = directHost.v ?? directHost.m;
|
|
356
|
+
if (props) {
|
|
357
|
+
for (const k in props) {
|
|
358
|
+
if (k[0] === 'o' && k[1] === 'n' && isFunction(props[k])) {
|
|
359
|
+
hasEvent = true;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return findNearestSafeHostAboveComposite(hasEvent || directHost.p?.t === FiberTag.Host ? directHost.p : directHost);
|
|
364
|
+
}
|
|
365
|
+
return findNearestSafeHostAboveComposite(fiber.p);
|
|
366
|
+
}
|
|
367
|
+
export function resumeHydration(fiber: Fiber, root: FiberRoot): (() => void) | undefined {
|
|
368
|
+
if (fiber.b?.p !== true)
|
|
369
|
+
return;
|
|
370
|
+
delete fiber.b.p;
|
|
371
|
+
const previous = root.h;
|
|
372
|
+
root.h = true;
|
|
373
|
+
return () => {
|
|
374
|
+
root.h = previous;
|
|
375
|
+
clearHydrationCursor(fiber);
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
export function tryConsumeBoundary(parent: Fiber): BoundaryInfo | null {
|
|
379
|
+
const cursor = findHostParent(parent).hc;
|
|
380
|
+
if (!cursor)
|
|
381
|
+
return null;
|
|
382
|
+
cursor.skipClaimedMarkers();
|
|
383
|
+
const peek = cursor.n;
|
|
384
|
+
if (!peek || peek.nodeType !== 8)
|
|
385
|
+
return null;
|
|
386
|
+
const data = (peek as Comment).data;
|
|
387
|
+
const m = BOUNDARY_MARKER.exec(data);
|
|
388
|
+
if (!m)
|
|
389
|
+
return null;
|
|
390
|
+
const kind = (m[1] === '$?' || m[1] === '$~') ? 1 : m[1] === '$!' ? 2 : m[1] === '$E' ? 3 : 0;
|
|
391
|
+
const id = Number(m[2]);
|
|
392
|
+
const startMark = peek as Comment;
|
|
393
|
+
// Advance past the start comment
|
|
394
|
+
cursor.n = startMark.nextSibling;
|
|
395
|
+
// Locate end comment: closest <!--/$-->
|
|
396
|
+
let scan = startMark.nextSibling;
|
|
397
|
+
let depth = 0;
|
|
398
|
+
while (scan) {
|
|
399
|
+
if (scan.nodeType === 8) {
|
|
400
|
+
const data = (scan as Comment).data;
|
|
401
|
+
if (BOUNDARY_MARKER.test(data))
|
|
402
|
+
depth++;
|
|
403
|
+
else if (data === '/$' && depth-- === 0)
|
|
404
|
+
return [kind, id, startMark, scan as Comment];
|
|
405
|
+
}
|
|
406
|
+
scan = scan.nextSibling;
|
|
407
|
+
}
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
function queueHydrationFormState(el: Element, props: any, tag: string): void {
|
|
411
|
+
queueMutation(() => {
|
|
412
|
+
if (tag === 'input') {
|
|
413
|
+
const input = el as HTMLInputElement;
|
|
414
|
+
if (props.type != null)
|
|
415
|
+
input.type = props.type;
|
|
416
|
+
const value = props.value ?? props.defaultValue;
|
|
417
|
+
if (value != null && (props.value != null || (input.type !== 'submit' && input.type !== 'reset'))) {
|
|
418
|
+
input.defaultValue = '' + value;
|
|
419
|
+
}
|
|
420
|
+
// Mark checked as dirty before changing its default, including clean SSR
|
|
421
|
+
// inputs whose client default differs. This also preserves radio groups.
|
|
422
|
+
input.checked = input.checked;
|
|
423
|
+
input.defaultChecked = !!(props.checked ?? props.defaultChecked);
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
syncTextareaValue(el as HTMLTextAreaElement, props, true);
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
function releaseClaims(container: Element | Document): void {
|
|
431
|
+
for (const node of container.querySelectorAll('*'))
|
|
432
|
+
CLAIMED.delete(node);
|
|
433
|
+
}
|
|
434
|
+
function clearHydrationContainer(container: Element | Document): void {
|
|
435
|
+
queueMutation(() => clearHostContainer(container));
|
|
436
|
+
}
|
|
437
|
+
export function advanceCursorPast(parent: Fiber, node: Node): void {
|
|
438
|
+
const cursor = findHostParent(parent).hc;
|
|
439
|
+
if (!cursor)
|
|
440
|
+
return;
|
|
441
|
+
cursor.n = node.nextSibling;
|
|
442
|
+
}
|
|
443
|
+
const isHydrationFormProp = (tag: string, key: string): boolean => (((/^(input|textarea|select)$/.test(tag) && (key === 'value' || key === 'defaultValue')) ||
|
|
444
|
+
(tag === 'input' && (key === 'checked' || key === 'defaultChecked')) ||
|
|
445
|
+
(tag === 'option' && key === 'selected')));
|
|
446
|
+
function hydrationStylesMatch(actual: CSSStyleDeclaration, expected: CSSStyleDeclaration): boolean {
|
|
447
|
+
for (let index = 0; index < expected.length; index++) {
|
|
448
|
+
const property = expected.item(index);
|
|
449
|
+
if (actual.getPropertyValue(property) !== expected.getPropertyValue(property) ||
|
|
450
|
+
actual.getPropertyPriority(property) !== expected.getPropertyPriority(property)) {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return true;
|
|
455
|
+
}
|
|
456
|
+
export function recoverHydration(root: FiberRoot, error: unknown): boolean {
|
|
457
|
+
if (!isHydrationBailout(error))
|
|
458
|
+
return false;
|
|
459
|
+
const container = root.c as Element | Document;
|
|
460
|
+
const children = root.r.v?.children ?? null;
|
|
461
|
+
const host = error.f;
|
|
462
|
+
const recoveryContainer = host?.t === FiberTag.Host && host.n && findNearestSafeHostAboveComposite(host.p)
|
|
463
|
+
? host.n as Element : container;
|
|
464
|
+
resetAfterHydrationFailure(root, container, recoveryContainer);
|
|
465
|
+
if (recoveryContainer !== container) {
|
|
466
|
+
releaseClaims(container);
|
|
467
|
+
root.hr = recoveryContainer;
|
|
468
|
+
beginHydration(root);
|
|
469
|
+
}
|
|
470
|
+
try {
|
|
471
|
+
flushSyncWork(() => renderRoot(root, children));
|
|
472
|
+
}
|
|
473
|
+
catch (clientError) {
|
|
474
|
+
resetAfterHydrationFailure(root, container);
|
|
475
|
+
if (recoverRootError(clientError))
|
|
476
|
+
return true;
|
|
477
|
+
throw clientError;
|
|
478
|
+
}
|
|
479
|
+
finally {
|
|
480
|
+
endHydration(root);
|
|
481
|
+
root.hr = undefined;
|
|
482
|
+
}
|
|
483
|
+
return true;
|
|
484
|
+
}
|
|
485
|
+
const formatHydrationValue = (value: string | null): string => (value == null ? 'nothing' : JSON.stringify(value));
|
|
486
|
+
export function deferHydration(_fiber: Fiber, thenable: Promise<any>): boolean {
|
|
487
|
+
// A suspended component does not own a known host range. Its hydration
|
|
488
|
+
// owner, either the root or a marked boundary, must pause and retry it.
|
|
489
|
+
if (getCurrentRoot()?.h) throw thenable;
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
export function hydrateRootImpl(container: Element | Document, initialChildren: ReactNode, options: HydrateRootOptions): HydratedRoot {
|
|
493
|
+
const root = createFiberRoot(container, options);
|
|
494
|
+
if (options.formState)
|
|
495
|
+
hydratedFormStates.set(root, {
|
|
496
|
+
value: options.formState[0],
|
|
497
|
+
consume(fiber) {
|
|
498
|
+
const cursor = findHostParent(fiber.p!).hc;
|
|
499
|
+
cursor?.skipClaimedMarkers();
|
|
500
|
+
const marker = cursor?.n;
|
|
501
|
+
if (!marker || marker.nodeType !== 8 || !/^F!?$/.test((marker as Comment).data))
|
|
502
|
+
throw new Error(process.env.NODE_ENV !== 'production' ? 'Missing server form state marker during hydration.' : '');
|
|
503
|
+
cursor!.n = marker.nextSibling;
|
|
504
|
+
return (marker as Comment).data === 'F!';
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
let generation = 0;
|
|
508
|
+
let active = true;
|
|
509
|
+
function hydrate(children: ReactNode): void {
|
|
510
|
+
const attempt = ++generation;
|
|
511
|
+
let hydrationError: unknown = null;
|
|
512
|
+
beginHydration(root);
|
|
513
|
+
try {
|
|
514
|
+
flushSyncWork(() => renderRoot(root, children));
|
|
515
|
+
}
|
|
516
|
+
catch (error) {
|
|
517
|
+
hydrationError = error;
|
|
518
|
+
}
|
|
519
|
+
finally {
|
|
520
|
+
endHydration(root);
|
|
521
|
+
}
|
|
522
|
+
if (isThenable(hydrationError)) {
|
|
523
|
+
discardPendingWork(root);
|
|
524
|
+
discardPendingEffects(root);
|
|
525
|
+
const retry = () => {
|
|
526
|
+
if (!active || attempt !== generation)
|
|
527
|
+
return;
|
|
528
|
+
// Preparation was rolled back. The next pass must be able to claim
|
|
529
|
+
// metadata and document siblings that the abandoned pass visited.
|
|
530
|
+
releaseClaims(container);
|
|
531
|
+
hydrate(children);
|
|
532
|
+
};
|
|
533
|
+
hydrationError.then(retry, retry);
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (hydrationError && !recoverHydration(root, hydrationError))
|
|
537
|
+
throw hydrationError;
|
|
538
|
+
drainReplayQueue();
|
|
539
|
+
}
|
|
540
|
+
hydrate(initialChildren);
|
|
541
|
+
return {
|
|
542
|
+
render(children) {
|
|
543
|
+
generation++;
|
|
544
|
+
if (root.r.m === null) {
|
|
545
|
+
releaseClaims(container);
|
|
546
|
+
hydrate(children);
|
|
547
|
+
}
|
|
548
|
+
else
|
|
549
|
+
scheduleRootRender(root, () => renderRoot(root, children));
|
|
550
|
+
},
|
|
551
|
+
unmount() {
|
|
552
|
+
discardPendingWork(root);
|
|
553
|
+
active = false;
|
|
554
|
+
generation++;
|
|
555
|
+
const pending = root.r.m === null;
|
|
556
|
+
flushSyncWork(() => {
|
|
557
|
+
renderRoot(root, null);
|
|
558
|
+
if (pending)
|
|
559
|
+
clearHydrationContainer(container);
|
|
560
|
+
});
|
|
561
|
+
},
|
|
562
|
+
};
|
|
563
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './full'
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { clientReactId } from '../../react-ids'
|
|
2
|
+
import type { Fiber, FiberRoot } from '../../../core'
|
|
3
|
+
|
|
4
|
+
// Stub: Hydration feature disabled. Every adoption attempt returns "no match",
|
|
5
|
+
// all cursor operations no-op, and `beginHydration` throws so `hydrateRoot`
|
|
6
|
+
// fails loudly — apps that opt out of hydration should use `createRoot`.
|
|
7
|
+
// The SSR walk-the-DOM machinery, streaming-boundary coordination, head
|
|
8
|
+
// element matching, and the WeakMap of cursors per fiber are all stripped.
|
|
9
|
+
|
|
10
|
+
export class HydrationCursor {
|
|
11
|
+
n: ChildNode | null = null
|
|
12
|
+
p: Node
|
|
13
|
+
e: ChildNode | null = null
|
|
14
|
+
constructor(parent?: Node, _s?: ChildNode | null, _e?: ChildNode | null) {
|
|
15
|
+
this.p = parent as Node
|
|
16
|
+
}
|
|
17
|
+
take(): ChildNode | null {
|
|
18
|
+
return null
|
|
19
|
+
}
|
|
20
|
+
head(): ChildNode | null {
|
|
21
|
+
return null
|
|
22
|
+
}
|
|
23
|
+
has(): boolean {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type BoundaryInfo = [0 | 1 | 2 | 3, number, Comment, Comment]
|
|
29
|
+
|
|
30
|
+
export function beginHydration(_root: FiberRoot): never {
|
|
31
|
+
throw new Error(
|
|
32
|
+
process.env.NODE_ENV !== 'production' ? '`hydrateRoot` requires the `hydration` feature. ' +
|
|
33
|
+
'Enable it via @tanstack/redact/vite `features.hydration = true`, ' +
|
|
34
|
+
'or use `createRoot` for a SPA (no SSR hydration).' : '',
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function endHydration(_root: FiberRoot): void {}
|
|
39
|
+
|
|
40
|
+
export const queueHydrationEnd = undefined
|
|
41
|
+
|
|
42
|
+
export const tryConsumeBoundary = (_parent: Fiber): BoundaryInfo | null => (null)
|
|
43
|
+
|
|
44
|
+
export function advanceCursorPast(_parent: Fiber, _node: Node): void {}
|
|
45
|
+
|
|
46
|
+
export const getHydrationCursor = (_hostFiber: Fiber): HydrationCursor | undefined => (undefined)
|
|
47
|
+
|
|
48
|
+
export function setHydrationCursor(_hostFiber: Fiber, _cursor: HydrationCursor): void {}
|
|
49
|
+
|
|
50
|
+
export function clearHydrationCursor(_hostFiber: Fiber): void {}
|
|
51
|
+
|
|
52
|
+
export function resumeHydration(_f: Fiber, _root: FiberRoot): (() => void) | undefined { return undefined }
|
|
53
|
+
|
|
54
|
+
export const adoptHostDom: (_f: Fiber, _parent: Fiber) => boolean = () => false
|
|
55
|
+
|
|
56
|
+
export const adoptTextDom: (_f: Fiber, _parent: Fiber, _text: string) => boolean = () => false
|
|
57
|
+
|
|
58
|
+
export const findHostParent = (fiber: Fiber): Fiber => (fiber)
|
|
59
|
+
|
|
60
|
+
export function drainReplayQueue(): void {}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export interface HydrationBailoutError extends Error {
|
|
64
|
+
f: Fiber | null
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function isHydrationBailout(_error: unknown): _error is HydrationBailoutError
|
|
68
|
+
export function isHydrationBailout(): boolean { return false }
|
|
69
|
+
|
|
70
|
+
export const recoverHydration: (_root: FiberRoot, _error: unknown) => boolean = () => false
|
|
71
|
+
|
|
72
|
+
// No hydration recovery exists in this preset, so preserve the original error.
|
|
73
|
+
export function abortHydration(cause: unknown, _fiber?: Fiber | null): never {
|
|
74
|
+
throw cause
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const hydrateRootImpl = beginHydration
|
|
78
|
+
|
|
79
|
+
export const reactId = (_f: Fiber, root: FiberRoot): string => (clientReactId(root))
|
|
80
|
+
export const forkId: (base: bigint, _count: number, _index: number) => bigint = base => base
|
|
81
|
+
|
|
82
|
+
export function assignReactIds(_parent: Fiber, _children: object): void {}
|
|
83
|
+
|
|
84
|
+
export const deferHydration: (_f: Fiber, _thenable: Promise<any>) => boolean = () => false
|
|
85
|
+
|
|
86
|
+
export function finishHydration(_f: Fiber, _isTextarea: boolean): void {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import './context';
|
|
2
|
+
import './forward-ref';
|
|
3
|
+
import './memo';
|
|
4
|
+
import './lazy';
|
|
5
|
+
import './suspense';
|
|
6
|
+
import './portal';
|
|
7
|
+
import './activity';
|
|
8
|
+
import './class';
|
|
9
|
+
// Feature wiring. Each import is a side-effect import that triggers the
|
|
10
|
+
// feature module's self-registration with the reconciler (renderer, type
|
|
11
|
+
// matcher, element marker). A vite plugin can swap any entry to './stub'
|
|
12
|
+
// to disable that feature in the emitted bundle.
|