@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,141 @@
|
|
|
1
|
+
import type { Fiber, FiberRoot, Hook } from '../core';
|
|
2
|
+
import { findRoot, scheduleUpdate } from './reconcile';
|
|
3
|
+
import { finish, type ActionScope } from '../react/action-scope';
|
|
4
|
+
import { isThenable } from '../core/functions';
|
|
5
|
+
import { checkpointCommit, rewindCommit, queueCommitEffects } from './commit';
|
|
6
|
+
import { ReactSharedInternals } from '../react/shared-internals';
|
|
7
|
+
import { transitionScope } from '../react/hooks';
|
|
8
|
+
export let a = false;
|
|
9
|
+
export const p = (fiber: Fiber): boolean => !!fiber.r?.tr?.has(fiber);
|
|
10
|
+
export function q(hook: Hook, fiber: Fiber, action: any): boolean {
|
|
11
|
+
const scope = ReactSharedInternals.T && ReactSharedInternals.B;
|
|
12
|
+
if (!scope && !hook.t)
|
|
13
|
+
return false;
|
|
14
|
+
const previous = hook.t || (hook.c || []).reduce((p: any, a: any) => ([p, undefined, a, hook.s]), null);
|
|
15
|
+
hook.c = null;
|
|
16
|
+
hook.t = [previous, scope, action, previous ? previous[3] : hook.s];
|
|
17
|
+
if (scope)
|
|
18
|
+
enqueue(fiber, scope);
|
|
19
|
+
else
|
|
20
|
+
scheduleUpdate(fiber);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
export function v(hook: Hook, fiber: Fiber, value: any): any {
|
|
24
|
+
if (!hook.d || a) {
|
|
25
|
+
hook.d = true;
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
else if (!Object.is(value, hook.s))
|
|
29
|
+
enqueue(fiber);
|
|
30
|
+
return hook.s;
|
|
31
|
+
}
|
|
32
|
+
export function c(root: FiberRoot): void {
|
|
33
|
+
const pending = root.tr;
|
|
34
|
+
if (pending) {
|
|
35
|
+
complete(pending.s);
|
|
36
|
+
pending.s.clear();
|
|
37
|
+
pending.clear();
|
|
38
|
+
pending.u = undefined;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function t(root: FiberRoot, render: (root: FiberRoot, fibers: Fiber[], update?: () => void) => void): void {
|
|
42
|
+
const pending = root.tr;
|
|
43
|
+
if (!pending?.size)
|
|
44
|
+
return;
|
|
45
|
+
const checkpoint = checkpointCommit(root.r);
|
|
46
|
+
const fibers = [...pending];
|
|
47
|
+
a = true;
|
|
48
|
+
try {
|
|
49
|
+
const update = pending.u;
|
|
50
|
+
render(root, fibers, update);
|
|
51
|
+
if (pending.u === update) pending.u = undefined;
|
|
52
|
+
for (const fiber of fibers) {
|
|
53
|
+
pending.delete(fiber);
|
|
54
|
+
}
|
|
55
|
+
if (!pending.size) {
|
|
56
|
+
const work = pending.s;
|
|
57
|
+
pending.s = new Set();
|
|
58
|
+
queueCommitEffects(() => complete(work));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (!isThenable(error))
|
|
63
|
+
throw error;
|
|
64
|
+
rewindCommit(checkpoint);
|
|
65
|
+
for (const scope of pending.s)
|
|
66
|
+
scope.n?.(scope);
|
|
67
|
+
if (pending.w !== error) {
|
|
68
|
+
pending.w = error;
|
|
69
|
+
const retry = () => transitionScope(() => {
|
|
70
|
+
for (const fiber of pending)
|
|
71
|
+
scheduleUpdate(fiber);
|
|
72
|
+
});
|
|
73
|
+
error.then(retry, retry);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
a = false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function complete(work: Set<ActionScope>): void {
|
|
81
|
+
for (const scope of work) {
|
|
82
|
+
scope.v!--;
|
|
83
|
+
finish(scope);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function enqueue(fiber: Fiber, scope?: ActionScope | null): void {
|
|
87
|
+
const root = findRoot(fiber);
|
|
88
|
+
if (!root)
|
|
89
|
+
return;
|
|
90
|
+
let pending = root.tr;
|
|
91
|
+
if (!pending) {
|
|
92
|
+
pending = root.tr = new Set() as NonNullable<FiberRoot["tr"]>;
|
|
93
|
+
pending.s = new Set();
|
|
94
|
+
}
|
|
95
|
+
const fresh = !pending.has(fiber);
|
|
96
|
+
pending.add(fiber);
|
|
97
|
+
if (scope && !pending.s.has(scope)) {
|
|
98
|
+
scope.v = (scope.v || 0) + 1;
|
|
99
|
+
scope.p++;
|
|
100
|
+
pending.s.add(scope);
|
|
101
|
+
}
|
|
102
|
+
if (ReactSharedInternals.F) {
|
|
103
|
+
if (fresh)
|
|
104
|
+
queueCommitEffects(() => scheduleUpdate(fiber));
|
|
105
|
+
}
|
|
106
|
+
else
|
|
107
|
+
scheduleUpdate(fiber);
|
|
108
|
+
}
|
|
109
|
+
export function s(root: FiberRoot, render: () => void): boolean {
|
|
110
|
+
if (!ReactSharedInternals.T) {
|
|
111
|
+
if (root.tr) root.tr.u = undefined;
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
const scope = ReactSharedInternals.B;
|
|
115
|
+
enqueue(root.r, scope?.o === root ? scope : undefined);
|
|
116
|
+
root.tr!.u = render;
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
export function r(hook: Hook, reducer: (state: any, action: any) => any): boolean {
|
|
120
|
+
if (!hook.t)
|
|
121
|
+
return false;
|
|
122
|
+
let state = hook.t[3], base = state, pending: any = undefined;
|
|
123
|
+
const stack = [];
|
|
124
|
+
for (let node = hook.t; node; node = node[0])
|
|
125
|
+
stack.push(node);
|
|
126
|
+
while (stack.length) {
|
|
127
|
+
const node = stack.pop()!;
|
|
128
|
+
const skipped = node[1] && !a;
|
|
129
|
+
if (skipped) {
|
|
130
|
+
if (!pending)
|
|
131
|
+
base = state;
|
|
132
|
+
}
|
|
133
|
+
else
|
|
134
|
+
state = reducer(state, node[2]);
|
|
135
|
+
if (pending || skipped)
|
|
136
|
+
pending = [pending, node[1], node[2], base];
|
|
137
|
+
}
|
|
138
|
+
hook.t = pending;
|
|
139
|
+
hook.s = state;
|
|
140
|
+
return true;
|
|
141
|
+
}
|
package/src/dom/tree.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { FiberTag, type Fiber, type FiberRoot } from '../core';
|
|
2
|
+
export function getAnchor(fiber: Fiber, domParent: Node): Node | null {
|
|
3
|
+
let p: Fiber | null = fiber;
|
|
4
|
+
while (p) {
|
|
5
|
+
let sibling = p.s;
|
|
6
|
+
while (sibling) {
|
|
7
|
+
const d = firstDomNode(sibling, domParent);
|
|
8
|
+
if (d)
|
|
9
|
+
return d;
|
|
10
|
+
sibling = sibling.s;
|
|
11
|
+
}
|
|
12
|
+
p = p.p;
|
|
13
|
+
if (p?.t === FiberTag.Host || p?.t === FiberTag.Root || p?.t === FiberTag.Portal)
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
export function getHostParent(fiber: Fiber): Node {
|
|
19
|
+
let p = fiber.p;
|
|
20
|
+
while (p) {
|
|
21
|
+
if (p.t === FiberTag.Host)
|
|
22
|
+
return p.n!;
|
|
23
|
+
if (p.t === FiberTag.Root || p.t === FiberTag.Portal) {
|
|
24
|
+
return (p.t === FiberTag.Portal && (p.v ?? p.m)?.container) || p.i || p.n || p.r?.c;
|
|
25
|
+
}
|
|
26
|
+
p = p.p;
|
|
27
|
+
}
|
|
28
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
+
throw new Error('No host parent found.');
|
|
30
|
+
}
|
|
31
|
+
throw new Error();
|
|
32
|
+
}
|
|
33
|
+
export function findRoot(fiber: Fiber): FiberRoot | null {
|
|
34
|
+
let f: Fiber | null = fiber;
|
|
35
|
+
while (f) {
|
|
36
|
+
if (f.r)
|
|
37
|
+
return fiber.r = f.r;
|
|
38
|
+
f = f.p;
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
export function firstDomNode(fiber: Fiber, domParent: Node): Node | null {
|
|
43
|
+
if (fiber.t === FiberTag.Suspense && fiber.b?.w && fiber.b.b.parentNode === domParent)
|
|
44
|
+
return fiber.b.b;
|
|
45
|
+
if (fiber.t <= FiberTag.Text) {
|
|
46
|
+
return fiber.n?.parentNode === domParent ? fiber.n : null;
|
|
47
|
+
}
|
|
48
|
+
let c = fiber.c;
|
|
49
|
+
while (c) {
|
|
50
|
+
const d = firstDomNode(c, domParent);
|
|
51
|
+
if (d)
|
|
52
|
+
return d;
|
|
53
|
+
c = c.s;
|
|
54
|
+
}
|
|
55
|
+
return fiber.t === FiberTag.Suspense && fiber.b?.f ? firstDomNode(fiber.b.f, domParent) : null;
|
|
56
|
+
}
|
package/src/dom/walk.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FiberTag, type Fiber } from '../core'
|
|
2
|
+
|
|
3
|
+
export function walkRetained(fiber: Fiber, visit: (fiber: Fiber) => void, postorder?: boolean): void {
|
|
4
|
+
if (!postorder) visit(fiber)
|
|
5
|
+
for (let child = fiber.c; child; child = child.s) walkRetained(child, visit, postorder)
|
|
6
|
+
if (fiber.t === FiberTag.Suspense && fiber.b?.f) walkRetained(fiber.b.f, visit, postorder)
|
|
7
|
+
if (postorder) visit(fiber)
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRoot as create, hydrateRoot as hydrate, type RootOptions } from '../dom/client'
|
|
2
|
+
export type { Root, RootOptions } from '../dom/client'
|
|
3
|
+
|
|
4
|
+
export function createRoot(container: Element | DocumentFragment | Document, options: RootOptions = {}) {
|
|
5
|
+
return create(container, { ...options, identifierStrategy: 'react' })
|
|
6
|
+
}
|
|
7
|
+
export function hydrateRoot(container: Element | Document, children: any, options: RootOptions = {}) {
|
|
8
|
+
return hydrate(container, children, { ...options, identifierStrategy: 'react' })
|
|
9
|
+
}
|
|
10
|
+
export default { createRoot, hydrateRoot }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Next 16.2 reads navigation timing before Firefox finalizes streamed body
|
|
2
|
+
// sizes. A zero transfer size alone also describes an unfinished response.
|
|
3
|
+
// Keep Next's debug-channel cache restoration and require a decoded body.
|
|
4
|
+
module.exports = function (source) {
|
|
5
|
+
if (!source.includes('function wasServedFromCache()')) return source
|
|
6
|
+
const original = 'return entry?.transferSize === 0;'
|
|
7
|
+
const corrected = 'return entry?.transferSize === 0 && entry.decodedBodySize > 0;'
|
|
8
|
+
if (source.includes(corrected) && !source.includes(original)) return source
|
|
9
|
+
if (source.split(original).length !== 2) {
|
|
10
|
+
throw new Error('Unsupported Next.js 16.2 debug-channel cache detection. The Redact integration needs an update for this Next.js build.')
|
|
11
|
+
}
|
|
12
|
+
return source.replace(original, corrected)
|
|
13
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import { createRequire } from 'node:module'
|
|
3
|
+
|
|
4
|
+
const entries: Record<string, string> = {
|
|
5
|
+
react: './react.js',
|
|
6
|
+
'react/jsx-runtime': '../react/jsx-runtime.js',
|
|
7
|
+
'react/jsx-dev-runtime': '../react/jsx-runtime.js',
|
|
8
|
+
'react/compiler-runtime': '../react/compiler-runtime.js',
|
|
9
|
+
'react-dom': '../dom/index.js',
|
|
10
|
+
'react-dom/client': './client.js',
|
|
11
|
+
'react-dom/test-utils': '../dom/test-utils.js',
|
|
12
|
+
'react-dom/server': '../server/index.js',
|
|
13
|
+
'react-dom/server.browser': '../server/index.js',
|
|
14
|
+
'react-dom/server.edge': '../server/index.js',
|
|
15
|
+
'react-dom/server.node': '../server/index.js',
|
|
16
|
+
'react-dom/server.bun': '../server/index.js',
|
|
17
|
+
|
|
18
|
+
scheduler: '../scheduler/index.js',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Use Redact in the browser, keeping Next's server rendering and Flight on React. */
|
|
22
|
+
export function withRedact<T extends Record<string, any> | ((...args: any[]) => any)>(config: T = {} as T): T {
|
|
23
|
+
if (typeof config === 'function') return ((...args: any[]) => withRedact(config(...args))) as T
|
|
24
|
+
if (typeof config.then === 'function') return config.then((value: any) => withRedact(value))
|
|
25
|
+
const version = createRequire(import.meta.url)('next/package.json').version as string
|
|
26
|
+
const [major] = version.split('.').map(Number)
|
|
27
|
+
if (!/^(?:15\.5|16\.[0-4])\.\d+$/.test(version)) throw new Error(`withRedact supports stable Next.js 15.5 and 16.0 through 16.4, received ${version}`)
|
|
28
|
+
const aliases: Record<string, string> = {}
|
|
29
|
+
for (const [name, entry] of Object.entries(entries)) {
|
|
30
|
+
const target = fileURLToPath(new URL(entry, import.meta.url))
|
|
31
|
+
aliases[name] = target
|
|
32
|
+
if (name.startsWith('react')) {
|
|
33
|
+
aliases[`next/dist/compiled/${name}`] = target
|
|
34
|
+
const [pkg, ...rest] = name.split('/')
|
|
35
|
+
aliases[`next/dist/compiled/${pkg}-experimental${rest.length ? '/' + rest.join('/') : ''}`] = target
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const rules = { ...config.turbopack?.rules }
|
|
39
|
+
if (major! >= 16) rules['*.js'] = rules['*.js'] ? [rules['*.js']].flat() : []
|
|
40
|
+
for (const [name, entry] of Object.entries(entries)) {
|
|
41
|
+
const [pkg, subpath = 'index'] = name.split('/')
|
|
42
|
+
const loaders = [{
|
|
43
|
+
loader: fileURLToPath(new URL('./loader.cjs', import.meta.url)),
|
|
44
|
+
options: {
|
|
45
|
+
target: fileURLToPath(new URL(entry, import.meta.url)),
|
|
46
|
+
defaultExport: name === 'react' || name === 'react-dom' || name === 'react-dom/client' || name.startsWith('react-dom/server'),
|
|
47
|
+
},
|
|
48
|
+
}]
|
|
49
|
+
if (major! >= 16) {
|
|
50
|
+
rules['*.js'].push({
|
|
51
|
+
condition: { all: ['browser', { path: new RegExp(`(?:^|/)node_modules/(?:next/dist/compiled/)?${pkg}(?:-experimental)?/${subpath}\\.js$`) }] },
|
|
52
|
+
loaders,
|
|
53
|
+
})
|
|
54
|
+
} else {
|
|
55
|
+
for (const path of [pkg, `next/dist/compiled/${pkg}`, `next/dist/compiled/${pkg}-experimental`]) {
|
|
56
|
+
const glob = `**/node_modules/${path}/${subpath}.js`
|
|
57
|
+
if (glob in rules) throw new Error(`Conflicting Turbopack rule for ${glob}`)
|
|
58
|
+
rules[glob] = { browser: { loaders } }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const devCacheLoader = version.startsWith('16.2.')
|
|
63
|
+
? fileURLToPath(new URL('./dev-cache-loader.cjs', import.meta.url))
|
|
64
|
+
: undefined
|
|
65
|
+
const devCachePath = /(?:^|[/\\])node_modules[/\\]next[/\\]dist[/\\](?:esm[/\\])?client[/\\]dev[/\\]debug-channel\.js$/
|
|
66
|
+
if (devCacheLoader) rules['*.js'].push({
|
|
67
|
+
condition: { all: ['browser', { path: /(?:^|\/)node_modules\/next\/dist\/(?:esm\/)?client\/dev\/debug-channel\.js$/ }, 'development'] },
|
|
68
|
+
loaders: [{ loader: devCacheLoader }],
|
|
69
|
+
})
|
|
70
|
+
return {
|
|
71
|
+
...config,
|
|
72
|
+
turbopack: {
|
|
73
|
+
...config.turbopack,
|
|
74
|
+
rules,
|
|
75
|
+
},
|
|
76
|
+
webpack(webpackConfig: any, context: any) {
|
|
77
|
+
const result = config.webpack ? config.webpack(webpackConfig, context) : webpackConfig
|
|
78
|
+
if (!context.isServer) {
|
|
79
|
+
if (context.dev && devCacheLoader) {
|
|
80
|
+
result.module ||= {}
|
|
81
|
+
result.module.rules ||= []
|
|
82
|
+
result.module.rules.push({ test: devCachePath, use: [{ loader: devCacheLoader }] })
|
|
83
|
+
}
|
|
84
|
+
result.plugins ||= []
|
|
85
|
+
result.plugins.push(new context.webpack.NormalModuleReplacementPlugin(
|
|
86
|
+
/^(?:react(?:\/.*)?|react-dom(?:\/.*)?|scheduler|next\/dist\/compiled\/react(?:-dom)?(?:-experimental)?(?:\/.*)?)$/,
|
|
87
|
+
(resource: { request: string }) => {
|
|
88
|
+
if (aliases[resource.request]) resource.request = aliases[resource.request]!
|
|
89
|
+
},
|
|
90
|
+
))
|
|
91
|
+
}
|
|
92
|
+
return result
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Turbopack applies Next's built-in React aliases after user aliases. Replace
|
|
2
|
+
// the resolved browser entry through its supported loader API instead.
|
|
3
|
+
const { relative, dirname, sep } = require('node:path')
|
|
4
|
+
|
|
5
|
+
module.exports = function redactEntry() {
|
|
6
|
+
const { target, defaultExport } = this.getOptions()
|
|
7
|
+
const path = relative(dirname(this.resourcePath), target).split(sep).join('/')
|
|
8
|
+
const specifier = path.startsWith('.') ? path : './' + path
|
|
9
|
+
return `export * from ${JSON.stringify(specifier)};${defaultExport ? `\nexport { default } from ${JSON.stringify(specifier)};` : ''}`
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ReactSharedInternals } from '../react'
|
|
2
|
+
|
|
3
|
+
export * from '../react'
|
|
4
|
+
|
|
5
|
+
// Next's Flight decoder uses this object for development stack tracking.
|
|
6
|
+
export const __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals
|
|
7
|
+
export default { ...React, __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE }
|
package/src/react/act.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { isFunction } from '../core/functions'
|
|
2
|
+
import { ReactSharedInternals } from './shared-internals'
|
|
3
|
+
|
|
4
|
+
let depth = 0
|
|
5
|
+
let flushing = false
|
|
6
|
+
const immediate = process.env.NODE_ENV !== 'production' ? (globalThis as any).setImmediate : undefined
|
|
7
|
+
const timeout = process.env.NODE_ENV !== 'production' ? setTimeout : undefined
|
|
8
|
+
|
|
9
|
+
function flush(queue: Array<() => void>): void {
|
|
10
|
+
if (flushing) return
|
|
11
|
+
flushing = true
|
|
12
|
+
try {
|
|
13
|
+
while (queue.length) queue.shift()!()
|
|
14
|
+
} finally {
|
|
15
|
+
flushing = false
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Use a host task so promise continuations can enqueue renderer work first.
|
|
20
|
+
// Close MessageChannel ports after each task so tests can exit normally.
|
|
21
|
+
function nextTask(callback: () => void): void {
|
|
22
|
+
if (immediate) immediate(callback)
|
|
23
|
+
else if (typeof MessageChannel !== 'undefined') {
|
|
24
|
+
const channel = new MessageChannel()
|
|
25
|
+
channel.port1.onmessage = () => {
|
|
26
|
+
channel.port1.close()
|
|
27
|
+
channel.port2.close()
|
|
28
|
+
callback()
|
|
29
|
+
}
|
|
30
|
+
channel.port2.postMessage(null)
|
|
31
|
+
} else timeout!(callback, 0)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function drain(queue: Array<() => void>): Promise<void> {
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
const step = () => {
|
|
37
|
+
try { flush(queue) } catch (error) { reject(error); return }
|
|
38
|
+
nextTask(() => {
|
|
39
|
+
if (queue.length) step()
|
|
40
|
+
else resolve()
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
step()
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const act: typeof actDevelopment = process.env.NODE_ENV === 'production'
|
|
48
|
+
? () => { throw new Error() }
|
|
49
|
+
: actDevelopment
|
|
50
|
+
|
|
51
|
+
function actDevelopment<T>(callback: () => T | Promise<T>): PromiseLike<T> {
|
|
52
|
+
const outermost = depth === 0
|
|
53
|
+
const previous = ReactSharedInternals.A ?? null
|
|
54
|
+
const queue = ReactSharedInternals.A ||= []
|
|
55
|
+
depth++
|
|
56
|
+
let result: T | Promise<T>
|
|
57
|
+
let exited = false
|
|
58
|
+
const leave = () => {
|
|
59
|
+
if (exited) return
|
|
60
|
+
exited = true
|
|
61
|
+
depth--
|
|
62
|
+
if (!depth) ReactSharedInternals.A = previous
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
result = callback()
|
|
66
|
+
} catch (error) {
|
|
67
|
+
leave()
|
|
68
|
+
throw error
|
|
69
|
+
}
|
|
70
|
+
if (result && isFunction((result as Promise<T>).then)) {
|
|
71
|
+
return {
|
|
72
|
+
then(resolve, reject) {
|
|
73
|
+
const fail = (error: unknown) => {
|
|
74
|
+
leave()
|
|
75
|
+
if (reject) return reject(error)
|
|
76
|
+
throw error
|
|
77
|
+
}
|
|
78
|
+
return (result as Promise<T>).then(value => {
|
|
79
|
+
const finish = () => {
|
|
80
|
+
leave()
|
|
81
|
+
return resolve ? resolve(value) : value
|
|
82
|
+
}
|
|
83
|
+
return depth === 1 ? drain(queue).then(finish, fail) : finish()
|
|
84
|
+
}, fail)
|
|
85
|
+
},
|
|
86
|
+
} as PromiseLike<T>
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
try { if (depth === 1) flush(queue) }
|
|
90
|
+
finally { leave() }
|
|
91
|
+
let completion: Promise<T> | undefined
|
|
92
|
+
return {
|
|
93
|
+
then(resolve, reject) {
|
|
94
|
+
if (!outermost) return Promise.resolve(result as T).then(resolve, reject)
|
|
95
|
+
completion ||= (async () => {
|
|
96
|
+
const prior = ReactSharedInternals.A ?? null
|
|
97
|
+
ReactSharedInternals.A = queue
|
|
98
|
+
depth++
|
|
99
|
+
try { await drain(queue); return result as T }
|
|
100
|
+
finally { depth--; ReactSharedInternals.A = prior }
|
|
101
|
+
})()
|
|
102
|
+
return completion.then(resolve, reject)
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { FiberRoot } from '../core'
|
|
2
|
+
import { ReactSharedInternals } from './shared-internals'
|
|
3
|
+
import { isThenable } from '../core/functions'
|
|
4
|
+
// Action lifetimes are separate from transition types used by ViewTransition.
|
|
5
|
+
export interface ActionScope {
|
|
6
|
+
o?: FiberRoot | null | undefined
|
|
7
|
+
v?: number
|
|
8
|
+
n?: ((scope: ActionScope) => void) | undefined
|
|
9
|
+
p: number
|
|
10
|
+
d: Promise<void>
|
|
11
|
+
r: () => void
|
|
12
|
+
e?: unknown
|
|
13
|
+
h?: boolean
|
|
14
|
+
f: boolean
|
|
15
|
+
l: Set<() => void>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function trackAction(scope: ActionScope, promise: PromiseLike<unknown>, nested?: ActionScope): void {
|
|
19
|
+
scope.p++
|
|
20
|
+
Promise.resolve(promise).then(() => {
|
|
21
|
+
if (nested?.f) { scope.e = nested.e; scope.f = true }
|
|
22
|
+
finish(scope)
|
|
23
|
+
}, error => {
|
|
24
|
+
scope.e = error
|
|
25
|
+
scope.f = true
|
|
26
|
+
finish(scope)
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
export function finish(scope: ActionScope): void {
|
|
30
|
+
if (--scope.p !== 0) return
|
|
31
|
+
for (const listener of scope.l) listener()
|
|
32
|
+
scope.l.clear()
|
|
33
|
+
scope.r()
|
|
34
|
+
}
|
|
35
|
+
export function runAction(callback: () => unknown, owner?: FiberRoot | null, notify?: (scope: ActionScope) => void): ActionScope {
|
|
36
|
+
const previous = ReactSharedInternals.B
|
|
37
|
+
let resolve!: () => void
|
|
38
|
+
const done = new Promise<void>(yes => { resolve = yes })
|
|
39
|
+
const scope: ActionScope = { p: 1, d: done, r: resolve, f: false, l: new Set(), o: owner ?? previous?.o, n: notify }
|
|
40
|
+
try {
|
|
41
|
+
const result = withinAction(scope, callback)
|
|
42
|
+
if (isThenable(result)) trackAction(scope, result as PromiseLike<unknown>)
|
|
43
|
+
} catch (error) {
|
|
44
|
+
scope.f = true
|
|
45
|
+
scope.e = error
|
|
46
|
+
} finally {
|
|
47
|
+
finish(scope)
|
|
48
|
+
}
|
|
49
|
+
if (previous && scope.p > 0) trackAction(previous, done, scope)
|
|
50
|
+
return scope
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function withinAction<T>(scope: ActionScope | null | undefined, callback: () => T): T {
|
|
54
|
+
const previous = ReactSharedInternals.B
|
|
55
|
+
ReactSharedInternals.B = scope
|
|
56
|
+
try { return callback() } finally { ReactSharedInternals.B = previous }
|
|
57
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from '../core'
|
|
2
|
+
|
|
3
|
+
export const REACT_ACTIVITY_TYPE = Symbol.for('react.activity')
|
|
4
|
+
|
|
5
|
+
export interface ActivityProps {
|
|
6
|
+
children?: ReactNode
|
|
7
|
+
mode?: 'hidden' | 'visible'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Activity = REACT_ACTIVITY_TYPE as any as (props: ActivityProps) => any
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { isValidElement, cloneElement } from './element'
|
|
2
|
+
import type { ReactNode, ReactElement } from '../core'
|
|
3
|
+
|
|
4
|
+
function flatten(node: ReactNode, out: any[]): void {
|
|
5
|
+
if (node == null || typeof node === 'boolean') return
|
|
6
|
+
if (Array.isArray(node)) {
|
|
7
|
+
for (let i = 0; i < node.length; i++) flatten(node[i], out)
|
|
8
|
+
return
|
|
9
|
+
}
|
|
10
|
+
out.push(node)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getKey(node: any, index: number, prefix: string): string {
|
|
14
|
+
if (isValidElement(node) && node.key != null) return prefix + '$' + node.key
|
|
15
|
+
return prefix + ':' + index
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function mapChildren(
|
|
19
|
+
children: ReactNode,
|
|
20
|
+
fn: (child: ReactNode, index: number) => any,
|
|
21
|
+
prefix = '',
|
|
22
|
+
): any[] {
|
|
23
|
+
const flat: any[] = []
|
|
24
|
+
flatten(children, flat)
|
|
25
|
+
const out: any[] = []
|
|
26
|
+
for (let i = 0; i < flat.length; i++) {
|
|
27
|
+
const child = flat[i]
|
|
28
|
+
const mapped = fn(child, i)
|
|
29
|
+
if (mapped == null) continue
|
|
30
|
+
if (Array.isArray(mapped)) {
|
|
31
|
+
for (let j = 0; j < mapped.length; j++) {
|
|
32
|
+
const m = mapped[j]
|
|
33
|
+
if (m == null) continue
|
|
34
|
+
out.push(
|
|
35
|
+
isValidElement(m) && m.key == null
|
|
36
|
+
? cloneElement(m as ReactElement, { key: getKey(child, i, prefix) + '/' + j })
|
|
37
|
+
: m,
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
out.push(
|
|
42
|
+
isValidElement(mapped) && mapped.key == null
|
|
43
|
+
? cloneElement(mapped as ReactElement, { key: getKey(child, i, prefix) })
|
|
44
|
+
: mapped,
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return out
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const Children = {
|
|
52
|
+
map(children: ReactNode, fn: (child: ReactNode, index: number) => any): any[] | null {
|
|
53
|
+
if (children == null) return null
|
|
54
|
+
return mapChildren(children, fn)
|
|
55
|
+
},
|
|
56
|
+
forEach(children: ReactNode, fn: (child: ReactNode, index: number) => void): void {
|
|
57
|
+
if (children == null) return
|
|
58
|
+
mapChildren(children, (c, i) => {
|
|
59
|
+
fn(c, i)
|
|
60
|
+
return null
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
count(children: ReactNode): number {
|
|
64
|
+
const flat: any[] = []
|
|
65
|
+
flatten(children, flat)
|
|
66
|
+
return flat.length
|
|
67
|
+
},
|
|
68
|
+
toArray(children: ReactNode): any[] {
|
|
69
|
+
const flat: any[] = []
|
|
70
|
+
flatten(children, flat)
|
|
71
|
+
return flat.map((c, i) =>
|
|
72
|
+
isValidElement(c) && c.key == null
|
|
73
|
+
? cloneElement(c as ReactElement, { key: '' + i })
|
|
74
|
+
: c,
|
|
75
|
+
)
|
|
76
|
+
},
|
|
77
|
+
only(children: ReactNode): ReactElement {
|
|
78
|
+
if (!isValidElement(children)) {
|
|
79
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
80
|
+
throw new Error('Children.only expected a single React element.')
|
|
81
|
+
}
|
|
82
|
+
throw new Error()
|
|
83
|
+
}
|
|
84
|
+
return children
|
|
85
|
+
},
|
|
86
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ReactNode } from '../core'
|
|
2
|
+
|
|
3
|
+
type SetStateCallback<S, P> = Partial<S> | ((prev: S, props: P) => Partial<S> | null) | null
|
|
4
|
+
|
|
5
|
+
export interface Component<P = {}, S = {}> {
|
|
6
|
+
props: P
|
|
7
|
+
state: S
|
|
8
|
+
context: any
|
|
9
|
+
refs: Record<string, any>
|
|
10
|
+
_f: any
|
|
11
|
+
_q: ((updater: SetStateCallback<S, P>, cb?: () => void) => void) | null
|
|
12
|
+
_u: ((cb?: () => void) => void) | null
|
|
13
|
+
setState(updater: SetStateCallback<S, P>, callback?: () => void): void
|
|
14
|
+
forceUpdate(callback?: () => void): void
|
|
15
|
+
render(): ReactNode
|
|
16
|
+
componentDidMount?(): void
|
|
17
|
+
componentDidUpdate?(prevProps: P, prevState: S, snapshot?: any): void
|
|
18
|
+
componentWillUnmount?(): void
|
|
19
|
+
shouldComponentUpdate?(nextProps: P, nextState: S, nextCtx: any): boolean
|
|
20
|
+
getSnapshotBeforeUpdate?(prevProps: P, prevState: S): any
|
|
21
|
+
componentDidCatch?(error: any, info: { componentStack: string }): void
|
|
22
|
+
}
|
|
23
|
+
export interface ComponentConstructor {
|
|
24
|
+
new <P = {}, S = {}>(props: P, context?: any): Component<P, S>
|
|
25
|
+
prototype: Component<any, any>
|
|
26
|
+
contextType?: any
|
|
27
|
+
getDerivedStateFromProps?(props: any, state: any): any
|
|
28
|
+
getDerivedStateFromError?(error: any): any
|
|
29
|
+
defaultProps?: any
|
|
30
|
+
displayName?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// A real function constructor also supports the Component.call/apply pattern
|
|
34
|
+
// emitted by ES5 class transforms. The signature keeps generic class consumers.
|
|
35
|
+
export const Component = function Component(this: Component<any, any>, props: any, context?: any) {
|
|
36
|
+
this.props = props
|
|
37
|
+
this.context = context
|
|
38
|
+
this.state = {}
|
|
39
|
+
this.refs = {}
|
|
40
|
+
this._f = this._q = this._u = null
|
|
41
|
+
} as unknown as ComponentConstructor
|
|
42
|
+
Object.assign(Component.prototype, {
|
|
43
|
+
setState(this: Component<any, any>, updater: SetStateCallback<any, any>, callback?: () => void): void {
|
|
44
|
+
if (!this._q) {
|
|
45
|
+
if (process.env.NODE_ENV !== 'production') throw new Error('Cannot call setState on an um component.')
|
|
46
|
+
throw new Error()
|
|
47
|
+
}
|
|
48
|
+
this._q(updater, callback)
|
|
49
|
+
},
|
|
50
|
+
forceUpdate(this: Component<any, any>, callback?: () => void): void {
|
|
51
|
+
if (!this._u) return
|
|
52
|
+
this._u(callback)
|
|
53
|
+
},
|
|
54
|
+
render(): ReactNode {
|
|
55
|
+
if (process.env.NODE_ENV !== 'production') throw new Error('Component subclass must implement render().')
|
|
56
|
+
throw new Error()
|
|
57
|
+
},
|
|
58
|
+
isReactComponent: {},
|
|
59
|
+
})
|
|
60
|
+
export interface PureComponent<P = {}, S = {}> extends Component<P, S> {}
|
|
61
|
+
export const PureComponent = function PureComponent(this: Component<any, any>, props: any, context?: any) {
|
|
62
|
+
Component.call(this, props, context)
|
|
63
|
+
} as unknown as ComponentConstructor
|
|
64
|
+
PureComponent.prototype = Object.create(Component.prototype)
|
|
65
|
+
PureComponent.prototype.constructor = PureComponent
|
|
66
|
+
;(PureComponent.prototype as any).isPureReactComponent = true
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useMemo } from './hooks'
|
|
2
|
+
|
|
3
|
+
const MEMO_CACHE_SENTINEL = Symbol.for('react.memo_cache_sentinel')
|
|
4
|
+
|
|
5
|
+
// Memo dependencies are invalidated by Fast Refresh while component state survives.
|
|
6
|
+
export function c(size: number): Array<unknown> {
|
|
7
|
+
return useMemo(() => new Array<unknown>(size).fill(MEMO_CACHE_SENTINEL), [size])
|
|
8
|
+
}
|