@askrjs/askr 0.0.52 → 0.0.53
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/README.md +5 -1
- package/dist/{runtime/scheduler.js → access-Bg4RJNC8.js} +182 -9
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.js +103 -0
- package/dist/{common/attr-names.js → attr-names-CjhzmHOn.js} +1 -1
- package/dist/benchmark.d.ts +6 -2
- package/dist/benchmark.js +63 -11
- package/dist/boot/index.d.ts +61 -2
- package/dist/boot/index.js +1 -203
- package/dist/boot-j2KoN6ss.js +647 -0
- package/dist/cleanup-COv77su2.js +487 -0
- package/dist/component-internal-B3z7GXlD.js +614 -0
- package/dist/component-lifecycle-CO4hXlP4.js +357 -0
- package/dist/{runtime/component-scope.js → component-scope-CC3cojX9.js} +8 -1
- package/dist/component-scope-CvPba6O6.d.ts +12 -0
- package/dist/components/index.d.ts +17 -2
- package/dist/components/index.js +39 -1
- package/dist/compose-ref-Cc_YkUpM.js +92 -0
- package/dist/{foundations/utilities/compose-ref.d.ts → compose-ref-Cizq72-x.d.ts} +1 -1
- package/dist/control/index.d.ts +1 -3
- package/dist/control/index.js +1 -3
- package/dist/control-BQvNVfAd.d.ts +436 -0
- package/dist/control-BYyLTFyw.js +165 -0
- package/dist/control-Bf4Wkdvv.d.ts +9 -0
- package/dist/{common/control.js → control-DhFRTIoE.js} +1 -1
- package/dist/data/index.d.ts +2 -6
- package/dist/data/index.js +4 -5
- package/dist/data-DnxnDxD-.js +559 -0
- package/dist/{data/data-runtime.js → data-runtime-SJ1BSUvk.js} +32 -31
- package/dist/deferred-lKE8uR0z.js +386 -0
- package/dist/{runtime/effect.js → effect-BwnIvLah.js} +4 -4
- package/dist/fastlane-Dw8SOBr9.js +343 -0
- package/dist/for-internal-BKf_Tnv1.js +1563 -0
- package/dist/foundations/icon/index.d.ts +68 -2
- package/dist/foundations/icon/index.js +85 -1
- package/dist/foundations/index.d.ts +2 -5
- package/dist/foundations/index.js +2 -5
- package/dist/foundations/interactions/index.d.ts +264 -6
- package/dist/foundations/interactions/index.js +1 -6
- package/dist/foundations/state/index.d.ts +32 -1
- package/dist/foundations/state/index.js +78 -1
- package/dist/foundations/structures/index.d.ts +2 -7
- package/dist/foundations/structures/index.js +2 -7
- package/dist/foundations/utilities/index.d.ts +2 -6
- package/dist/foundations/utilities/index.js +2 -5
- package/dist/fx/index.d.ts +190 -3
- package/dist/fx/index.js +454 -4
- package/dist/index-31Uoz_NS.d.ts +239 -0
- package/dist/index-Bki2rqcr.d.ts +233 -0
- package/dist/index-BnU0NPwM.d.ts +101 -0
- package/dist/index-D73jgYx1.d.ts +48 -0
- package/dist/{runtime/runtime.d.ts → index-R2JJIbM-.d.ts} +31 -8
- package/dist/index-SJXJkssx.d.ts +44 -0
- package/dist/index.d.ts +8 -13
- package/dist/index.js +150 -15
- package/dist/interactions-w7gQN4ha.js +280 -0
- package/dist/{data/invalidation-listeners.js → invalidation-listeners-Des3AHYs.js} +1 -1
- package/dist/{common/props.d.ts → jsx-CP0gmYwJ.d.ts} +17 -5
- package/dist/{common/jsx.js → jsx-CUpRxrLH.js} +1 -1
- package/dist/jsx-dev-runtime.d.ts +2 -4
- package/dist/jsx-dev-runtime.js +7 -5
- package/dist/jsx-runtime-92bV2hSa.d.ts +34 -0
- package/dist/jsx-runtime-BVVgDSdq.d.ts +1 -0
- package/dist/jsx-runtime.d.ts +2 -35
- package/dist/jsx-runtime.js +11 -5
- package/dist/{runtime/lifecycle-operations.js → lifecycle-operations-D9va7GOU.js} +4 -5
- package/dist/navigate-BVDCzOuB.d.ts +34 -0
- package/dist/navigate-CmPLSXyw.js +1449 -0
- package/dist/{runtime/portal.js → portal-CyU3Ucf2.js} +33 -36
- package/dist/query-registry-CQIT4mXr.js +73 -0
- package/dist/{common/render-context.js → render-context-Clw3rFiO.js} +14 -6
- package/dist/renderer-DzPjeLby.js +6197 -0
- package/dist/{runtime/resource-operation.js → resource-operation-CEzfpnDk.js} +118 -15
- package/dist/resources/index.d.ts +42 -3
- package/dist/resources/index.js +3 -4
- package/dist/{common/route-activity.js → route-activity-CNJfpwx-.js} +1 -1
- package/dist/route-matching-vJpvLVbX.js +515 -0
- package/dist/router/index.d.ts +166 -14
- package/dist/router/index.js +150 -12
- package/dist/{common/router.d.ts → router-CeYvjj5_.d.ts} +72 -28
- package/dist/{common/router-internal.js → router-internal-BC0w1_xk.js} +1 -1
- package/dist/{runtime/scheduler.d.ts → scheduler-CmLO4Dfm.d.ts} +1 -3
- package/dist/{runtime/selector.js → selector-DafVYzV4.js} +34 -11
- package/dist/{runtime/snapshot-source.js → snapshot-source-BB42xgwb.js} +1 -1
- package/dist/ssg/index.d.ts +252 -4
- package/dist/ssg/index.js +857 -1
- package/dist/ssr/index.d.ts +225 -8
- package/dist/ssr/index.js +3 -6
- package/dist/{common/ssr.js → ssr-CbQO5xd3.js} +1 -1
- package/dist/ssr-D3t80Rc0.js +1413 -0
- package/dist/{runtime/state.js → state-DPl8lffD.js} +3 -5
- package/dist/structures-DUB3HchX.js +221 -0
- package/dist/testing/index.d.ts +3 -2
- package/dist/testing/index.js +2 -5
- package/dist/{jsx/types.d.ts → types-DnQVG4ZY.d.ts} +2 -5
- package/dist/{foundations/utilities/use-id.js → utilities-C_CGX4Dz.js} +1 -1
- package/dist/{ssr/verify-hydration.js → verify-hydration-io9ahUeq.js} +2 -2
- package/dist/{common/vnode.js → vnode-CGMJYPMB.js} +2 -2
- package/package.json +12 -7
- package/dist/bench/components/benchmark-row.d.ts +0 -20
- package/dist/bench/components/benchmark-row.js +0 -40
- package/dist/bench/components/benchmark-table.js +0 -23
- package/dist/bin/askr-ssg.d.ts +0 -27
- package/dist/bin/askr-ssg.js +0 -186
- package/dist/boot/hydration.js +0 -139
- package/dist/boot/root-lifecycle.d.ts +0 -18
- package/dist/boot/root-lifecycle.js +0 -209
- package/dist/boot/route-startup.js +0 -54
- package/dist/boot/types.d.ts +0 -61
- package/dist/common/component.d.ts +0 -18
- package/dist/common/control.d.ts +0 -12
- package/dist/common/dom-range.d.ts +0 -13
- package/dist/common/env.js +0 -41
- package/dist/common/error-boundary.d.ts +0 -15
- package/dist/common/invariant.js +0 -15
- package/dist/common/jsx.d.ts +0 -22
- package/dist/common/logger.js +0 -34
- package/dist/common/promise.js +0 -6
- package/dist/common/ssr-errors.d.ts +0 -10
- package/dist/common/ssr-errors.js +0 -14
- package/dist/common/ssr.d.ts +0 -41
- package/dist/common/vnode.d.ts +0 -21
- package/dist/components/error-boundary.d.ts +0 -14
- package/dist/components/error-boundary.js +0 -41
- package/dist/components/link.d.ts +0 -68
- package/dist/components/link.js +0 -74
- package/dist/control/case.d.ts +0 -18
- package/dist/control/case.js +0 -68
- package/dist/control/for.d.ts +0 -23
- package/dist/control/for.js +0 -61
- package/dist/control/shared.d.ts +0 -8
- package/dist/control/shared.js +0 -18
- package/dist/control/show.d.ts +0 -14
- package/dist/control/show.js +0 -32
- package/dist/data/data-runtime.d.ts +0 -27
- package/dist/data/invalidation.d.ts +0 -8
- package/dist/data/invalidation.js +0 -25
- package/dist/data/mutation-cell.d.ts +0 -27
- package/dist/data/mutation-cell.js +0 -133
- package/dist/data/query-cell.d.ts +0 -47
- package/dist/data/query-cell.js +0 -324
- package/dist/data/query-key.js +0 -40
- package/dist/data/shared.js +0 -20
- package/dist/data/testing.js +0 -2
- package/dist/data/types.d.ts +0 -160
- package/dist/foundations/icon/icon.d.ts +0 -52
- package/dist/foundations/icon/icon.js +0 -86
- package/dist/foundations/icon/icon.types.d.ts +0 -21
- package/dist/foundations/interactions/dismissable.d.ts +0 -71
- package/dist/foundations/interactions/dismissable.js +0 -24
- package/dist/foundations/interactions/focusable.d.ts +0 -21
- package/dist/foundations/interactions/focusable.js +0 -16
- package/dist/foundations/interactions/hoverable.d.ts +0 -25
- package/dist/foundations/interactions/hoverable.js +0 -13
- package/dist/foundations/interactions/interaction-policy.d.ts +0 -49
- package/dist/foundations/interactions/interaction-policy.js +0 -120
- package/dist/foundations/interactions/pressable.d.ts +0 -60
- package/dist/foundations/interactions/pressable.js +0 -49
- package/dist/foundations/interactions/roving-focus.d.ts +0 -51
- package/dist/foundations/interactions/roving-focus.js +0 -69
- package/dist/foundations/state/controllable.d.ts +0 -32
- package/dist/foundations/state/controllable.js +0 -80
- package/dist/foundations/structures/collection.d.ts +0 -51
- package/dist/foundations/structures/collection.js +0 -49
- package/dist/foundations/structures/layer.d.ts +0 -80
- package/dist/foundations/structures/layer.js +0 -79
- package/dist/foundations/structures/layout.d.ts +0 -32
- package/dist/foundations/structures/layout.js +0 -11
- package/dist/foundations/structures/portal.d.ts +0 -2
- package/dist/foundations/structures/portal.js +0 -3
- package/dist/foundations/structures/presence.d.ts +0 -36
- package/dist/foundations/structures/presence.js +0 -37
- package/dist/foundations/structures/slot.d.ts +0 -34
- package/dist/foundations/structures/slot.js +0 -39
- package/dist/foundations/utilities/aria.d.ts +0 -15
- package/dist/foundations/utilities/aria.js +0 -15
- package/dist/foundations/utilities/compose-handlers.d.ts +0 -36
- package/dist/foundations/utilities/compose-handlers.js +0 -18
- package/dist/foundations/utilities/compose-ref.js +0 -16
- package/dist/foundations/utilities/event-types.d.ts +0 -19
- package/dist/foundations/utilities/merge-props.d.ts +0 -4
- package/dist/foundations/utilities/merge-props.js +0 -47
- package/dist/foundations/utilities/use-id.d.ts +0 -31
- package/dist/fx/fx.d.ts +0 -32
- package/dist/fx/fx.js +0 -211
- package/dist/fx/noop.js +0 -7
- package/dist/fx/timing.d.ts +0 -158
- package/dist/fx/timing.js +0 -241
- package/dist/jsx/index.d.ts +0 -2
- package/dist/jsx/index.js +0 -4
- package/dist/jsx/types.js +0 -2
- package/dist/jsx/utils.d.ts +0 -4
- package/dist/jsx/utils.js +0 -17
- package/dist/jsx-runtime2.d.ts +0 -3
- package/dist/jsx-runtime2.js +0 -4
- package/dist/renderer/attributes.js +0 -254
- package/dist/renderer/boundaries.js +0 -142
- package/dist/renderer/boundary-materialization.js +0 -72
- package/dist/renderer/boundary-range-adoption.js +0 -76
- package/dist/renderer/boundary-range-sync.js +0 -101
- package/dist/renderer/boundary-state.js +0 -50
- package/dist/renderer/child-shape.js +0 -83
- package/dist/renderer/children-fastpath.js +0 -149
- package/dist/renderer/children.js +0 -158
- package/dist/renderer/cleanup.js +0 -267
- package/dist/renderer/component-host-cleanup.js +0 -143
- package/dist/renderer/component-host-instances.js +0 -116
- package/dist/renderer/component-host-replacement.js +0 -105
- package/dist/renderer/component-host-results.js +0 -138
- package/dist/renderer/component-host.js +0 -172
- package/dist/renderer/dom-host.js +0 -11
- package/dist/renderer/dom-internal.js +0 -243
- package/dist/renderer/dom-range.js +0 -161
- package/dist/renderer/dom.js +0 -11
- package/dist/renderer/element-children.js +0 -359
- package/dist/renderer/env.js +0 -2
- package/dist/renderer/error-boundary-dom.js +0 -86
- package/dist/renderer/evaluate-dom-range.js +0 -84
- package/dist/renderer/evaluate-reconcile.js +0 -257
- package/dist/renderer/evaluate.js +0 -95
- package/dist/renderer/fastpath.js +0 -142
- package/dist/renderer/for-commit-dom-map.js +0 -71
- package/dist/renderer/for-commit-removal.js +0 -27
- package/dist/renderer/for-commit-reorder.js +0 -87
- package/dist/renderer/for-commit.js +0 -442
- package/dist/renderer/hydration-boundaries.js +0 -60
- package/dist/renderer/hydration-listener-transaction.js +0 -49
- package/dist/renderer/index.js +0 -39
- package/dist/renderer/intrinsic-blueprint-analysis.js +0 -202
- package/dist/renderer/intrinsic-blueprint-bindings.js +0 -152
- package/dist/renderer/intrinsic-blueprint-materialization.js +0 -100
- package/dist/renderer/intrinsic-blueprint.js +0 -30
- package/dist/renderer/intrinsic-hydration-adoption.js +0 -66
- package/dist/renderer/keyed-children.js +0 -26
- package/dist/renderer/keyed.js +0 -167
- package/dist/renderer/namespaces.js +0 -21
- package/dist/renderer/prop-bindings.js +0 -315
- package/dist/renderer/reactive-child-dom.js +0 -139
- package/dist/renderer/reactive-child-sources.js +0 -182
- package/dist/renderer/reactive-children.js +0 -303
- package/dist/renderer/reconcile-commit.js +0 -36
- package/dist/renderer/reconcile-fastpaths.js +0 -100
- package/dist/renderer/reconcile-resolution.js +0 -163
- package/dist/renderer/reconcile.js +0 -37
- package/dist/renderer/retained-element-rollback.js +0 -288
- package/dist/renderer/stable-patch.js +0 -80
- package/dist/renderer/static-reuse.js +0 -94
- package/dist/renderer/types.js +0 -2
- package/dist/renderer/utils.js +0 -265
- package/dist/router/access.js +0 -34
- package/dist/router/activity.d.ts +0 -9
- package/dist/router/activity.js +0 -85
- package/dist/router/authoring.d.ts +0 -21
- package/dist/router/authoring.js +0 -196
- package/dist/router/internal-types.d.ts +0 -30
- package/dist/router/lazy.d.ts +0 -18
- package/dist/router/lazy.js +0 -50
- package/dist/router/manifest.d.ts +0 -9
- package/dist/router/manifest.js +0 -47
- package/dist/router/match.js +0 -120
- package/dist/router/navigate.d.ts +0 -10
- package/dist/router/navigate.js +0 -73
- package/dist/router/navigation-registry.d.ts +0 -31
- package/dist/router/navigation-registry.js +0 -103
- package/dist/router/navigation-scroll.d.ts +0 -13
- package/dist/router/navigation-scroll.js +0 -91
- package/dist/router/navigation-targets.d.ts +0 -30
- package/dist/router/navigation-targets.js +0 -634
- package/dist/router/policy.d.ts +0 -27
- package/dist/router/policy.js +0 -130
- package/dist/router/rendering.d.ts +0 -9
- package/dist/router/rendering.js +0 -47
- package/dist/router/resolution.d.ts +0 -3
- package/dist/router/resolution.js +0 -84
- package/dist/router/route-context.js +0 -77
- package/dist/router/route-matching.d.ts +0 -19
- package/dist/router/route-matching.js +0 -173
- package/dist/router/route-query.d.ts +0 -16
- package/dist/router/route-query.js +0 -45
- package/dist/router/route.d.ts +0 -8
- package/dist/router/route.js +0 -10
- package/dist/router/store.d.ts +0 -49
- package/dist/router/store.js +0 -169
- package/dist/router/testing.js +0 -4
- package/dist/runtime/access.d.ts +0 -19
- package/dist/runtime/access.js +0 -43
- package/dist/runtime/child-scope.d.ts +0 -41
- package/dist/runtime/child-scope.js +0 -134
- package/dist/runtime/component-cleanup.d.ts +0 -15
- package/dist/runtime/component-cleanup.js +0 -68
- package/dist/runtime/component-commit.js +0 -167
- package/dist/runtime/component-facade.d.ts +0 -5
- package/dist/runtime/component-facade.js +0 -6
- package/dist/runtime/component-internal.d.ts +0 -105
- package/dist/runtime/component-internal.js +0 -237
- package/dist/runtime/component-lifecycle.d.ts +0 -10
- package/dist/runtime/component-lifecycle.js +0 -33
- package/dist/runtime/component-scope.d.ts +0 -54
- package/dist/runtime/component.d.ts +0 -5
- package/dist/runtime/component.js +0 -6
- package/dist/runtime/context.d.ts +0 -72
- package/dist/runtime/context.js +0 -236
- package/dist/runtime/control.d.ts +0 -62
- package/dist/runtime/control.js +0 -239
- package/dist/runtime/derive.d.ts +0 -16
- package/dist/runtime/derive.js +0 -140
- package/dist/runtime/dev-namespace.d.ts +0 -30
- package/dist/runtime/dev-namespace.js +0 -64
- package/dist/runtime/effect.d.ts +0 -35
- package/dist/runtime/error-boundary.d.ts +0 -4
- package/dist/runtime/error-boundary.js +0 -29
- package/dist/runtime/events.d.ts +0 -58
- package/dist/runtime/events.js +0 -201
- package/dist/runtime/execution-model.d.ts +0 -6
- package/dist/runtime/execution-model.js +0 -13
- package/dist/runtime/fastlane.d.ts +0 -33
- package/dist/runtime/fastlane.js +0 -173
- package/dist/runtime/for-bench.d.ts +0 -40
- package/dist/runtime/for-bench.js +0 -13
- package/dist/runtime/for-internal.d.ts +0 -106
- package/dist/runtime/for-internal.js +0 -285
- package/dist/runtime/for-reconcile.d.ts +0 -7
- package/dist/runtime/for-reconcile.js +0 -442
- package/dist/runtime/for-scopes.d.ts +0 -26
- package/dist/runtime/for-scopes.js +0 -280
- package/dist/runtime/for-signals.d.ts +0 -39
- package/dist/runtime/for-signals.js +0 -213
- package/dist/runtime/for-types.d.ts +0 -8
- package/dist/runtime/for.d.ts +0 -4
- package/dist/runtime/for.js +0 -5
- package/dist/runtime/index.d.ts +0 -24
- package/dist/runtime/index.js +0 -33
- package/dist/runtime/lifecycle-batch.d.ts +0 -59
- package/dist/runtime/lifecycle-batch.js +0 -178
- package/dist/runtime/lifecycle-operation-settlement.d.ts +0 -5
- package/dist/runtime/lifecycle-operation-settlement.js +0 -51
- package/dist/runtime/lifecycle-operations.d.ts +0 -30
- package/dist/runtime/operations.d.ts +0 -3
- package/dist/runtime/operations.js +0 -3
- package/dist/runtime/perf-metrics.d.ts +0 -27
- package/dist/runtime/perf-metrics.js +0 -6
- package/dist/runtime/portal.d.ts +0 -21
- package/dist/runtime/readable.d.ts +0 -34
- package/dist/runtime/readable.js +0 -183
- package/dist/runtime/resource-cell.js +0 -112
- package/dist/runtime/resource-operation.d.ts +0 -12
- package/dist/runtime/runtime.js +0 -57
- package/dist/runtime/selector-store.js +0 -22
- package/dist/runtime/selector.d.ts +0 -10
- package/dist/runtime/snapshot-source.d.ts +0 -9
- package/dist/runtime/state.d.ts +0 -54
- package/dist/ssg/batch-render.js +0 -101
- package/dist/ssg/create-static-gen.d.ts +0 -66
- package/dist/ssg/create-static-gen.js +0 -250
- package/dist/ssg/generate-metadata.js +0 -92
- package/dist/ssg/generation-plan.js +0 -68
- package/dist/ssg/incremental-manifest.js +0 -54
- package/dist/ssg/resolve-ssg-data.js +0 -103
- package/dist/ssg/route-utils.js +0 -22
- package/dist/ssg/static-routes.js +0 -100
- package/dist/ssg/types.d.ts +0 -188
- package/dist/ssg/write-static-files.js +0 -77
- package/dist/ssr/attrs.js +0 -92
- package/dist/ssr/boundaries.js +0 -124
- package/dist/ssr/component-runtime.js +0 -85
- package/dist/ssr/context.d.ts +0 -49
- package/dist/ssr/context.js +0 -89
- package/dist/ssr/errors.d.ts +0 -9
- package/dist/ssr/errors.js +0 -12
- package/dist/ssr/escape.js +0 -191
- package/dist/ssr/hydration-data.js +0 -8
- package/dist/ssr/hydration-verify.d.ts +0 -11
- package/dist/ssr/hydration-verify.js +0 -171
- package/dist/ssr/index-internal.d.ts +0 -14
- package/dist/ssr/index-internal.js +0 -17
- package/dist/ssr/render-keys.js +0 -14
- package/dist/ssr/render-resolved.d.ts +0 -19
- package/dist/ssr/render-resolved.js +0 -33
- package/dist/ssr/render-sync.d.ts +0 -20
- package/dist/ssr/render-sync.js +0 -283
- package/dist/ssr/route-policy-resolution.js +0 -76
- package/dist/ssr/route-render.d.ts +0 -76
- package/dist/ssr/route-render.js +0 -118
- package/dist/ssr/sink.d.ts +0 -25
- package/dist/ssr/sink.js +0 -84
- package/dist/ssr/types.d.ts +0 -22
package/dist/ssr/context.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { isPromiseLike } from "../common/promise.js";
|
|
2
|
-
import { SSRDataMissingError } from "../common/ssr-errors.js";
|
|
3
|
-
import { configureRenderContextProvider } from "../common/render-context.js";
|
|
4
|
-
import "./errors.js";
|
|
5
|
-
import { clearEscapeCache } from "./escape.js";
|
|
6
|
-
//#region src/ssr/context.ts
|
|
7
|
-
/**
|
|
8
|
-
* SSR Context Management
|
|
9
|
-
*
|
|
10
|
-
* Provides render-context storage for server-side rendering.
|
|
11
|
-
* Node SSR lazily installs AsyncLocalStorage on first use; browser builds use
|
|
12
|
-
* the fallback stack.
|
|
13
|
-
*/
|
|
14
|
-
const FALLBACK_ASYNC_CONTEXT_ERROR = "[Askr] async SSR render context fallback is unsupported in this environment. Use synchronous SSR rendering or a runtime with AsyncLocalStorage.";
|
|
15
|
-
let renderContextAccessor = null;
|
|
16
|
-
let renderContextAccessorInitialized = false;
|
|
17
|
-
let fallbackStack = null;
|
|
18
|
-
function ensureRenderContextAccessor() {
|
|
19
|
-
if (renderContextAccessorInitialized) return;
|
|
20
|
-
renderContextAccessorInitialized = true;
|
|
21
|
-
if (typeof process === "undefined" || !process.versions?.node) return;
|
|
22
|
-
try {
|
|
23
|
-
const asyncHooks = new Function("return require(" + JSON.stringify("async_hooks") + ");")();
|
|
24
|
-
if (asyncHooks.AsyncLocalStorage) {
|
|
25
|
-
const asyncLocalStorage = new asyncHooks.AsyncLocalStorage();
|
|
26
|
-
renderContextAccessor = {
|
|
27
|
-
getStore() {
|
|
28
|
-
return asyncLocalStorage.getStore();
|
|
29
|
-
},
|
|
30
|
-
run(store, fn) {
|
|
31
|
-
return asyncLocalStorage.run(store, fn);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
} catch {}
|
|
36
|
-
}
|
|
37
|
-
function createRenderContext(seed = 12345, opts = {}) {
|
|
38
|
-
clearEscapeCache();
|
|
39
|
-
return {
|
|
40
|
-
url: opts.url ?? "",
|
|
41
|
-
seed,
|
|
42
|
-
data: opts.data,
|
|
43
|
-
params: opts.params,
|
|
44
|
-
routes: opts.routes,
|
|
45
|
-
routeAuth: opts.routeAuth,
|
|
46
|
-
signal: opts.signal,
|
|
47
|
-
dataRuntime: opts.dataRuntime,
|
|
48
|
-
queryCache: /* @__PURE__ */ new Map(),
|
|
49
|
-
ssrCleanupFns: [],
|
|
50
|
-
keyCounter: 0,
|
|
51
|
-
renderData: null
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Run a function with the given render context.
|
|
56
|
-
* Concurrency-safe in Node.js via AsyncLocalStorage.
|
|
57
|
-
*/
|
|
58
|
-
function withRenderContext(ctx, fn) {
|
|
59
|
-
ensureRenderContextAccessor();
|
|
60
|
-
if (renderContextAccessor) return renderContextAccessor.run(ctx, fn);
|
|
61
|
-
const prev = fallbackStack;
|
|
62
|
-
fallbackStack = ctx;
|
|
63
|
-
try {
|
|
64
|
-
const result = fn();
|
|
65
|
-
if (isPromiseLike(result)) throw new Error(FALLBACK_ASYNC_CONTEXT_ERROR);
|
|
66
|
-
return result;
|
|
67
|
-
} finally {
|
|
68
|
-
fallbackStack = prev;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Get the current render context.
|
|
73
|
-
* Returns null if not inside a render.
|
|
74
|
-
*/
|
|
75
|
-
function getRenderContext() {
|
|
76
|
-
ensureRenderContextAccessor();
|
|
77
|
-
if (renderContextAccessor) return renderContextAccessor.getStore() ?? null;
|
|
78
|
-
return fallbackStack;
|
|
79
|
-
}
|
|
80
|
-
configureRenderContextProvider({ getRenderContext });
|
|
81
|
-
/**
|
|
82
|
-
* Centralized SSR enforcement helper — throws a consistent error when async
|
|
83
|
-
* data is encountered during synchronous SSR.
|
|
84
|
-
*/
|
|
85
|
-
function throwSSRDataMissing() {
|
|
86
|
-
throw new SSRDataMissingError();
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
export { SSRDataMissingError, createRenderContext, getRenderContext, throwSSRDataMissing, withRenderContext };
|
package/dist/ssr/errors.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SSRDataMissingError } from "../common/ssr-errors.js";
|
|
2
|
-
|
|
3
|
-
//#region src/ssr/errors.d.ts
|
|
4
|
-
declare class SSRInvariantError extends Error {
|
|
5
|
-
readonly code = "SSR_INVARIANT_VIOLATION";
|
|
6
|
-
constructor(message: string);
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { SSRDataMissingError };
|
package/dist/ssr/errors.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SSRDataMissingError } from "../common/ssr-errors.js";
|
|
2
|
-
//#region src/ssr/errors.ts
|
|
3
|
-
var SSRInvariantError = class SSRInvariantError extends Error {
|
|
4
|
-
constructor(message) {
|
|
5
|
-
super(message);
|
|
6
|
-
this.code = "SSR_INVARIANT_VIOLATION";
|
|
7
|
-
this.name = "SSRInvariantError";
|
|
8
|
-
Object.setPrototypeOf(this, SSRInvariantError.prototype);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
//#endregion
|
|
12
|
-
export { SSRDataMissingError, SSRInvariantError };
|
package/dist/ssr/escape.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
//#region src/ssr/escape.ts
|
|
2
|
-
/**
|
|
3
|
-
* HTML escaping utilities for SSR
|
|
4
|
-
*
|
|
5
|
-
* Centralizes text and attribute escaping to avoid duplication
|
|
6
|
-
* between sync and streaming SSR renderers.
|
|
7
|
-
*/
|
|
8
|
-
const VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
9
|
-
"area",
|
|
10
|
-
"base",
|
|
11
|
-
"br",
|
|
12
|
-
"col",
|
|
13
|
-
"embed",
|
|
14
|
-
"hr",
|
|
15
|
-
"img",
|
|
16
|
-
"input",
|
|
17
|
-
"link",
|
|
18
|
-
"meta",
|
|
19
|
-
"param",
|
|
20
|
-
"source",
|
|
21
|
-
"track",
|
|
22
|
-
"wbr"
|
|
23
|
-
]);
|
|
24
|
-
const escapeCache = /* @__PURE__ */ new Map();
|
|
25
|
-
const MAX_CACHE_SIZE = 256;
|
|
26
|
-
const CSS_UNSAFE_RE = /[{}<>\\]/g;
|
|
27
|
-
const CSS_URI_SCHEME_RE = /(?:^|[\s(,])([a-z][a-z0-9+.-]*):/i;
|
|
28
|
-
const CSS_FUNCTION_NAME_RE = /([a-z-][a-z0-9-]*)\s*\(/gi;
|
|
29
|
-
const CSS_ALLOWED_FUNCTIONS = /* @__PURE__ */ new Set([
|
|
30
|
-
"var",
|
|
31
|
-
"calc",
|
|
32
|
-
"min",
|
|
33
|
-
"max",
|
|
34
|
-
"clamp",
|
|
35
|
-
"rgb",
|
|
36
|
-
"rgba",
|
|
37
|
-
"hsl",
|
|
38
|
-
"hsla",
|
|
39
|
-
"lab",
|
|
40
|
-
"lch",
|
|
41
|
-
"oklab",
|
|
42
|
-
"oklch",
|
|
43
|
-
"color",
|
|
44
|
-
"color-mix",
|
|
45
|
-
"translate",
|
|
46
|
-
"translatex",
|
|
47
|
-
"translatey",
|
|
48
|
-
"translatez",
|
|
49
|
-
"scale",
|
|
50
|
-
"scalex",
|
|
51
|
-
"scaley",
|
|
52
|
-
"scalez",
|
|
53
|
-
"rotate",
|
|
54
|
-
"rotatex",
|
|
55
|
-
"rotatey",
|
|
56
|
-
"rotatez",
|
|
57
|
-
"skew",
|
|
58
|
-
"skewx",
|
|
59
|
-
"skewy",
|
|
60
|
-
"matrix",
|
|
61
|
-
"matrix3d",
|
|
62
|
-
"linear-gradient",
|
|
63
|
-
"radial-gradient",
|
|
64
|
-
"conic-gradient",
|
|
65
|
-
"repeating-linear-gradient",
|
|
66
|
-
"repeating-radial-gradient",
|
|
67
|
-
"repeating-conic-gradient",
|
|
68
|
-
"cubic-bezier",
|
|
69
|
-
"steps"
|
|
70
|
-
]);
|
|
71
|
-
const STYLE_PROP_CACHE = /* @__PURE__ */ new Map();
|
|
72
|
-
const MAX_STYLE_PROP_CACHE_SIZE = 512;
|
|
73
|
-
function toKebabCached(prop) {
|
|
74
|
-
const cached = STYLE_PROP_CACHE.get(prop);
|
|
75
|
-
if (cached !== void 0) return cached;
|
|
76
|
-
const kebab = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
77
|
-
if (STYLE_PROP_CACHE.size < MAX_STYLE_PROP_CACHE_SIZE) STYLE_PROP_CACHE.set(prop, kebab);
|
|
78
|
-
return kebab;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Clear the escape cache. Call between SSR requests in long-running servers
|
|
82
|
-
* to prevent memory buildup from unique strings.
|
|
83
|
-
*/
|
|
84
|
-
function clearEscapeCache() {
|
|
85
|
-
escapeCache.clear();
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Fast check if a string needs text escaping.
|
|
89
|
-
* Used to skip the full escape call when not needed.
|
|
90
|
-
*/
|
|
91
|
-
function needsEscapeText(text) {
|
|
92
|
-
for (let i = 0; i < text.length; i++) {
|
|
93
|
-
const ch = text.charCodeAt(i);
|
|
94
|
-
if (ch === 38 || ch === 60 || ch === 62) return true;
|
|
95
|
-
}
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Fast check if a string needs attribute escaping.
|
|
100
|
-
* Checks for & " ' < > characters.
|
|
101
|
-
*/
|
|
102
|
-
function needsEscapeAttr(value) {
|
|
103
|
-
for (let i = 0; i < value.length; i++) {
|
|
104
|
-
const ch = value.charCodeAt(i);
|
|
105
|
-
if (ch === 38 || ch === 34 || ch === 39 || ch === 60 || ch === 62) return true;
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Escape HTML special characters in text content
|
|
111
|
-
* Fast-path: cache first, then scan-then-escape for new strings
|
|
112
|
-
*/
|
|
113
|
-
function escapeText(text) {
|
|
114
|
-
const useCache = text.length <= 64;
|
|
115
|
-
if (useCache) {
|
|
116
|
-
const cached = escapeCache.get(text);
|
|
117
|
-
if (cached !== void 0) return cached;
|
|
118
|
-
}
|
|
119
|
-
if (!needsEscapeText(text)) {
|
|
120
|
-
if (useCache && escapeCache.size < MAX_CACHE_SIZE) escapeCache.set(text, text);
|
|
121
|
-
return text;
|
|
122
|
-
}
|
|
123
|
-
let escaped = "";
|
|
124
|
-
let lastIndex = 0;
|
|
125
|
-
for (let i = 0; i < text.length; i++) {
|
|
126
|
-
const ch = text.charCodeAt(i);
|
|
127
|
-
let entity;
|
|
128
|
-
if (ch === 38) entity = "&";
|
|
129
|
-
else if (ch === 60) entity = "<";
|
|
130
|
-
else if (ch === 62) entity = ">";
|
|
131
|
-
else continue;
|
|
132
|
-
escaped += text.slice(lastIndex, i) + entity;
|
|
133
|
-
lastIndex = i + 1;
|
|
134
|
-
}
|
|
135
|
-
const result = escaped + text.slice(lastIndex);
|
|
136
|
-
if (useCache && escapeCache.size < MAX_CACHE_SIZE) escapeCache.set(text, result);
|
|
137
|
-
return result;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Escape HTML special characters in attribute values.
|
|
141
|
-
* Single-pass scan: returns the original string unchanged when no special
|
|
142
|
-
* characters are found, so callers can drop separate needsEscapeAttr checks.
|
|
143
|
-
*/
|
|
144
|
-
function escapeAttr(value) {
|
|
145
|
-
let escaped = "";
|
|
146
|
-
let lastIndex = 0;
|
|
147
|
-
for (let i = 0; i < value.length; i++) {
|
|
148
|
-
const ch = value.charCodeAt(i);
|
|
149
|
-
let entity;
|
|
150
|
-
if (ch === 38) entity = "&";
|
|
151
|
-
else if (ch === 34) entity = """;
|
|
152
|
-
else if (ch === 39) entity = "'";
|
|
153
|
-
else if (ch === 60) entity = "<";
|
|
154
|
-
else if (ch === 62) entity = ">";
|
|
155
|
-
else continue;
|
|
156
|
-
escaped += value.slice(lastIndex, i) + entity;
|
|
157
|
-
lastIndex = i + 1;
|
|
158
|
-
}
|
|
159
|
-
return lastIndex === 0 ? value : escaped + value.slice(lastIndex);
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Escape CSS value to prevent injection attacks.
|
|
163
|
-
* Removes characters that could break out of CSS context.
|
|
164
|
-
*/
|
|
165
|
-
function escapeCssValue(value) {
|
|
166
|
-
const str = String(value);
|
|
167
|
-
if (CSS_URI_SCHEME_RE.test(str)) return "";
|
|
168
|
-
if (str.includes("(")) {
|
|
169
|
-
for (const match of str.matchAll(CSS_FUNCTION_NAME_RE)) if (!CSS_ALLOWED_FUNCTIONS.has(match[1].toLowerCase())) return "";
|
|
170
|
-
}
|
|
171
|
-
return str.replace(CSS_UNSAFE_RE, "");
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Convert style object to CSS string with value escaping
|
|
175
|
-
* Optimized to avoid Object.entries allocation
|
|
176
|
-
*/
|
|
177
|
-
function styleObjToCss(value) {
|
|
178
|
-
if (!value || typeof value !== "object") return null;
|
|
179
|
-
const styleObj = value;
|
|
180
|
-
let result = "";
|
|
181
|
-
for (const k in styleObj) {
|
|
182
|
-
const v = styleObj[k];
|
|
183
|
-
if (v === null || v === void 0 || v === false) continue;
|
|
184
|
-
const prop = toKebabCached(k);
|
|
185
|
-
const safeValue = escapeCssValue(String(v));
|
|
186
|
-
if (safeValue) result += `${prop}:${safeValue};`;
|
|
187
|
-
}
|
|
188
|
-
return result || null;
|
|
189
|
-
}
|
|
190
|
-
//#endregion
|
|
191
|
-
export { VOID_ELEMENTS, clearEscapeCache, escapeAttr, escapeText, needsEscapeAttr, needsEscapeText, styleObjToCss };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SSR_RENDER_DATA_ATTR } from "../common/ssr.js";
|
|
2
|
-
//#region src/ssr/hydration-data.ts
|
|
3
|
-
function serializeHydrationRenderData(data) {
|
|
4
|
-
if (!data || Object.keys(data).length === 0) return "";
|
|
5
|
-
return `<script type="application/json" ${SSR_RENDER_DATA_ATTR}="true">${JSON.stringify(data).replace(/</g, "\\u003C").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029")}<\/script>`;
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
export { serializeHydrationRenderData };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RenderContext } from "./context.js";
|
|
2
|
-
|
|
3
|
-
//#region src/ssr/hydration-verify.d.ts
|
|
4
|
-
type VerifyState = {
|
|
5
|
-
current: ChildNode | null;
|
|
6
|
-
pendingText: string;
|
|
7
|
-
};
|
|
8
|
-
declare function verifyRenderableNode(value: unknown, state: VerifyState, ctx: RenderContext): boolean;
|
|
9
|
-
declare const hydrationVerifier: {
|
|
10
|
-
verifyRenderableNode: typeof verifyRenderableNode;
|
|
11
|
-
};
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { __CONTROL_BOUNDARY__ } from "../common/control.js";
|
|
2
|
-
import { __ERROR_BOUNDARY__ } from "../common/vnode.js";
|
|
3
|
-
import { Fragment } from "../common/jsx.js";
|
|
4
|
-
import { getPublicAttributeName } from "../common/attr-names.js";
|
|
5
|
-
import "../jsx/index.js";
|
|
6
|
-
import { VOID_ELEMENTS, styleObjToCss } from "./escape.js";
|
|
7
|
-
import { executeComponentSync } from "./component-runtime.js";
|
|
8
|
-
import { createErrorBoundaryReset, getErrorBoundaryState, getRenderableChildren, normalizeRenderableChildren, resolveErrorBoundaryFallbackNode, withControlBoundaryChildren } from "./boundaries.js";
|
|
9
|
-
import { inheritRenderableKey } from "./render-sync.js";
|
|
10
|
-
//#region src/ssr/hydration-verify.ts
|
|
11
|
-
const RANGE_START = "askr-range-start";
|
|
12
|
-
const RANGE_END = "askr-range-end";
|
|
13
|
-
function isMultiRangeChild(child) {
|
|
14
|
-
if (Array.isArray(child)) return child.length !== 1;
|
|
15
|
-
if (!child || typeof child !== "object" || !("type" in child)) return false;
|
|
16
|
-
const vnode = child;
|
|
17
|
-
return vnode.type === Fragment && (getRenderableChildren(vnode)?.length ?? 0) !== 1;
|
|
18
|
-
}
|
|
19
|
-
function verifyExpectedRangeChild(child, state, ctx) {
|
|
20
|
-
if (!isMultiRangeChild(child)) return verifyExpectedNode(child, state, ctx);
|
|
21
|
-
if (!state.current || state.current.nodeType !== Node.COMMENT_NODE || state.current.data !== RANGE_START) return false;
|
|
22
|
-
state.current = state.current.nextSibling;
|
|
23
|
-
if (!verifyExpectedNode(child, state, ctx)) return false;
|
|
24
|
-
if (!state.current || state.current.nodeType !== Node.COMMENT_NODE || state.current.data !== RANGE_END) return false;
|
|
25
|
-
state.current = state.current.nextSibling;
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
function isSSRAttrEventHandler(key) {
|
|
29
|
-
return key.length >= 3 && key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.charCodeAt(2) >= 65 && key.charCodeAt(2) <= 90;
|
|
30
|
-
}
|
|
31
|
-
function flushPendingText(state) {
|
|
32
|
-
if (state.pendingText.length === 0) return true;
|
|
33
|
-
if (!state.current || state.current.nodeType !== Node.TEXT_NODE) return false;
|
|
34
|
-
if (state.current.textContent !== state.pendingText) return false;
|
|
35
|
-
state.current = state.current.nextSibling;
|
|
36
|
-
state.pendingText = "";
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
function verifyRenderedAttrs(element, props) {
|
|
40
|
-
const matchedAttrs = /* @__PURE__ */ new Set();
|
|
41
|
-
let dangerousHtml;
|
|
42
|
-
if (!props || typeof props !== "object") return {
|
|
43
|
-
matched: element.attributes.length === 0,
|
|
44
|
-
dangerousHtml
|
|
45
|
-
};
|
|
46
|
-
const propsObj = props;
|
|
47
|
-
for (const key in propsObj) {
|
|
48
|
-
const value = propsObj[key];
|
|
49
|
-
if (key === "children" || key === "key" || key === "ref" || key === "dangerouslySetInnerHTML") {
|
|
50
|
-
if (key === "dangerouslySetInnerHTML" && value && typeof value === "object" && "__html" in value) dangerousHtml = String(value.__html);
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (isSSRAttrEventHandler(key) || key.charCodeAt(0) === 95) continue;
|
|
54
|
-
const attrName = key === "class" ? "class" : getPublicAttributeName(key);
|
|
55
|
-
if (attrName === "style") {
|
|
56
|
-
const css = typeof value === "string" ? value : styleObjToCss(value);
|
|
57
|
-
if (!css) continue;
|
|
58
|
-
if (element.getAttribute("style") !== css) return { matched: false };
|
|
59
|
-
matchedAttrs.add("style");
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
if (value === true) {
|
|
63
|
-
if (!element.hasAttribute(attrName)) return { matched: false };
|
|
64
|
-
matchedAttrs.add(attrName);
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if (value === false || value === null || value === void 0) continue;
|
|
68
|
-
const stringValue = String(value);
|
|
69
|
-
if (element.getAttribute(attrName) !== stringValue) return { matched: false };
|
|
70
|
-
matchedAttrs.add(attrName);
|
|
71
|
-
}
|
|
72
|
-
if (element.attributes.length !== matchedAttrs.size) return { matched: false };
|
|
73
|
-
return {
|
|
74
|
-
matched: true,
|
|
75
|
-
dangerousHtml
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function verifyExpectedNode(node, state, ctx) {
|
|
79
|
-
if (node === null || node === void 0 || node === false) return true;
|
|
80
|
-
if (typeof node === "string" || typeof node === "number") {
|
|
81
|
-
state.pendingText += String(node);
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
if (Array.isArray(node)) return verifyExpectedChildren(node, state, ctx);
|
|
85
|
-
if (!node || typeof node !== "object" || !("type" in node)) return true;
|
|
86
|
-
const vnode = node;
|
|
87
|
-
const { type, props } = vnode;
|
|
88
|
-
if (typeof type === "function") return verifyRenderableNode(inheritRenderableKey(vnode, executeComponentSync(type, props, ctx)), state, ctx);
|
|
89
|
-
if (typeof type === "symbol") {
|
|
90
|
-
if (type === __CONTROL_BOUNDARY__) return withControlBoundaryChildren(vnode, (children) => {
|
|
91
|
-
if (!children || children.length === 0) return true;
|
|
92
|
-
if ((vnode._controlState ?? vnode._forState)?.kind === "for") {
|
|
93
|
-
for (const child of children) if (!verifyExpectedRangeChild(child, state, ctx)) return false;
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
const wrapped = children.length !== 1 || isMultiRangeChild(children[0]);
|
|
97
|
-
if (wrapped) {
|
|
98
|
-
if (!state.current || state.current.nodeType !== Node.COMMENT_NODE || state.current.data !== RANGE_START) return false;
|
|
99
|
-
state.current = state.current.nextSibling;
|
|
100
|
-
}
|
|
101
|
-
for (const child of children) if (!verifyExpectedNode(child, state, ctx)) return false;
|
|
102
|
-
if (wrapped) {
|
|
103
|
-
if (!state.current || state.current.nodeType !== Node.COMMENT_NODE || state.current.data !== RANGE_END) return false;
|
|
104
|
-
state.current = state.current.nextSibling;
|
|
105
|
-
}
|
|
106
|
-
return true;
|
|
107
|
-
});
|
|
108
|
-
if (type === __ERROR_BOUNDARY__) {
|
|
109
|
-
const boundaryState = getErrorBoundaryState(vnode);
|
|
110
|
-
const fallback = props?.fallback;
|
|
111
|
-
const reset = createErrorBoundaryReset(vnode);
|
|
112
|
-
const snapshot = {
|
|
113
|
-
current: state.current,
|
|
114
|
-
pendingText: state.pendingText
|
|
115
|
-
};
|
|
116
|
-
if (boundaryState?.error != null) return verifyRenderableNode(resolveErrorBoundaryFallbackNode(fallback, boundaryState.error, reset), state, ctx);
|
|
117
|
-
try {
|
|
118
|
-
if (verifyExpectedChildren(normalizeRenderableChildren(props?.children), state, ctx)) return true;
|
|
119
|
-
} catch (error) {
|
|
120
|
-
if (boundaryState) {
|
|
121
|
-
boundaryState.error = error;
|
|
122
|
-
boundaryState.notified = true;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
state.current = snapshot.current;
|
|
126
|
-
state.pendingText = snapshot.pendingText;
|
|
127
|
-
return verifyRenderableNode(resolveErrorBoundaryFallbackNode(fallback, boundaryState?.error ?? /* @__PURE__ */ new Error("ErrorBoundary render failed"), reset), state, ctx);
|
|
128
|
-
}
|
|
129
|
-
if (type !== Fragment) throw new Error(`verifyHydrationSyncForUrl: unsupported VNode symbol type: ${String(type)}`);
|
|
130
|
-
const children = getRenderableChildren(vnode);
|
|
131
|
-
if (!children || children.length === 0) return true;
|
|
132
|
-
for (let index = 0; index < children.length; index += 1) if (!verifyExpectedNode(children[index], state, ctx)) return false;
|
|
133
|
-
return true;
|
|
134
|
-
}
|
|
135
|
-
if (!flushPendingText(state)) return false;
|
|
136
|
-
if (!state.current || state.current.nodeType !== Node.ELEMENT_NODE) return false;
|
|
137
|
-
const actualElement = state.current;
|
|
138
|
-
if (actualElement.tagName.toLowerCase() !== String(type).toLowerCase()) return false;
|
|
139
|
-
const attrMatch = verifyRenderedAttrs(actualElement, props);
|
|
140
|
-
if (!attrMatch.matched) return false;
|
|
141
|
-
if (VOID_ELEMENTS.has(String(type))) {
|
|
142
|
-
if (actualElement.firstChild !== null) return false;
|
|
143
|
-
state.current = actualElement.nextSibling;
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
if (attrMatch.dangerousHtml !== void 0) {
|
|
147
|
-
if (actualElement.innerHTML !== attrMatch.dangerousHtml) return false;
|
|
148
|
-
state.current = actualElement.nextSibling;
|
|
149
|
-
return true;
|
|
150
|
-
}
|
|
151
|
-
const childState = {
|
|
152
|
-
current: actualElement.firstChild,
|
|
153
|
-
pendingText: ""
|
|
154
|
-
};
|
|
155
|
-
const children = getRenderableChildren(vnode);
|
|
156
|
-
if (children && children.length > 0) {
|
|
157
|
-
for (let index = 0; index < children.length; index += 1) if (!verifyExpectedNode(children[index], childState, ctx)) return false;
|
|
158
|
-
}
|
|
159
|
-
if (!flushPendingText(childState) || childState.current !== null) return false;
|
|
160
|
-
state.current = actualElement.nextSibling;
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
function verifyExpectedChildren(children, state, ctx) {
|
|
164
|
-
if (!children || children.length === 0) return true;
|
|
165
|
-
for (let index = 0; index < children.length; index += 1) if (!verifyExpectedNode(children[index], state, ctx)) return false;
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
function verifyRenderableNode(value, state, ctx) {
|
|
169
|
-
return Array.isArray(value) ? verifyExpectedChildren(normalizeRenderableChildren(value), state, ctx) : verifyExpectedNode(value, state, ctx);
|
|
170
|
-
}
|
|
171
|
-
//#endregion
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { JSXElement } from "../common/jsx.js";
|
|
2
|
-
import { DocumentRenderArgs, DocumentRenderContext, DocumentRenderer } from "../common/ssr.js";
|
|
3
|
-
import { SSRDataMissingError } from "../common/ssr-errors.js";
|
|
4
|
-
import { RouteRenderOptions, RouteStreamOptions, SSRRoute, resolveRequest } from "./route-render.js";
|
|
5
|
-
import { SSRComponent, VNode } from "./types.js";
|
|
6
|
-
import { renderToStringSync } from "./render-sync.js";
|
|
7
|
-
import { renderResolvedToStringSync } from "./render-resolved.js";
|
|
8
|
-
|
|
9
|
-
//#region src/ssr/index-internal.d.ts
|
|
10
|
-
declare function renderToString(component: (props?: Record<string, unknown>) => VNode | JSXElement | string | number | null): string;
|
|
11
|
-
declare function renderToString(opts: RouteRenderOptions): string;
|
|
12
|
-
declare function renderToStream(opts: RouteStreamOptions): void;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { type DocumentRenderArgs, type DocumentRenderContext, type DocumentRenderer, type SSRComponent, SSRDataMissingError, type SSRRoute, type VNode, renderResolvedToStringSync, renderToStream, renderToString, renderToStringSync, resolveRequest };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SSRDataMissingError } from "../common/ssr-errors.js";
|
|
2
|
-
import "./context.js";
|
|
3
|
-
import { renderRouteToStream, renderRouteToString, resolveRequest } from "./route-render.js";
|
|
4
|
-
import { renderSSRRouteAppToSink, renderToStringSync } from "./render-sync.js";
|
|
5
|
-
import "./hydration-verify.js";
|
|
6
|
-
import { renderResolvedToStringSync } from "./render-resolved.js";
|
|
7
|
-
//#region src/ssr/index-internal.ts
|
|
8
|
-
const routeRenderHost = { renderAppToSink: renderSSRRouteAppToSink };
|
|
9
|
-
function renderToString(arg) {
|
|
10
|
-
if (typeof arg === "function") return renderToStringSync(arg);
|
|
11
|
-
return renderRouteToString(arg, routeRenderHost);
|
|
12
|
-
}
|
|
13
|
-
function renderToStream(opts) {
|
|
14
|
-
renderRouteToStream(opts, routeRenderHost);
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { SSRDataMissingError, renderResolvedToStringSync, renderToStream, renderToString, renderToStringSync, resolveRequest };
|
package/dist/ssr/render-keys.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { startRenderPhase as startRenderPhase$1, stopRenderPhase as stopRenderPhase$1 } from "../common/render-context.js";
|
|
2
|
-
function startRenderPhase(data) {
|
|
3
|
-
startRenderPhase$1(data);
|
|
4
|
-
}
|
|
5
|
-
function stopRenderPhase() {
|
|
6
|
-
stopRenderPhase$1();
|
|
7
|
-
}
|
|
8
|
-
const PREPASS_REMOVED_MSG = "SSR collection/prepass is removed: SSR is strictly synchronous";
|
|
9
|
-
/** @deprecated SSR prepass has been removed */
|
|
10
|
-
async function resolvePlan(_plan) {
|
|
11
|
-
throw new Error(`${PREPASS_REMOVED_MSG}; async resource plans are not supported`);
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { resolvePlan, startRenderPhase, stopRenderPhase };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SSRData } from "../common/ssr.js";
|
|
2
|
-
import { RouteHandler } from "../common/router.js";
|
|
3
|
-
//#region src/ssr/render-resolved.d.ts
|
|
4
|
-
declare function renderResolvedToStringSync(opts: {
|
|
5
|
-
url: string;
|
|
6
|
-
routes: ReadonlyArray<{
|
|
7
|
-
path: string;
|
|
8
|
-
handler: RouteHandler;
|
|
9
|
-
namespace?: string;
|
|
10
|
-
}>;
|
|
11
|
-
handler: RouteHandler;
|
|
12
|
-
params?: Record<string, string>;
|
|
13
|
-
options?: {
|
|
14
|
-
seed?: number;
|
|
15
|
-
data?: SSRData;
|
|
16
|
-
};
|
|
17
|
-
}): string;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { renderResolvedToStringSync };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { resolveRouteFromRoutes } from "../router/route-matching.js";
|
|
2
|
-
import "../router/route.js";
|
|
3
|
-
import { renderToString } from "./index-internal.js";
|
|
4
|
-
import "./index.js";
|
|
5
|
-
//#region src/ssr/render-resolved.ts
|
|
6
|
-
function sameRouteParams(left, right) {
|
|
7
|
-
if (!left || !right) return !left && !right;
|
|
8
|
-
const leftKeys = Object.keys(left);
|
|
9
|
-
const rightKeys = Object.keys(right);
|
|
10
|
-
if (leftKeys.length !== rightKeys.length) return false;
|
|
11
|
-
for (const key of leftKeys) if (left[key] !== right[key]) return false;
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
function renderResolvedToStringSync(opts) {
|
|
15
|
-
const { url, routes, handler, params, options } = opts;
|
|
16
|
-
const requestUrl = new URL(url, "http://localhost");
|
|
17
|
-
const matchedIndex = routes.findIndex((route) => {
|
|
18
|
-
const resolved = resolveRouteFromRoutes(requestUrl.pathname, [route]);
|
|
19
|
-
return resolved !== null && resolved.handler === route.handler && sameRouteParams(resolved.params, params);
|
|
20
|
-
});
|
|
21
|
-
if (matchedIndex < 0) throw new Error(`renderResolvedToStringSync: no route found for url: ${url}`);
|
|
22
|
-
return renderToString({
|
|
23
|
-
url,
|
|
24
|
-
routes: routes.map((route, index) => index === matchedIndex ? {
|
|
25
|
-
...route,
|
|
26
|
-
handler
|
|
27
|
-
} : route),
|
|
28
|
-
seed: options?.seed,
|
|
29
|
-
data: options?.data
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
export { renderResolvedToStringSync };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { JSXElement } from "../common/jsx.js";
|
|
2
|
-
import { SSRData } from "../common/ssr.js";
|
|
3
|
-
import { RenderContext } from "./context.js";
|
|
4
|
-
import { RouteAppRenderInput } from "./route-render.js";
|
|
5
|
-
import { VNode } from "./types.js";
|
|
6
|
-
|
|
7
|
-
//#region src/ssr/render-sync.d.ts
|
|
8
|
-
declare function inheritRenderableKey(source: VNode | JSXElement, result: VNode | JSXElement): VNode | JSXElement;
|
|
9
|
-
declare function renderRenderableSyncToSink(value: unknown, sink: {
|
|
10
|
-
write(html: string): void;
|
|
11
|
-
write2?: (a: string, b: string) => void;
|
|
12
|
-
write3?: (a: string, b: string, c: string) => void;
|
|
13
|
-
}, ctx: RenderContext): void;
|
|
14
|
-
declare function renderToStringSync(component: (props?: Record<string, unknown>) => VNode | JSXElement | string | number | boolean | null | undefined, props?: Record<string, unknown>, options?: {
|
|
15
|
-
seed?: number;
|
|
16
|
-
data?: SSRData;
|
|
17
|
-
}): string;
|
|
18
|
-
declare function renderSSRRouteAppToSink(input: RouteAppRenderInput): void;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { renderToStringSync };
|