@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,21 @@
|
|
|
1
|
+
// Lazy owns a record so it can also read frozen promises. use() adopts the
|
|
2
|
+
// status fields shared with React and Flight on the thenable itself.
|
|
3
|
+
export function readThenable<T>(thenable: PromiseLike<T>, state: any = thenable): T {
|
|
4
|
+
if (state.status === undefined) {
|
|
5
|
+
state.status = 'pending'
|
|
6
|
+
thenable.then(value => {
|
|
7
|
+
if (state.status === 'pending') {
|
|
8
|
+
state.status = 'fulfilled'
|
|
9
|
+
state.value = value
|
|
10
|
+
}
|
|
11
|
+
}, reason => {
|
|
12
|
+
if (state.status === 'pending') {
|
|
13
|
+
state.status = 'rejected'
|
|
14
|
+
state.reason = reason
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
if (state.status === 'fulfilled') return state.value
|
|
19
|
+
if (state.status === 'rejected') throw state.reason
|
|
20
|
+
throw thenable
|
|
21
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from '../core'
|
|
2
|
+
import { ReactSharedInternals } from './shared-internals'
|
|
3
|
+
|
|
4
|
+
export const REACT_VIEW_TRANSITION_TYPE = Symbol.for('react.view_transition')
|
|
5
|
+
|
|
6
|
+
export type ViewTransitionClass = string | Record<string, string>
|
|
7
|
+
export interface ViewTransitionPseudoElement {
|
|
8
|
+
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation
|
|
9
|
+
getAnimations(): Animation[]
|
|
10
|
+
getComputedStyle(): CSSStyleDeclaration
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ViewTransitionInstance {
|
|
14
|
+
name: string
|
|
15
|
+
group: ViewTransitionPseudoElement
|
|
16
|
+
imagePair: ViewTransitionPseudoElement
|
|
17
|
+
old: ViewTransitionPseudoElement
|
|
18
|
+
new: ViewTransitionPseudoElement
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type ViewTransitionEvent = (instance: ViewTransitionInstance, types: string[]) => void | (() => void)
|
|
22
|
+
export interface ViewTransitionProps {
|
|
23
|
+
children?: ReactNode
|
|
24
|
+
name?: string | Record<string, string> | undefined
|
|
25
|
+
default?: ViewTransitionClass | undefined
|
|
26
|
+
enter?: ViewTransitionClass | undefined
|
|
27
|
+
exit?: ViewTransitionClass | undefined
|
|
28
|
+
update?: ViewTransitionClass | undefined
|
|
29
|
+
share?: ViewTransitionClass | undefined
|
|
30
|
+
onEnter?: ViewTransitionEvent | undefined
|
|
31
|
+
onExit?: ViewTransitionEvent | undefined
|
|
32
|
+
onUpdate?: ViewTransitionEvent | undefined
|
|
33
|
+
onShare?: ViewTransitionEvent | undefined
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Animation support belongs to the optional DOM feature, not this public entry.
|
|
37
|
+
export const ViewTransition = REACT_VIEW_TRANSITION_TYPE as unknown as (props: ViewTransitionProps) => any
|
|
38
|
+
|
|
39
|
+
export function addTransitionType(type: string): void {
|
|
40
|
+
ReactSharedInternals.T?.add(type)
|
|
41
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Minimal `scheduler` package surface — enough for React-ecosystem libraries
|
|
2
|
+
// (react-three/fiber, react-query's older scheduler calls, some devtools) to
|
|
3
|
+
// resolve the import without crashing. We don't implement priority lanes or
|
|
4
|
+
// interruptible work; everything runs on microtask or the next task.
|
|
5
|
+
|
|
6
|
+
const PRIORITY_IMMEDIATE = 1
|
|
7
|
+
const PRIORITY_USER_BLOCKING = 2
|
|
8
|
+
const PRIORITY_NORMAL = 3
|
|
9
|
+
const PRIORITY_LOW = 4
|
|
10
|
+
const PRIORITY_IDLE = 5
|
|
11
|
+
|
|
12
|
+
type Callback = () => unknown
|
|
13
|
+
|
|
14
|
+
interface Task {
|
|
15
|
+
id: number
|
|
16
|
+
callback: Callback | null
|
|
17
|
+
priority: number
|
|
18
|
+
cancelled: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let nextId = 0
|
|
22
|
+
|
|
23
|
+
export function unstable_scheduleCallback(priority: number, cb: Callback): Task {
|
|
24
|
+
const task: Task = {
|
|
25
|
+
id: ++nextId,
|
|
26
|
+
callback: cb,
|
|
27
|
+
priority,
|
|
28
|
+
cancelled: false,
|
|
29
|
+
}
|
|
30
|
+
const run = () => {
|
|
31
|
+
if (task.cancelled || !task.callback) return
|
|
32
|
+
const fn = task.callback
|
|
33
|
+
task.callback = null
|
|
34
|
+
try {
|
|
35
|
+
fn()
|
|
36
|
+
} catch (e) {
|
|
37
|
+
// Re-throw on next task so the host sees it
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
throw e
|
|
40
|
+
}, 0)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Immediate → microtask so ordering is predictable; everything else → next task.
|
|
44
|
+
if (priority <= PRIORITY_IMMEDIATE) {
|
|
45
|
+
queueMicrotask(run)
|
|
46
|
+
} else {
|
|
47
|
+
setTimeout(run, 0)
|
|
48
|
+
}
|
|
49
|
+
return task
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function unstable_cancelCallback(task: Task): void {
|
|
53
|
+
task.cancelled = true
|
|
54
|
+
task.callback = null
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function unstable_shouldYield(): boolean {
|
|
58
|
+
// We never yield — work runs to completion on whichever task schedules it.
|
|
59
|
+
return false
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function unstable_requestPaint(): void {
|
|
63
|
+
// no-op
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function unstable_now(): number {
|
|
67
|
+
return typeof performance !== 'undefined' ? performance.now() : Date.now()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function unstable_getCurrentPriorityLevel(): number {
|
|
71
|
+
return PRIORITY_NORMAL
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function unstable_runWithPriority<T>(_priority: number, fn: () => T): T {
|
|
75
|
+
return fn()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function unstable_next<T>(fn: () => T): T {
|
|
79
|
+
return fn()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function unstable_wrapCallback<T extends (...args: any[]) => any>(fn: T): T {
|
|
83
|
+
return fn
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function unstable_continueExecution(): void {
|
|
87
|
+
// no-op
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function unstable_pauseExecution(): void {
|
|
91
|
+
// no-op
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function unstable_getFirstCallbackNode(): Task | null {
|
|
95
|
+
return null
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const unstable_IdlePriority = PRIORITY_IDLE
|
|
99
|
+
export const unstable_ImmediatePriority = PRIORITY_IMMEDIATE
|
|
100
|
+
export const unstable_LowPriority = PRIORITY_LOW
|
|
101
|
+
export const unstable_NormalPriority = PRIORITY_NORMAL
|
|
102
|
+
export const unstable_UserBlockingPriority = PRIORITY_USER_BLOCKING
|
|
103
|
+
|
|
104
|
+
// Some libraries (e.g. @react-three/fiber) import `scheduler` with a default
|
|
105
|
+
// binding expecting the namespace object. Provide one.
|
|
106
|
+
export default {
|
|
107
|
+
unstable_scheduleCallback,
|
|
108
|
+
unstable_cancelCallback,
|
|
109
|
+
unstable_shouldYield,
|
|
110
|
+
unstable_requestPaint,
|
|
111
|
+
unstable_now,
|
|
112
|
+
unstable_getCurrentPriorityLevel,
|
|
113
|
+
unstable_runWithPriority,
|
|
114
|
+
unstable_next,
|
|
115
|
+
unstable_wrapCallback,
|
|
116
|
+
unstable_continueExecution,
|
|
117
|
+
unstable_pauseExecution,
|
|
118
|
+
unstable_getFirstCallbackNode,
|
|
119
|
+
unstable_IdlePriority,
|
|
120
|
+
unstable_ImmediatePriority,
|
|
121
|
+
unstable_LowPriority,
|
|
122
|
+
unstable_NormalPriority,
|
|
123
|
+
unstable_UserBlockingPriority,
|
|
124
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { boundaryId, segmentId, scriptId } from './stream-ids'
|
|
2
|
+
/**
|
|
3
|
+
* Inline client runtime injected into the streamed HTML. Two jobs:
|
|
4
|
+
*
|
|
5
|
+
* 1. Reveal suspense boundaries as their resolved chunks arrive ($RC).
|
|
6
|
+
* 2. Capture interaction events from the moment the shell is visible so the
|
|
7
|
+
* main bundle can replay them against un-hydrated subtrees ($RE_q buffer).
|
|
8
|
+
*
|
|
9
|
+
* Wire format:
|
|
10
|
+
* Fallback: <!--$?ID--><template id="PREFIXB:HEX"></template>fallback<!--/$-->
|
|
11
|
+
* Resolved: a context-specific hidden segment followed by $RC(boundaryID, segmentID).
|
|
12
|
+
* Reveal removes the entire fallback range, moves the segment's
|
|
13
|
+
* children inline, and rewrites the opening comment to <!--$ID-->.
|
|
14
|
+
*
|
|
15
|
+
* Client hydration calls $RH(boundaryID, cb) to register a callback invoked once the
|
|
16
|
+
* boundary has been revealed (or immediately, if it was already revealed).
|
|
17
|
+
*
|
|
18
|
+
* Early-event buffering: before the main bundle is parsed, we attach capture
|
|
19
|
+
* listeners for a small set of interactive events and push them into a buffer.
|
|
20
|
+
* The bundle drains and replays them via the replay code in @tanstack/redact/dom.
|
|
21
|
+
*/
|
|
22
|
+
import { escapeAttr } from './escape'
|
|
23
|
+
|
|
24
|
+
export const BOUNDARY_REVEAL_RUNTIME =
|
|
25
|
+
`(function(){` +
|
|
26
|
+
// All independently prefixed streams in a document share one reveal registry.
|
|
27
|
+
`if(!window.$RH){` +
|
|
28
|
+
`var c={},r=new Map;` +
|
|
29
|
+
`function place(n,v){` +
|
|
30
|
+
`var a=document.head.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),t=a.length?a[a.length-1]:null,p=t;` +
|
|
31
|
+
`for(var k=0;k<a.length;k++){if(a[k].getAttribute("data-precedence")===v)p=a[k];else if(p!==t)break}` +
|
|
32
|
+
`document.head.insertBefore(n,p?p.nextSibling:document.head.firstChild);` +
|
|
33
|
+
`}` +
|
|
34
|
+
`function drop(s){var w=/^(TBODY|TR|COLGROUP|mtext)$/.test(s.nodeName)?s.closest("table,math"):s;w.remove()}` +
|
|
35
|
+
`function load(n,e){return new Promise(function(y,x){n.onload=function(){e.p=null;y()};n.onerror=function(){e.p=null;x()}})}` +
|
|
36
|
+
`window.$RH=function(i,f){` +
|
|
37
|
+
`if(!document.getElementById(i))f();` +
|
|
38
|
+
`else{c[i]=f;return function(){if(c[i]===f)delete c[i]}}` +
|
|
39
|
+
`};` +
|
|
40
|
+
`window.$RC=function(i,j){` +
|
|
41
|
+
`var s=document.getElementById(j),b=document.getElementById(i);` +
|
|
42
|
+
`if(!b){delete c[i];if(s)drop(s);return}if(!s)return;` +
|
|
43
|
+
`var a=document.querySelectorAll('body link[rel="stylesheet"][data-precedence],body style[data-precedence]');` +
|
|
44
|
+
`for(var j=0;j<a.length;j++){` +
|
|
45
|
+
`var n=a[j];if(n.getAttribute("media")==="not all")n.removeAttribute("media");place(n,n.getAttribute("data-precedence"));` +
|
|
46
|
+
`}` +
|
|
47
|
+
`var p=b.parentNode,m=b.previousSibling;` +
|
|
48
|
+
`var n=b.nextSibling,d=0;while(n){var t=n.nextSibling;if(n.nodeType===8){if(n.data==="/$"){if(d===0)break;d--}else if(/^\\$(?:[?!E~])?\\d*$/.test(n.data))d++}p.removeChild(n);n=t}` +
|
|
49
|
+
`while(s.firstChild)p.insertBefore(s.firstChild,b);` +
|
|
50
|
+
`drop(s);` +
|
|
51
|
+
`p.removeChild(b);` +
|
|
52
|
+
`if(m&&m.nodeType===8)m.data=m.data.replace("$?","$");` +
|
|
53
|
+
`if(c[i]){var f=c[i];delete c[i];f()}` +
|
|
54
|
+
`};` +
|
|
55
|
+
`window.$RR=function(i,s,d){` +
|
|
56
|
+
`var w=[];for(var j=0;j<d.length;j++){` +
|
|
57
|
+
`var a=d[j],e=r.get(a[0]);if(!e){` +
|
|
58
|
+
`var n=null,l=document.querySelectorAll('link[rel="stylesheet"]');for(var k=0;k<l.length;k++)if(l[k].getAttribute("href")===a[0]){n=l[k];break}` +
|
|
59
|
+
`e={n:n,p:null};r.set(a[0],e);if(!n){` +
|
|
60
|
+
`n=e.n=document.createElement("link");n.rel="stylesheet";n.href=a[0];n.setAttribute("data-precedence",a[1]);` +
|
|
61
|
+
`for(var k=2;k<a.length;k+=2)n.setAttribute(a[k],a[k+1]);` +
|
|
62
|
+
`e.p=load(n,e);place(n,a[1]);` +
|
|
63
|
+
`}` +
|
|
64
|
+
`}` +
|
|
65
|
+
`var m=e.n.getAttribute("media");if(e.p&&(!m||matchMedia(m).matches))w.push(e.p);` +
|
|
66
|
+
`}` +
|
|
67
|
+
`Promise.all(w).then(function(){$RC(i,s)},function(){$RB(i,1,s)});` +
|
|
68
|
+
`};` +
|
|
69
|
+
`window.$RB=function(i,e,j){` +
|
|
70
|
+
`var s=j&&document.getElementById(j);if(s)drop(s);` +
|
|
71
|
+
`var b=document.getElementById(i);if(!b){delete c[i];return}` +
|
|
72
|
+
`var m=b.previousSibling;if(m&&m.nodeType===8)m.data=(e?"$E":"$!")+m.data.replace(/^\\$[?~!E]?/,"");` +
|
|
73
|
+
`b.removeAttribute("id");if(c[i]){var f=c[i];delete c[i];f()}` +
|
|
74
|
+
`};` +
|
|
75
|
+
`}` +
|
|
76
|
+
`var q=[];window.$RE_q=q;` +
|
|
77
|
+
`var evs=["click","submit","input","change","keydown"];` +
|
|
78
|
+
`function h(e){q.push([e.type,e.target,e.timeStamp])}` +
|
|
79
|
+
`for(var j=0;j<evs.length;j++)document.addEventListener(evs[j],h,true);` +
|
|
80
|
+
`window.$RE_stop=function(){for(var j=0;j<evs.length;j++)document.removeEventListener(evs[j],h,true)};` +
|
|
81
|
+
`})();`
|
|
82
|
+
|
|
83
|
+
export function injectBootstrapScript(nonce?: string): string {
|
|
84
|
+
const n = nonce ? ` nonce="${escapeAttr(nonce)}"` : ''
|
|
85
|
+
return `<script${n}>${BOUNDARY_REVEAL_RUNTIME}</script>`
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function revealScript(id: number, nonce?: string, styles?: string[][], identifierPrefix = ''): string {
|
|
89
|
+
const n = nonce ? ` nonce="${escapeAttr(nonce)}"` : ''
|
|
90
|
+
const b = scriptId(boundaryId(id, identifierPrefix)), s = scriptId(segmentId(id, identifierPrefix))
|
|
91
|
+
return `<script${n}>${styles?.length ? `$RR(${b},${s},${JSON.stringify(styles).replace(/</g, '\\u003c')})` : `$RC(${b},${s})`}</script>`
|
|
92
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { leadingBit } from '../dom/react-ids'
|
|
2
|
+
import { isFunction } from '../core/functions'
|
|
3
|
+
import { readThenable } from '../react/thenable'
|
|
4
|
+
import { idleFormStatus } from '../react/form-state'
|
|
5
|
+
import { ReactSharedInternals, REACT_CONTEXT_TYPE } from '../react'
|
|
6
|
+
import { isBrowserToken, browserError } from '../core/browser'
|
|
7
|
+
import { resourceHintDispatcher } from '../core/resource-hints'
|
|
8
|
+
import { createResourceHints, type ResourceScope } from './resource-hints'
|
|
9
|
+
|
|
10
|
+
export interface SSRFrame {
|
|
11
|
+
treeId: bigint
|
|
12
|
+
localId: number
|
|
13
|
+
identifierPrefix: string
|
|
14
|
+
contextStack: Array<{ context: any; prev: any }>
|
|
15
|
+
resources?: ReturnType<typeof createResourceHints>
|
|
16
|
+
shellFlushed?: boolean
|
|
17
|
+
styleNonce?: string | undefined
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let frame: SSRFrame | null = null
|
|
21
|
+
|
|
22
|
+
resourceHintDispatcher.emit = (kind, href, options) => {
|
|
23
|
+
if (!frame) return false
|
|
24
|
+
;(frame.resources ||= createResourceHints(!!frame.shellFlushed, frame.styleNonce)).add(kind, href, options)
|
|
25
|
+
return true
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function beginSSR(identifierPrefix = '', nextFrame?: SSRFrame) {
|
|
29
|
+
const previous = { frame, dispatcher: ReactSharedInternals.H }
|
|
30
|
+
frame = nextFrame ?? { treeId: 1n, localId: 0, identifierPrefix, contextStack: [] }
|
|
31
|
+
ReactSharedInternals.H = ssrDispatcher as any
|
|
32
|
+
return previous
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function currentSSRFrame(): SSRFrame {
|
|
36
|
+
return frame!
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function recordHostResource(type: string, props: any, scope?: ResourceScope): boolean {
|
|
40
|
+
return !!frame && (frame.resources ||= createResourceHints(!!frame.shellFlushed, frame.styleNonce)).addHost(type, props, scope)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function endSSR(previous?: ReturnType<typeof beginSSR>): void {
|
|
44
|
+
// Restore any remaining pushed contexts (defensive)
|
|
45
|
+
if (frame) {
|
|
46
|
+
for (let i = frame.contextStack.length - 1; i >= 0; i--) {
|
|
47
|
+
const { context, prev } = frame.contextStack[i]!
|
|
48
|
+
context._currentValue = prev
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Only synchronous renders restore their caller. A stream can finish
|
|
52
|
+
// after its caller has returned, so it must not reinstall that dispatcher.
|
|
53
|
+
ReactSharedInternals.H = previous?.dispatcher ?? null
|
|
54
|
+
frame = previous?.frame ?? null
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function pushContext(context: any, value: any): void {
|
|
58
|
+
if (!frame) throw new Error(process.env.NODE_ENV !== 'production' ? 'pushContext called outside SSR' : '')
|
|
59
|
+
frame.contextStack.push({ context, prev: context._currentValue })
|
|
60
|
+
context._currentValue = value
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function popContext(context: any): void {
|
|
64
|
+
if (!frame) return
|
|
65
|
+
const top = frame.contextStack.pop()
|
|
66
|
+
if (top && top.context === context) context._currentValue = top.prev
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type ContextSnapshot = Array<{ context: any; value: any }>
|
|
70
|
+
|
|
71
|
+
export function snapshotContexts(): ContextSnapshot {
|
|
72
|
+
if (!frame) return []
|
|
73
|
+
const out: ContextSnapshot = []
|
|
74
|
+
for (const entry of frame.contextStack) {
|
|
75
|
+
out.push({ context: entry.context, value: entry.context._currentValue })
|
|
76
|
+
}
|
|
77
|
+
return out
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Push snapshot values and return a function that pops them.
|
|
82
|
+
* Called when we re-render a suspended boundary so it sees the same provider
|
|
83
|
+
* values that were active at suspension time.
|
|
84
|
+
*/
|
|
85
|
+
export function applyContextSnapshot(snapshot: ContextSnapshot): () => void {
|
|
86
|
+
for (const { context, value } of snapshot) pushContext(context, value)
|
|
87
|
+
return () => {
|
|
88
|
+
for (let i = snapshot.length - 1; i >= 0; i--) popContext(snapshot[i]!.context)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const ssrDispatcher = {
|
|
93
|
+
useCacheRefresh() {
|
|
94
|
+
return () => { throw new Error('Refreshing the cache is not supported during server rendering.') }
|
|
95
|
+
},
|
|
96
|
+
useState<S>(initial: S | (() => S)) {
|
|
97
|
+
const v = isFunction(initial) ? (initial as () => S)() : initial
|
|
98
|
+
return [v, (() => {}) as any] as [S, any]
|
|
99
|
+
},
|
|
100
|
+
useReducer<S, A>(_reducer: (s: S, a: A) => S, initialArg: any, init?: (a: any) => S) {
|
|
101
|
+
const v = init ? init(initialArg) : initialArg
|
|
102
|
+
return [v, (() => {}) as any]
|
|
103
|
+
},
|
|
104
|
+
useEffect() {
|
|
105
|
+
// noop on server
|
|
106
|
+
},
|
|
107
|
+
useLayoutEffect() {
|
|
108
|
+
// noop on server
|
|
109
|
+
},
|
|
110
|
+
useInsertionEffect() {
|
|
111
|
+
// noop on server
|
|
112
|
+
},
|
|
113
|
+
useRef<T>(initial: T) {
|
|
114
|
+
return { current: initial }
|
|
115
|
+
},
|
|
116
|
+
useMemo<T>(factory: () => T) {
|
|
117
|
+
return factory()
|
|
118
|
+
},
|
|
119
|
+
useCallback<T extends Function>(fn: T) {
|
|
120
|
+
return fn
|
|
121
|
+
},
|
|
122
|
+
useContext<T>(ctx: any): T {
|
|
123
|
+
return ctx._currentValue
|
|
124
|
+
},
|
|
125
|
+
useImperativeHandle() {
|
|
126
|
+
// noop on server
|
|
127
|
+
},
|
|
128
|
+
useDebugValue() {
|
|
129
|
+
// noop
|
|
130
|
+
},
|
|
131
|
+
useId(): string {
|
|
132
|
+
if (!frame) return ':r0:'
|
|
133
|
+
const local = frame.localId++
|
|
134
|
+
const tree = frame.treeId
|
|
135
|
+
return '_' + frame.identifierPrefix + 'R_' + (tree ^ leadingBit(tree)).toString(32) + (local ? 'H' + local.toString(32) : '') + '_'
|
|
136
|
+
},
|
|
137
|
+
useTransition(): [boolean, (fn: () => void) => void] {
|
|
138
|
+
return [false, (fn) => fn()]
|
|
139
|
+
},
|
|
140
|
+
useActionState<S, P>(_action: (state: Awaited<S>, payload: P) => S | Promise<S>, initial: Awaited<S>): [Awaited<S>, (payload: P) => void, boolean] {
|
|
141
|
+
return [initial, () => {}, false]
|
|
142
|
+
},
|
|
143
|
+
useOptimistic<S, A>(state: S): [S, (action: A) => void] {
|
|
144
|
+
return [state, () => {}]
|
|
145
|
+
},
|
|
146
|
+
useFormStatus() { return idleFormStatus },
|
|
147
|
+
useDeferredValue<T>(v: T): T {
|
|
148
|
+
return v
|
|
149
|
+
},
|
|
150
|
+
useSyncExternalStore<T>(
|
|
151
|
+
_subscribe: (cb: () => void) => () => void,
|
|
152
|
+
getSnapshot: () => T,
|
|
153
|
+
getServerSnapshot?: () => T,
|
|
154
|
+
): T {
|
|
155
|
+
return getServerSnapshot ? getServerSnapshot() : getSnapshot()
|
|
156
|
+
},
|
|
157
|
+
use<T>(resource: any): T {
|
|
158
|
+
if (resource == null) throw new Error('use() received null or undefined')
|
|
159
|
+
if (isBrowserToken(resource)) throw browserError(resource)
|
|
160
|
+
if (resource.$$typeof === REACT_CONTEXT_TYPE) {
|
|
161
|
+
return resource._currentValue
|
|
162
|
+
}
|
|
163
|
+
if (isFunction(resource.then)) {
|
|
164
|
+
return readThenable(resource) as T
|
|
165
|
+
}
|
|
166
|
+
throw new Error('use() expected a Promise or Context')
|
|
167
|
+
},
|
|
168
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { UNITLESS_STYLE } from '../core/unitless-style'
|
|
2
|
+
import { isFunction } from '../core/functions'
|
|
3
|
+
import { attributeName, STRING_BOOLEAN_ATTRS, BOOLEAN_ATTRS } from '../core/attributes'
|
|
4
|
+
|
|
5
|
+
function escape(value: string, pattern: RegExp): string {
|
|
6
|
+
return value.replace(pattern, char => char === '&' ? '&' : char === '<' ? '<' : char === '>' ? '>' : '"')
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function escapeAttr(value: string): string {
|
|
10
|
+
return /[&"<>]/.test(value) ? escape(value, /[&"<>]/g) : value
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function escapeText(value: string): string {
|
|
14
|
+
return /[&<>]/.test(value) ? escape(value, /[&<>]/g) : value
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Raw-text element body escaping: prevent any closing tag for the raw-text
|
|
18
|
+
// elements (<script>, <style>) from terminating the element early, plus
|
|
19
|
+
// `<!--` (which would start an HTML comment that survives even inside
|
|
20
|
+
// raw-text bodies and can be exploited to alter following script content).
|
|
21
|
+
// React's serializer follows the same approach.
|
|
22
|
+
export function escapeScript(value: string): string {
|
|
23
|
+
return value
|
|
24
|
+
.replace(/<\/(script|style)/gi, '<\\/$1')
|
|
25
|
+
.replace(/<!--/g, '<\\!--')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const VOID_ELEMENTS = new Set([
|
|
29
|
+
'area',
|
|
30
|
+
'base',
|
|
31
|
+
'br',
|
|
32
|
+
'col',
|
|
33
|
+
'embed',
|
|
34
|
+
'hr',
|
|
35
|
+
'img',
|
|
36
|
+
'input',
|
|
37
|
+
'link',
|
|
38
|
+
'meta',
|
|
39
|
+
'param',
|
|
40
|
+
'source',
|
|
41
|
+
'track',
|
|
42
|
+
'wbr',
|
|
43
|
+
])
|
|
44
|
+
|
|
45
|
+
export const RAW_TEXT_ELEMENTS = new Set(['script', 'style'])
|
|
46
|
+
|
|
47
|
+
export function attrToHtml(name: string, value: unknown, isSvg = false): string {
|
|
48
|
+
if (
|
|
49
|
+
name === 'children' ||
|
|
50
|
+
name === 'key' ||
|
|
51
|
+
name === 'ref' ||
|
|
52
|
+
name === 'dangerouslySetInnerHTML' ||
|
|
53
|
+
name === 'defaultValue' ||
|
|
54
|
+
name === 'defaultChecked' ||
|
|
55
|
+
name === 'suppressHydrationWarning' ||
|
|
56
|
+
name === 'suppressContentEditableWarning'
|
|
57
|
+
) {
|
|
58
|
+
return ''
|
|
59
|
+
}
|
|
60
|
+
if (name[0] === 'o' && name[1] === 'n' && isFunction(value)) return ''
|
|
61
|
+
if (value == null) return ''
|
|
62
|
+
|
|
63
|
+
const htmlName = attributeName(name, isSvg)
|
|
64
|
+
|
|
65
|
+
// These attributes need explicit "false", not boolean-attribute absence.
|
|
66
|
+
if (
|
|
67
|
+
STRING_BOOLEAN_ATTRS.test(htmlName) ||
|
|
68
|
+
name.startsWith('aria-') ||
|
|
69
|
+
name.startsWith('data-')
|
|
70
|
+
) {
|
|
71
|
+
return ` ${htmlName}="${escapeAttr(String(value))}"`
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (value === false) return ''
|
|
75
|
+
|
|
76
|
+
if (value === true || BOOLEAN_ATTRS.test(htmlName)) {
|
|
77
|
+
return value ? ` ${htmlName}=""` : ''
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (name === 'style' && typeof value === 'object' && value !== null) {
|
|
81
|
+
return ` style="${escapeAttr(styleToString(value as Record<string, unknown>))}"`
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return ` ${htmlName}="${escapeAttr(String(value))}"`
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
function styleToString(style: Record<string, unknown>): string {
|
|
90
|
+
let out = ''
|
|
91
|
+
for (const key in style) {
|
|
92
|
+
const v = style[key]
|
|
93
|
+
if (v == null || v === false) continue
|
|
94
|
+
const kebab = key.startsWith('--')
|
|
95
|
+
? key
|
|
96
|
+
: key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase()).replace(/^ms-/, '-ms-')
|
|
97
|
+
const value =
|
|
98
|
+
typeof v === 'number' && !UNITLESS_STYLE.test(key) && v !== 0 ? v + 'px' : v
|
|
99
|
+
out += `${kebab}:${value};`
|
|
100
|
+
}
|
|
101
|
+
return out
|
|
102
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { renderToString, renderToStaticMarkup } from './renderToString'
|
|
2
|
+
export { renderToReadableStream, renderToPipeableStream } from './stream'
|
|
3
|
+
export type {
|
|
4
|
+
StreamOptions,
|
|
5
|
+
PipeableOptions,
|
|
6
|
+
PipeableHandle,
|
|
7
|
+
ReadableStreamResult,
|
|
8
|
+
} from './stream'
|
|
9
|
+
export { BOUNDARY_REVEAL_RUNTIME } from './bootstrap-script'
|
|
10
|
+
|
|
11
|
+
export const version = '19.2.3'
|
|
12
|
+
|
|
13
|
+
// Default export — React's real `react-dom/server` ships one, and TanStack
|
|
14
|
+
// Router's SSR code does `import ReactDOMServer from 'react-dom/server'` and
|
|
15
|
+
// reads `.renderToReadableStream` off the default.
|
|
16
|
+
import { renderToString, renderToStaticMarkup } from './renderToString'
|
|
17
|
+
import { renderToReadableStream, renderToPipeableStream } from './stream'
|
|
18
|
+
import { BOUNDARY_REVEAL_RUNTIME } from './bootstrap-script'
|
|
19
|
+
export default {
|
|
20
|
+
renderToString,
|
|
21
|
+
renderToStaticMarkup,
|
|
22
|
+
renderToReadableStream,
|
|
23
|
+
renderToPipeableStream,
|
|
24
|
+
BOUNDARY_REVEAL_RUNTIME,
|
|
25
|
+
version: '19.2.3',
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { escapeAttr } from './escape'
|
|
2
|
+
|
|
3
|
+
// The context belongs to the *parent* of a suspended subtree. It must survive
|
|
4
|
+
// retries: looking at the first resolved child cannot recover HTML insertion mode.
|
|
5
|
+
export type InsertionContext = 'html' | 'svg' | 'math' | 'mtext' | 'table' | 'tbody' | 'tr' | 'colgroup'
|
|
6
|
+
|
|
7
|
+
export function childInsertionContext(tag: string, props: Record<string, any>, parent: InsertionContext): InsertionContext {
|
|
8
|
+
if (tag === 'svg') return 'svg'
|
|
9
|
+
if (tag === 'math') return 'math'
|
|
10
|
+
if ((parent === 'svg' && (tag === 'foreignObject' || tag === 'desc' || tag === 'title')) || (tag === 'annotation-xml' && /^(text\/html|application\/xhtml\+xml)$/i.test(props.encoding ?? ''))) return 'html'
|
|
11
|
+
// WHATWG tree-construction dispatcher: MathML text integration points use
|
|
12
|
+
// HTML rules except for mglyph/malignmark. Keep that mixed context on retries.
|
|
13
|
+
if (parent === 'math' && /^(mi|mo|mn|ms|mtext)$/.test(tag)) return 'mtext'
|
|
14
|
+
if (parent === 'mtext' && (tag === 'mglyph' || tag === 'malignmark')) return 'math'
|
|
15
|
+
if (parent === 'svg' || parent === 'math') return parent
|
|
16
|
+
if (tag === 'table' || tag === 'tr' || tag === 'colgroup') return tag
|
|
17
|
+
if (tag === 'tbody' || tag === 'thead' || tag === 'tfoot') return 'tbody'
|
|
18
|
+
return 'html'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function segmentHtml(content: string, id: string, context: InsertionContext): string {
|
|
22
|
+
const mathText = context === 'mtext'
|
|
23
|
+
const nested = mathText || context === 'tbody' || context === 'tr' || context === 'colgroup'
|
|
24
|
+
const tag = context === 'html' ? 'div' : context
|
|
25
|
+
const hidden = nested ? '' : context === 'svg' || context === 'math' ? ' aria-hidden="true" style="display:none"' : ' hidden'
|
|
26
|
+
const wrapper = mathText ? '<math style="display:none">' : '<table hidden>'
|
|
27
|
+
return `${nested ? wrapper : ''}<${tag}${hidden} id="${escapeAttr(id)}">${content}</${tag}>${nested ? mathText ? '</math>' : '</table>' : ''}`
|
|
28
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ReactNode } from '../core'
|
|
2
|
+
import { beginSSR, currentSSRFrame, endSSR } from './dispatcher'
|
|
3
|
+
import { walk } from './walk'
|
|
4
|
+
|
|
5
|
+
export function renderToString(
|
|
6
|
+
children: ReactNode,
|
|
7
|
+
options: { identifierPrefix?: string } = {},
|
|
8
|
+
): string {
|
|
9
|
+
const previous = beginSSR(options.identifierPrefix)
|
|
10
|
+
let output = ''
|
|
11
|
+
let id = 0
|
|
12
|
+
let head = 0
|
|
13
|
+
try {
|
|
14
|
+
walk(children, {
|
|
15
|
+
emit: (s) => {
|
|
16
|
+
output += s
|
|
17
|
+
},
|
|
18
|
+
nextBoundaryId: () => id++,
|
|
19
|
+
onHead: () => { head = output.length },
|
|
20
|
+
})
|
|
21
|
+
const hints = currentSSRFrame().resources?.drain()
|
|
22
|
+
if (hints) output = output.slice(0, head) + hints + output.slice(head)
|
|
23
|
+
} finally {
|
|
24
|
+
endSSR(previous)
|
|
25
|
+
}
|
|
26
|
+
return output
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function renderToStaticMarkup(
|
|
30
|
+
children: ReactNode,
|
|
31
|
+
options: { identifierPrefix?: string } = {},
|
|
32
|
+
): string {
|
|
33
|
+
// For our purposes identical to renderToString (no hydration markers in static output)
|
|
34
|
+
return renderToString(children, options).replace(/<!--[^>]*-->/g, '')
|
|
35
|
+
}
|