@ogygia/core 0.0.0 → 0.11.0
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/README.md +7 -1
- package/ambient.d.ts +194 -0
- package/dist/ClientBindingStub.svelte +6 -0
- package/dist/ClientBindingStub.svelte.d.ts +26 -0
- package/dist/KeepHost.svelte +19 -0
- package/dist/KeepHost.svelte.d.ts +10 -0
- package/dist/LakeBoundary.svelte +16 -0
- package/dist/LakeBoundary.svelte.d.ts +11 -0
- package/dist/LateIsland.svelte +22 -0
- package/dist/LateIsland.svelte.d.ts +15 -0
- package/dist/LateIslandAwait.svelte +17 -0
- package/dist/LateIslandAwait.svelte.d.ts +15 -0
- package/dist/LiveHost.svelte +19 -0
- package/dist/LiveHost.svelte.d.ts +10 -0
- package/dist/NestedProvider.svelte +13 -0
- package/dist/NestedProvider.svelte.d.ts +8 -0
- package/dist/OgygiaBoundary.svelte +5 -0
- package/dist/OgygiaBoundary.svelte.d.ts +17 -0
- package/dist/PromiseRegion.svelte +40 -0
- package/dist/PromiseRegion.svelte.d.ts +15 -0
- package/dist/PromiseRegionAwait.svelte +27 -0
- package/dist/PromiseRegionAwait.svelte.d.ts +15 -0
- package/dist/Provide.svelte +27 -0
- package/dist/Provide.svelte.d.ts +8 -0
- package/dist/RawHtml.svelte +9 -0
- package/dist/RawHtml.svelte.d.ts +6 -0
- package/dist/Region.svelte +1173 -0
- package/dist/Region.svelte.d.ts +68 -0
- package/dist/SlotBoundary.svelte +13 -0
- package/dist/SlotBoundary.svelte.d.ts +7 -0
- package/dist/app.d.ts +4 -0
- package/dist/app.js +3 -0
- package/dist/boundary.d.ts +35 -0
- package/dist/boundary.js +127 -0
- package/dist/build-cache.d.ts +13 -0
- package/dist/build-cache.js +77 -0
- package/dist/compiler/blank-styles.d.ts +1 -0
- package/dist/compiler/blank-styles.js +63 -0
- package/dist/compiler/bom.d.ts +2 -0
- package/dist/compiler/bom.js +15 -0
- package/dist/compiler/browser-full.d.ts +8 -0
- package/dist/compiler/browser-full.js +8 -0
- package/dist/compiler/browser.d.ts +11 -0
- package/dist/compiler/browser.js +11 -0
- package/dist/compiler/content/transportables.d.ts +26 -0
- package/dist/compiler/content/transportables.js +219 -0
- package/dist/compiler/ctx.d.ts +180 -0
- package/dist/compiler/ctx.js +183 -0
- package/dist/compiler/debarrel/barrel.d.ts +55 -0
- package/dist/compiler/debarrel/barrel.js +248 -0
- package/dist/compiler/debarrel/options.d.ts +67 -0
- package/dist/compiler/debarrel/options.js +31 -0
- package/dist/compiler/debarrel/parse.d.ts +65 -0
- package/dist/compiler/debarrel/parse.js +256 -0
- package/dist/compiler/debarrel/plugin.d.ts +31 -0
- package/dist/compiler/debarrel/plugin.js +190 -0
- package/dist/compiler/debarrel/rewrite.d.ts +27 -0
- package/dist/compiler/debarrel/rewrite.js +118 -0
- package/dist/compiler/debarrel/svelte.d.ts +13 -0
- package/dist/compiler/debarrel/svelte.js +56 -0
- package/dist/compiler/dev/css-scope.d.ts +16 -0
- package/dist/compiler/dev/css-scope.js +38 -0
- package/dist/compiler/dev/dev-hmr.d.ts +25 -0
- package/dist/compiler/dev/dev-hmr.js +29 -0
- package/dist/compiler/dev/hmr.d.ts +34 -0
- package/dist/compiler/dev/hmr.js +57 -0
- package/dist/compiler/dev/region-bytes.d.ts +34 -0
- package/dist/compiler/dev/region-bytes.js +126 -0
- package/dist/compiler/driver.d.ts +280 -0
- package/dist/compiler/driver.js +1352 -0
- package/dist/compiler/flags.d.ts +16 -0
- package/dist/compiler/flags.js +101 -0
- package/dist/compiler/fouc-css.d.ts +97 -0
- package/dist/compiler/fouc-css.js +335 -0
- package/dist/compiler/free-vars.d.ts +20 -0
- package/dist/compiler/free-vars.js +327 -0
- package/dist/compiler/host.d.ts +65 -0
- package/dist/compiler/host.js +51 -0
- package/dist/compiler/ids.d.ts +84 -0
- package/dist/compiler/ids.js +86 -0
- package/dist/compiler/index.d.ts +11 -0
- package/dist/compiler/index.js +11 -0
- package/dist/compiler/kit.d.ts +129 -0
- package/dist/compiler/kit.js +563 -0
- package/dist/compiler/link/build-output.d.ts +44 -0
- package/dist/compiler/link/build-output.js +147 -0
- package/dist/compiler/link/caps.d.ts +48 -0
- package/dist/compiler/link/caps.js +64 -0
- package/dist/compiler/link/context-detect.d.ts +23 -0
- package/dist/compiler/link/context-detect.js +137 -0
- package/dist/compiler/link/emit-gate.d.ts +11 -0
- package/dist/compiler/link/emit-gate.js +40 -0
- package/dist/compiler/link/entry-shim.d.ts +4 -0
- package/dist/compiler/link/entry-shim.js +29 -0
- package/dist/compiler/link/island-deps.d.ts +142 -0
- package/dist/compiler/link/island-deps.js +525 -0
- package/dist/compiler/link/manifest.d.ts +5 -0
- package/dist/compiler/link/manifest.js +9 -0
- package/dist/compiler/link/page-keys.d.ts +64 -0
- package/dist/compiler/link/page-keys.js +683 -0
- package/dist/compiler/link/registry-stub.d.ts +41 -0
- package/dist/compiler/link/registry-stub.js +212 -0
- package/dist/compiler/link/router-config.d.ts +11 -0
- package/dist/compiler/link/router-config.js +15 -0
- package/dist/compiler/link/router-css.d.ts +22 -0
- package/dist/compiler/link/router-css.js +142 -0
- package/dist/compiler/link/runtime-entry.d.ts +71 -0
- package/dist/compiler/link/runtime-entry.js +132 -0
- package/dist/compiler/link/server-manifest.d.ts +12 -0
- package/dist/compiler/link/server-manifest.js +45 -0
- package/dist/compiler/link/speculation.d.ts +17 -0
- package/dist/compiler/link/speculation.js +36 -0
- package/dist/compiler/link/transport.d.ts +31 -0
- package/dist/compiler/link/transport.js +67 -0
- package/dist/compiler/macros/bake.d.ts +20 -0
- package/dist/compiler/macros/bake.js +317 -0
- package/dist/compiler/macros/browser.d.ts +11 -0
- package/dist/compiler/macros/browser.js +69 -0
- package/dist/compiler/macros/dedent.d.ts +12 -0
- package/dist/compiler/macros/dedent.js +36 -0
- package/dist/compiler/macros/dollar.d.ts +15 -0
- package/dist/compiler/macros/dollar.js +387 -0
- package/dist/compiler/macros/pipeline.d.ts +31 -0
- package/dist/compiler/macros/pipeline.js +106 -0
- package/dist/compiler/macros/source.d.ts +6 -0
- package/dist/compiler/macros/source.js +127 -0
- package/dist/compiler/macros/store.d.ts +17 -0
- package/dist/compiler/macros/store.js +244 -0
- package/dist/compiler/macros/wire.d.ts +14 -0
- package/dist/compiler/macros/wire.js +160 -0
- package/dist/compiler/ownership-stamps.d.ts +6 -0
- package/dist/compiler/ownership-stamps.js +144 -0
- package/dist/compiler/parse/oxc.d.ts +34 -0
- package/dist/compiler/parse/oxc.js +59 -0
- package/dist/compiler/parse/scan.d.ts +43 -0
- package/dist/compiler/parse/scan.js +232 -0
- package/dist/compiler/program.d.ts +140 -0
- package/dist/compiler/program.js +242 -0
- package/dist/compiler/region/emit.d.ts +169 -0
- package/dist/compiler/region/emit.js +286 -0
- package/dist/compiler/region/identity.d.ts +28 -0
- package/dist/compiler/region/identity.js +75 -0
- package/dist/compiler/region/ir.d.ts +65 -0
- package/dist/compiler/region/ir.js +0 -0
- package/dist/compiler/region/transform.d.ts +178 -0
- package/dist/compiler/region/transform.js +1933 -0
- package/dist/compiler/script-request.d.ts +1 -0
- package/dist/compiler/script-request.js +43 -0
- package/dist/context-bridge.d.ts +65 -0
- package/dist/context-bridge.js +217 -0
- package/dist/context-registry.d.ts +40 -0
- package/dist/context-registry.js +15 -0
- package/dist/context.d.ts +72 -0
- package/dist/context.js +158 -0
- package/dist/current-region.d.ts +14 -0
- package/dist/current-region.js +36 -0
- package/dist/document.d.ts +41 -0
- package/dist/document.js +125 -0
- package/dist/entry-hydrate.d.ts +5 -0
- package/dist/entry-hydrate.js +42 -0
- package/dist/escape.d.ts +18 -0
- package/dist/escape.js +37 -0
- package/dist/events/bus.d.ts +33 -0
- package/dist/events/bus.js +153 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.js +4 -0
- package/dist/events/schema.d.ts +389 -0
- package/dist/events/schema.js +23 -0
- package/dist/events/server-registry.d.ts +7 -0
- package/dist/events/server-registry.js +13 -0
- package/dist/events/sinks.d.ts +64 -0
- package/dist/events/sinks.js +85 -0
- package/dist/fn-transport.d.ts +33 -0
- package/dist/fn-transport.js +140 -0
- package/dist/frame.d.ts +20 -0
- package/dist/frame.js +19 -0
- package/dist/holes-record.d.ts +6 -0
- package/dist/holes-record.js +8 -0
- package/dist/hooks.d.ts +43 -0
- package/dist/hooks.js +1191 -0
- package/dist/hydration-info.d.ts +1 -0
- package/dist/hydration-info.js +31 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/insights/attr-rules.d.ts +15 -0
- package/dist/insights/attr-rules.js +27 -0
- package/dist/insights/cpu.d.ts +82 -0
- package/dist/insights/cpu.js +177 -0
- package/dist/insights/fp-drift.d.ts +28 -0
- package/dist/insights/fp-drift.js +148 -0
- package/dist/insights/hole-segments.d.ts +26 -0
- package/dist/insights/hole-segments.js +50 -0
- package/dist/insights/html-diff.d.ts +25 -0
- package/dist/insights/html-diff.js +157 -0
- package/dist/insights/hydration-hazards.d.ts +36 -0
- package/dist/insights/hydration-hazards.js +136 -0
- package/dist/insights/hydration-status.d.ts +2 -0
- package/dist/insights/hydration-status.js +0 -0
- package/dist/insights/index.d.ts +14 -0
- package/dist/insights/index.js +12 -0
- package/dist/insights/page-assets.d.ts +211 -0
- package/dist/insights/page-assets.js +608 -0
- package/dist/insights/page-insights.d.ts +749 -0
- package/dist/insights/page-insights.js +2157 -0
- package/dist/insights/session-data.d.ts +108 -0
- package/dist/insights/session-data.js +0 -0
- package/dist/insights/session-insights.d.ts +121 -0
- package/dist/insights/session-insights.js +548 -0
- package/dist/insights/switch.d.ts +53 -0
- package/dist/insights/switch.js +91 -0
- package/dist/insights/testing-version.d.ts +19 -0
- package/dist/insights/testing-version.js +21 -0
- package/dist/insights/third-party.d.ts +75 -0
- package/dist/insights/third-party.js +160 -0
- package/dist/internal-instruments.d.ts +13 -0
- package/dist/internal-instruments.js +12 -0
- package/dist/internal-reconcile.d.ts +3 -0
- package/dist/internal-reconcile.js +3 -0
- package/dist/internal-register.d.ts +7 -0
- package/dist/internal-register.js +7 -0
- package/dist/internal-server.d.ts +7 -0
- package/dist/internal-server.js +7 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.js +13 -0
- package/dist/island-graph.d.ts +36 -0
- package/dist/island-graph.js +89 -0
- package/dist/keep-fallback-marker.d.ts +7 -0
- package/dist/keep-fallback-marker.js +9 -0
- package/dist/keep-fallback.d.ts +13 -0
- package/dist/keep-fallback.js +39 -0
- package/dist/kit-paths.d.ts +2 -0
- package/dist/kit-paths.js +39 -0
- package/dist/late-region-registry.d.ts +40 -0
- package/dist/late-region-registry.js +36 -0
- package/dist/live-transport.d.ts +57 -0
- package/dist/live-transport.js +145 -0
- package/dist/markup.d.ts +4 -0
- package/dist/markup.js +4 -0
- package/dist/own-package.d.ts +15 -0
- package/dist/own-package.js +20 -0
- package/dist/page-defer.d.ts +33 -0
- package/dist/page-defer.js +35 -0
- package/dist/page-facts-script.d.ts +7 -0
- package/dist/page-facts-script.js +9 -0
- package/dist/page-seed-registry.d.ts +72 -0
- package/dist/page-seed-registry.js +31 -0
- package/dist/plugin/capability.d.ts +14 -0
- package/dist/plugin/capability.js +44 -0
- package/dist/plugin/client.d.ts +39 -0
- package/dist/plugin/client.js +6 -0
- package/dist/plugin/css.d.ts +3 -0
- package/dist/plugin/css.js +54 -0
- package/dist/plugin/facts.d.ts +42 -0
- package/dist/plugin/facts.js +37 -0
- package/dist/plugin/hooks.d.ts +33 -0
- package/dist/plugin/hooks.js +38 -0
- package/dist/plugin/index.d.ts +127 -0
- package/dist/plugin/index.js +26 -0
- package/dist/plugin/routes.d.ts +32 -0
- package/dist/plugin/routes.js +35 -0
- package/dist/plugin/server.d.ts +27 -0
- package/dist/plugin/server.js +92 -0
- package/dist/plugin/standard-schema.d.ts +27 -0
- package/dist/plugin/standard-schema.js +0 -0
- package/dist/plugin/testing.d.ts +13 -0
- package/dist/plugin/testing.js +54 -0
- package/dist/plugin/utils.d.ts +13 -0
- package/dist/plugin/utils.js +19 -0
- package/dist/portable-form.d.ts +22 -0
- package/dist/portable-form.js +52 -0
- package/dist/preference.d.ts +35 -0
- package/dist/preference.js +84 -0
- package/dist/preload.d.ts +1 -0
- package/dist/preload.js +21 -0
- package/dist/ref-watch.d.ts +31 -0
- package/dist/ref-watch.js +66 -0
- package/dist/ref.d.ts +124 -0
- package/dist/ref.js +272 -0
- package/dist/region-brand.d.ts +8 -0
- package/dist/region-brand.js +10 -0
- package/dist/region-core.d.ts +2 -0
- package/dist/region-core.js +1 -0
- package/dist/region-snippet.d.ts +73 -0
- package/dist/region-snippet.js +351 -0
- package/dist/region.d.ts +127 -0
- package/dist/region.js +162 -0
- package/dist/request-event.d.ts +1 -0
- package/dist/request-event.js +37 -0
- package/dist/router-css.d.ts +39 -0
- package/dist/router-css.js +66 -0
- package/dist/runtime/app-transport.d.ts +2 -0
- package/dist/runtime/app-transport.js +13 -0
- package/dist/runtime/beacon.d.ts +271 -0
- package/dist/runtime/beacon.js +2190 -0
- package/dist/runtime/boot-link.d.ts +1 -0
- package/dist/runtime/boot-link.js +44 -0
- package/dist/runtime/client-hooks.d.ts +5 -0
- package/dist/runtime/client-hooks.js +22 -0
- package/dist/runtime/client-plugins.d.ts +8 -0
- package/dist/runtime/client-plugins.js +34 -0
- package/dist/runtime/concurrency.d.ts +12 -0
- package/dist/runtime/concurrency.js +29 -0
- package/dist/runtime/connected.d.ts +12 -0
- package/dist/runtime/connected.js +16 -0
- package/dist/runtime/context.d.ts +1 -0
- package/dist/runtime/context.js +19 -0
- package/dist/runtime/core.d.ts +15 -0
- package/dist/runtime/core.js +1173 -0
- package/dist/runtime/drift-watch.d.ts +9 -0
- package/dist/runtime/drift-watch.js +60 -0
- package/dist/runtime/entry-locations.d.ts +33 -0
- package/dist/runtime/entry-locations.js +119 -0
- package/dist/runtime/foreign-props.d.ts +8 -0
- package/dist/runtime/foreign-props.js +14 -0
- package/dist/runtime/form-continuity.d.ts +10 -0
- package/dist/runtime/form-continuity.js +107 -0
- package/dist/runtime/frame-nav.d.ts +36 -0
- package/dist/runtime/frame-nav.js +225 -0
- package/dist/runtime/frame-store.d.ts +62 -0
- package/dist/runtime/frame-store.js +214 -0
- package/dist/runtime/frames.d.ts +1 -0
- package/dist/runtime/frames.js +25 -0
- package/dist/runtime/full.d.ts +4 -0
- package/dist/runtime/full.js +32 -0
- package/dist/runtime/hash.d.ts +41 -0
- package/dist/runtime/hash.js +79 -0
- package/dist/runtime/hole-facts.d.ts +8 -0
- package/dist/runtime/hole-facts.js +57 -0
- package/dist/runtime/host-classes.d.ts +24 -0
- package/dist/runtime/host-classes.js +43 -0
- package/dist/runtime/hydrate-core.d.ts +101 -0
- package/dist/runtime/hydrate-core.js +605 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/interaction-replay.d.ts +11 -0
- package/dist/runtime/interaction-replay.js +70 -0
- package/dist/runtime/interaction.d.ts +33 -0
- package/dist/runtime/interaction.js +217 -0
- package/dist/runtime/island-graph-preload.d.ts +13 -0
- package/dist/runtime/island-graph-preload.js +99 -0
- package/dist/runtime/kit-boot.d.ts +29 -0
- package/dist/runtime/kit-boot.js +60 -0
- package/dist/runtime/kit-page-thread.svelte.d.ts +1 -0
- package/dist/runtime/kit-page-thread.svelte.js +116 -0
- package/dist/runtime/lake-anchors.d.ts +13 -0
- package/dist/runtime/lake-anchors.js +19 -0
- package/dist/runtime/lakes.d.ts +15 -0
- package/dist/runtime/lakes.js +212 -0
- package/dist/runtime/live.d.ts +3 -0
- package/dist/runtime/live.js +17 -0
- package/dist/runtime/load-scheduler.d.ts +53 -0
- package/dist/runtime/load-scheduler.js +317 -0
- package/dist/runtime/morph.d.ts +42 -0
- package/dist/runtime/morph.js +671 -0
- package/dist/runtime/nav-handle.d.ts +25 -0
- package/dist/runtime/nav-handle.js +71 -0
- package/dist/runtime/nav-hooks.d.ts +2 -0
- package/dist/runtime/nav-hooks.js +23 -0
- package/dist/runtime/nearest-attr.d.ts +4 -0
- package/dist/runtime/nearest-attr.js +16 -0
- package/dist/runtime/observe.d.ts +27 -0
- package/dist/runtime/observe.js +63 -0
- package/dist/runtime/own-cost.d.ts +9 -0
- package/dist/runtime/own-cost.js +35 -0
- package/dist/runtime/ownership.d.ts +101 -0
- package/dist/runtime/ownership.js +115 -0
- package/dist/runtime/page-cache.d.ts +23 -0
- package/dist/runtime/page-cache.js +74 -0
- package/dist/runtime/page-defer.d.ts +14 -0
- package/dist/runtime/page-defer.js +103 -0
- package/dist/runtime/parse-html.d.ts +40 -0
- package/dist/runtime/parse-html.js +81 -0
- package/dist/runtime/reconcile.d.ts +41 -0
- package/dist/runtime/reconcile.js +194 -0
- package/dist/runtime/region-attrs.d.ts +95 -0
- package/dist/runtime/region-attrs.js +153 -0
- package/dist/runtime/region-endpoint-url.d.ts +76 -0
- package/dist/runtime/region-endpoint-url.js +169 -0
- package/dist/runtime/region-ids.d.ts +8 -0
- package/dist/runtime/region-ids.js +33 -0
- package/dist/runtime/remote-seeds.d.ts +2 -0
- package/dist/runtime/remote-seeds.js +21 -0
- package/dist/runtime/render-blocking.d.ts +2 -0
- package/dist/runtime/render-blocking.js +30 -0
- package/dist/runtime/restore.d.ts +34 -0
- package/dist/runtime/restore.js +390 -0
- package/dist/runtime/router-nav.d.ts +63 -0
- package/dist/runtime/router-nav.js +740 -0
- package/dist/runtime/router.d.ts +201 -0
- package/dist/runtime/router.js +593 -0
- package/dist/runtime/schedule.d.ts +49 -0
- package/dist/runtime/schedule.js +256 -0
- package/dist/runtime/seeds.d.ts +50 -0
- package/dist/runtime/seeds.js +208 -0
- package/dist/runtime/session.d.ts +52 -0
- package/dist/runtime/session.js +130 -0
- package/dist/runtime/sidecar.d.ts +3 -0
- package/dist/runtime/sidecar.js +56 -0
- package/dist/runtime/slots.d.ts +183 -0
- package/dist/runtime/slots.js +44 -0
- package/dist/runtime/spa-cacheable.d.ts +7 -0
- package/dist/runtime/spa-cacheable.js +18 -0
- package/dist/runtime/speculate-hint.d.ts +1 -0
- package/dist/runtime/speculate-hint.js +35 -0
- package/dist/runtime/svelte-warnings.d.ts +28 -0
- package/dist/runtime/svelte-warnings.js +71 -0
- package/dist/runtime/wire-classes.d.ts +3 -0
- package/dist/runtime/wire-classes.js +69 -0
- package/dist/runtime/wire-format.d.ts +7 -0
- package/dist/runtime/wire-format.js +22 -0
- package/dist/script.d.ts +134 -0
- package/dist/script.js +184 -0
- package/dist/seed-refs.d.ts +105 -0
- package/dist/seed-refs.js +487 -0
- package/dist/server/capability-lifetime.d.ts +28 -0
- package/dist/server/capability-lifetime.js +31 -0
- package/dist/server/dead-kit-resolves.d.ts +1 -0
- package/dist/server/dead-kit-resolves.js +39 -0
- package/dist/server/document-assembly.d.ts +30 -0
- package/dist/server/document-assembly.js +26 -0
- package/dist/server/document-tail.d.ts +113 -0
- package/dist/server/document-tail.js +208 -0
- package/dist/server/endpoint.d.ts +51 -0
- package/dist/server/endpoint.js +90 -0
- package/dist/server/entry-location.d.ts +8 -0
- package/dist/server/entry-location.js +29 -0
- package/dist/server/fingerprint.d.ts +1 -0
- package/dist/server/fingerprint.js +25 -0
- package/dist/server/head-presence.d.ts +45 -0
- package/dist/server/head-presence.js +156 -0
- package/dist/server/hmac.d.ts +38 -0
- package/dist/server/hmac.js +89 -0
- package/dist/server/hole-graph.d.ts +7 -0
- package/dist/server/hole-graph.js +71 -0
- package/dist/server/hole-urls.d.ts +3 -0
- package/dist/server/hole-urls.js +76 -0
- package/dist/server/html-scan.d.ts +19 -0
- package/dist/server/html-scan.js +60 -0
- package/dist/server/kit-context.d.ts +78 -0
- package/dist/server/kit-context.js +110 -0
- package/dist/server/late-wire.d.ts +22 -0
- package/dist/server/late-wire.js +28 -0
- package/dist/server/page-facts.d.ts +25 -0
- package/dist/server/page-facts.js +138 -0
- package/dist/server/page-seed.d.ts +33 -0
- package/dist/server/page-seed.js +60 -0
- package/dist/server/page-stream.d.ts +55 -0
- package/dist/server/page-stream.js +121 -0
- package/dist/server/payload.d.ts +6 -0
- package/dist/server/payload.js +22 -0
- package/dist/server/personal-response.d.ts +6 -0
- package/dist/server/personal-response.js +13 -0
- package/dist/server/props-wire.d.ts +56 -0
- package/dist/server/props-wire.js +178 -0
- package/dist/server/rate-limit.d.ts +22 -0
- package/dist/server/rate-limit.js +63 -0
- package/dist/server/region-css.d.ts +5 -0
- package/dist/server/region-css.js +30 -0
- package/dist/server/region-endpoint.d.ts +35 -0
- package/dist/server/region-endpoint.js +142 -0
- package/dist/server/region-props.d.ts +6 -0
- package/dist/server/region-props.js +44 -0
- package/dist/server/remote-seed-gate.d.ts +50 -0
- package/dist/server/remote-seed-gate.js +66 -0
- package/dist/server/render-cache.d.ts +26 -0
- package/dist/server/render-cache.js +51 -0
- package/dist/server/render-page.d.ts +51 -0
- package/dist/server/render-page.js +176 -0
- package/dist/server/render-region-html.d.ts +2 -0
- package/dist/server/render-region-html.js +19 -0
- package/dist/server/request-stats.d.ts +174 -0
- package/dist/server/request-stats.js +54 -0
- package/dist/server/reversible.d.ts +83 -0
- package/dist/server/reversible.js +994 -0
- package/dist/server/seed-shape.d.ts +22 -0
- package/dist/server/seed-shape.js +24 -0
- package/dist/server/shared-cache.d.ts +35 -0
- package/dist/server/shared-cache.js +104 -0
- package/dist/server/signing-key.d.ts +11 -0
- package/dist/server/signing-key.js +47 -0
- package/dist/server/sized-lru.d.ts +20 -0
- package/dist/server/sized-lru.js +68 -0
- package/dist/server/split-regions.d.ts +81 -0
- package/dist/server/split-regions.js +368 -0
- package/dist/server/stream-regions.d.ts +5 -0
- package/dist/server/stream-regions.js +36 -0
- package/dist/shared-state.d.ts +7 -0
- package/dist/shared-state.js +152 -0
- package/dist/shims/app-environment.d.ts +4 -0
- package/dist/shims/app-environment.js +6 -0
- package/dist/shims/app-navigation.d.ts +33 -0
- package/dist/shims/app-navigation.js +119 -0
- package/dist/shims/app-paths.d.ts +6 -0
- package/dist/shims/app-paths.js +18 -0
- package/dist/shims/app-state.svelte.d.ts +23 -0
- package/dist/shims/app-state.svelte.js +50 -0
- package/dist/shims/app-stores.d.ts +21 -0
- package/dist/shims/app-stores.js +54 -0
- package/dist/shims/kit-bridge.d.ts +29 -0
- package/dist/shims/kit-bridge.js +7 -0
- package/dist/shims/kit-remote/client-stub.d.ts +27 -0
- package/dist/shims/kit-remote/client-stub.js +43 -0
- package/dist/shims/kit-remote/paths-internal-stub.d.ts +3 -0
- package/dist/shims/kit-remote/paths-internal-stub.js +5 -0
- package/dist/shims/kit-remote/remote-cache.d.ts +49 -0
- package/dist/shims/kit-remote/remote-cache.js +73 -0
- package/dist/shims/kit-remote/state-stub.d.ts +8 -0
- package/dist/shims/kit-remote/state-stub.js +8 -0
- package/dist/shims/page-store.svelte.d.ts +39 -0
- package/dist/shims/page-store.svelte.js +77 -0
- package/dist/source.d.ts +29 -0
- package/dist/source.js +87 -0
- package/dist/store-transport.d.ts +86 -0
- package/dist/store-transport.js +229 -0
- package/dist/tool-fetches.d.ts +5 -0
- package/dist/tool-fetches.js +41 -0
- package/dist/transport.d.ts +48 -0
- package/dist/transport.js +181 -0
- package/dist/unscoped-css.d.ts +26 -0
- package/dist/unscoped-css.js +53 -0
- package/dist/vite/dev-maps.d.ts +33 -0
- package/dist/vite/dev-maps.js +140 -0
- package/dist/vite/index.d.ts +19 -0
- package/dist/vite/index.js +820 -0
- package/dist/vite/kit-dirs.d.ts +7 -0
- package/dist/vite/kit-dirs.js +67 -0
- package/dist/vite/late-island.d.ts +25 -0
- package/dist/vite/late-island.js +33 -0
- package/dist/vite/module-map.d.ts +8 -0
- package/dist/vite/module-map.js +144 -0
- package/dist/vite/options.d.ts +208 -0
- package/dist/vite/options.js +74 -0
- package/dist/vite/package-files.d.ts +3 -0
- package/dist/vite/package-files.js +84 -0
- package/dist/vite/paths.d.ts +45 -0
- package/dist/vite/paths.js +112 -0
- package/dist/vite/plugin-api.d.ts +166 -0
- package/dist/vite/plugin-api.js +212 -0
- package/dist/vite/profiler-maps.d.ts +23 -0
- package/dist/vite/profiler-maps.js +178 -0
- package/dist/vite/server-sourcemaps.d.ts +8 -0
- package/dist/vite/server-sourcemaps.js +80 -0
- package/dist/vite/sourcemaps.d.ts +18 -0
- package/dist/vite/sourcemaps.js +80 -0
- package/dist/vite/style-preprocess.d.ts +2 -0
- package/dist/vite/style-preprocess.js +96 -0
- package/package.json +180 -6
|
@@ -0,0 +1,1173 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* The one wrapper. Every region — placed (`<C/>` with `wake`/`fill`/`none`) or held
|
|
4
|
+
* (`region(C, props)`) — renders through here. It absorbs the four old wrappers:
|
|
5
|
+
*
|
|
6
|
+
* - **island** (`__mode: 'island'`, or a held interactive dual) → `<ogygia-region wake=…>`: SSR the
|
|
7
|
+
* component inline, self-hydrate on the schedule (csr=false). Was `Island.svelte`.
|
|
8
|
+
* - **server** (`__mode: 'server'`) → `<ogygia-region render="defer" when=… endpoint=…>`: mint a
|
|
9
|
+
* signed capability, ship the fallback, let the runtime fetch the HTML (then optionally wake).
|
|
10
|
+
* Was `ServerIsland.svelte`.
|
|
11
|
+
* - **lake** (`__mode: 'lake'`) → `<ogygia-region wake="none">`: frozen furniture inside an island,
|
|
12
|
+
* lift/restore, optional `remount: 'swr'` endpoint. Was `LakeRegion.svelte`.
|
|
13
|
+
* - **held** (`of={RegionValue}`) → inline (same-pass SDUI), deferred (crossed the wire, signed
|
|
14
|
+
* ticket), or live (ticket already carries HTML — swap then morph). An interactive **dual** held
|
|
15
|
+
* value routes into the island branch, so held + placed interactivity share one code path.
|
|
16
|
+
*
|
|
17
|
+
* Server-island minting is routed through the `virtual:ogygia/region-endpoint` virtual (client-
|
|
18
|
+
* stubbed to `''`), so this component lives in the main `ogygia` graph without pulling `$app/server`
|
|
19
|
+
* into the browser. The runtime custom element (`core.ts`) is unchanged; only the `.svelte` wrappers
|
|
20
|
+
* collapsed into this file.
|
|
21
|
+
*/
|
|
22
|
+
import {
|
|
23
|
+
untrack,
|
|
24
|
+
getContext,
|
|
25
|
+
getAllContexts,
|
|
26
|
+
setContext,
|
|
27
|
+
createRawSnippet,
|
|
28
|
+
mount,
|
|
29
|
+
unmount
|
|
30
|
+
} from 'svelte';
|
|
31
|
+
import {
|
|
32
|
+
KIT_REQUEST_CONTEXT,
|
|
33
|
+
kit_page_version,
|
|
34
|
+
kit_request_event
|
|
35
|
+
} from './server/kit-context.js';
|
|
36
|
+
import { stringify } from 'devalue';
|
|
37
|
+
import hmrUrl from 'virtual:ogygia/dev-hmr-url';
|
|
38
|
+
import {
|
|
39
|
+
islandDeps,
|
|
40
|
+
islandCss,
|
|
41
|
+
contentCss,
|
|
42
|
+
islandReadsPage,
|
|
43
|
+
islandPageKeys,
|
|
44
|
+
islandRemotes,
|
|
45
|
+
islandInteractivity,
|
|
46
|
+
entryLocation
|
|
47
|
+
} from 'virtual:ogygia/island-deps';
|
|
48
|
+
import { runtime_bootstrap } from './server/entry-location.js';
|
|
49
|
+
import {
|
|
50
|
+
makeRegionEndpoint,
|
|
51
|
+
mintServerIsland,
|
|
52
|
+
known_region_fps,
|
|
53
|
+
islandFingerprint,
|
|
54
|
+
holeCss
|
|
55
|
+
} from 'virtual:ogygia/region-endpoint';
|
|
56
|
+
import { fingerprint_of, hole_copy_of } from './runtime/hash.js';
|
|
57
|
+
// Kit's `asset()`, taking ogygia's base-less `/…` URLs on Kit 2 and Kit 3 alike (kit-paths.ts)
|
|
58
|
+
import { kit_asset as asset } from './kit-paths.js';
|
|
59
|
+
import { building } from '$app/env';
|
|
60
|
+
import { page } from '$app/state';
|
|
61
|
+
import { record_page } from './page-seed-registry.js';
|
|
62
|
+
import { document_tail, island_graph_script, modulepreload_tag } from './server/document-tail.js';
|
|
63
|
+
import { plan_props_wire, props_sidecar } from './server/props-wire.js';
|
|
64
|
+
import { region_css_tag } from './server/region-css.js';
|
|
65
|
+
import { escape_amp, escape_amp_quot, escape_attr } from './escape.js';
|
|
66
|
+
import {
|
|
67
|
+
isNested,
|
|
68
|
+
setNested,
|
|
69
|
+
isInLake,
|
|
70
|
+
isInLiveSnippet,
|
|
71
|
+
setInLiveSnippet,
|
|
72
|
+
setHoleInline,
|
|
73
|
+
documentIsCsrTrue,
|
|
74
|
+
claimRuntimeEmit,
|
|
75
|
+
claim_region_css,
|
|
76
|
+
claim_kit_island
|
|
77
|
+
} from './context.js';
|
|
78
|
+
import {
|
|
79
|
+
prepare_region_props,
|
|
80
|
+
slot_pointer,
|
|
81
|
+
slot_marker_open,
|
|
82
|
+
SLOT_MARKER_CLOSE,
|
|
83
|
+
next_slot_id
|
|
84
|
+
} from './region-snippet.js';
|
|
85
|
+
import { isRegion } from './region.js';
|
|
86
|
+
// (LateIslandAwait.svelte in its place where the app runs Svelte's async mode: vite/late-island.ts)
|
|
87
|
+
import LateIsland from './LateIsland.svelte';
|
|
88
|
+
// (PromiseRegionAwait.svelte in its place where the app runs Svelte's async mode: vite/late-island.ts)
|
|
89
|
+
import PromiseRegion from './PromiseRegion.svelte';
|
|
90
|
+
import LakeBoundary from './LakeBoundary.svelte';
|
|
91
|
+
import SlotBoundary from './SlotBoundary.svelte';
|
|
92
|
+
import { record_server_event } from './events/server-registry.js';
|
|
93
|
+
|
|
94
|
+
// DEVTOOLS gate — module-local const from the Vite `define` (proven DCE pattern); off → folds out.
|
|
95
|
+
const DEVTOOLS = typeof __OGYGIA_DEVTOOLS__ !== 'undefined' ? __OGYGIA_DEVTOOLS__ : false;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Every prop is optional: a HELD usage passes only `of`, a PLACEMENT usage (the transform's
|
|
99
|
+
* wrappers) passes only the `__*` internals — so `<Region of={value} />` type-checks for consumers
|
|
100
|
+
* without the internal props.
|
|
101
|
+
* @type {{
|
|
102
|
+
* of?: import('./region.js').RegionValue | Promise<import('./region.js').RegionValue>;
|
|
103
|
+
* placeholder?: import('svelte').Snippet;
|
|
104
|
+
* children?: import('svelte').Snippet;
|
|
105
|
+
* __mode?: 'island' | 'server' | 'lake'; __baked?: boolean;
|
|
106
|
+
* visible?: string | boolean; idle?: boolean; media?: string; load?: boolean; interaction?: boolean;
|
|
107
|
+
* __keep?: string; __entry?: string; __src?: string; __component?: import('svelte').Component; __css?: unknown;
|
|
108
|
+
* __load?: () => Promise<import('svelte').Component>;
|
|
109
|
+
* __props?: Record<string, unknown>; __defer?: string; __margin?: string; __hydrate?: string;
|
|
110
|
+
* __hydrateMargin?: string; __module?: string; __cacheTtl?: number; __stitch?: string; __prefetch?: string;
|
|
111
|
+
* ogygiaFallback?: import('svelte').Snippet;
|
|
112
|
+
* __remount?: string; __when?: string; __maxAge?: number; __onExpire?: 'empty' | 'fetch';
|
|
113
|
+
* }}
|
|
114
|
+
*/
|
|
115
|
+
let {
|
|
116
|
+
// Held API: a `RegionValue` from `region()` (inline / dual / deferred), or a Promise of one
|
|
117
|
+
// (a remote call: `of={search(q)}`) — the region owns the whole wait, `placeholder` fills it.
|
|
118
|
+
of,
|
|
119
|
+
// Not-ready UI: rendered while a Promise `of` is in flight AND while a client-painted region's
|
|
120
|
+
// styled HTML is still arriving. Distinct from `children` (the rendered component's slot).
|
|
121
|
+
placeholder,
|
|
122
|
+
children,
|
|
123
|
+
// A wire value whose first HTML is already in the page (PromiseRegionAwait: awaited in the server
|
|
124
|
+
// render, hydrated against the same value) — rendered once, every later value morphs in.
|
|
125
|
+
__baked = false,
|
|
126
|
+
// Placement API (the transform's wrappers): `__mode` selects island / server / lake.
|
|
127
|
+
__mode,
|
|
128
|
+
// island
|
|
129
|
+
visible,
|
|
130
|
+
idle,
|
|
131
|
+
media,
|
|
132
|
+
load,
|
|
133
|
+
interaction,
|
|
134
|
+
__keep,
|
|
135
|
+
// island + server shared. `__entry` is the island's IDENTITY (its stable URL); `__src` its
|
|
136
|
+
// LOCATION — the content-hashed file to load — which only the client build knows (its wrapper
|
|
137
|
+
// passes the bundler's own name for it). The server finds the location in the build handoff.
|
|
138
|
+
__entry = '',
|
|
139
|
+
__src = '',
|
|
140
|
+
__component,
|
|
141
|
+
__css,
|
|
142
|
+
// The client wrapper's on-demand component fetch (its lazy module answered `undefined`: a
|
|
143
|
+
// Kit document that did not render this island). See `late_load`.
|
|
144
|
+
__load,
|
|
145
|
+
__props,
|
|
146
|
+
// server
|
|
147
|
+
__defer = 'load',
|
|
148
|
+
__margin,
|
|
149
|
+
__hydrate,
|
|
150
|
+
__hydrateMargin,
|
|
151
|
+
__module = '',
|
|
152
|
+
// Response cache max-age in seconds for this deferred hole (absent/0 → no-store). Signed at mint.
|
|
153
|
+
__cacheTtl,
|
|
154
|
+
// Stitching mark: `'serve'` (the freeze serve path fills the hole at origin, per visitor,
|
|
155
|
+
// fail-open) or `'edge'` (the freeze capture rewrites it into an ESI include the CDN
|
|
156
|
+
// fills — the shell stays edge-cached). Emitted as the hole's `stitch` attribute.
|
|
157
|
+
__stitch = '',
|
|
158
|
+
// Warm schedule for a deferred hole (`prefetch` attribute): the runtime fills the frame store
|
|
159
|
+
// on it, ahead of `__defer` (the swap). Absent → the hole fetches on `__defer` only.
|
|
160
|
+
__prefetch = '',
|
|
161
|
+
ogygiaFallback,
|
|
162
|
+
// lake
|
|
163
|
+
__remount = 'cache',
|
|
164
|
+
__when = 'load',
|
|
165
|
+
__maxAge,
|
|
166
|
+
__onExpire
|
|
167
|
+
} = $props();
|
|
168
|
+
|
|
169
|
+
// Keep entry `.svelte` imports alive for FOUC without rendering them (the virtual owns the tree).
|
|
170
|
+
// svelte-ignore state_referenced_locally
|
|
171
|
+
void __css;
|
|
172
|
+
|
|
173
|
+
const LT = String.fromCharCode(60); // <
|
|
174
|
+
const GT = String.fromCharCode(62); // >
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* ADOPTION — the one shape of every OPAQUE region (region-attrs.ts `OPAQUE_SELECTOR`: a lake, a hole,
|
|
178
|
+
* a baked live region) a client hydrates over. Its inside is never a Svelte tree the browser could
|
|
179
|
+
* render — server HTML, a fallback a fetched answer replaces, a server-only component — so it renders
|
|
180
|
+
* through ONE snippet: the SERVER form emits exactly the region element with its inside, the CLIENT
|
|
181
|
+
* form is a raw snippet, and hydration ADOPTS the element verbatim at its position — no walk into it,
|
|
182
|
+
* no attribute set, nothing to mismatch (the adoption slot children get). As a template the browser
|
|
183
|
+
* leg rendered placeholders, `{@html}` walks, or empty `endpoint`s over the server's DOM: Svelte
|
|
184
|
+
* discarded it, threw, or blanked an address. CREATED FRESH in the browser instead (Kit remounting
|
|
185
|
+
* after a failed hydration, a Kit client navigation, an `{#if}` re-creating it in an island or a
|
|
186
|
+
* snippet) the element comes up empty, and each kind refills it from its own source of content: a
|
|
187
|
+
* hole renders its fallback (the page's snippet: what the server showed until the answer lands, and
|
|
188
|
+
* what an `interaction` hole is woken through), a lake repaints from the runtime's copy (lakes.ts), a
|
|
189
|
+
* baked region morphs in its live value. `setup` sees the element either way.
|
|
190
|
+
* @param {() => string} attrs the element's attribute text (both legs)
|
|
191
|
+
* @param {(renderer: never) => void} [inner] SERVER: renders its inside into the element
|
|
192
|
+
* @param {(el: Element) => void | (() => void)} [setup] CLIENT: the adopted (or created) element
|
|
193
|
+
*/
|
|
194
|
+
function adopt_region(attrs, inner, setup) {
|
|
195
|
+
return typeof window === 'undefined'
|
|
196
|
+
? /** @param {{ push(html: string): void }} renderer */
|
|
197
|
+
(renderer) => {
|
|
198
|
+
renderer.push(LT + 'ogygia-region' + attrs() + GT);
|
|
199
|
+
inner?.(/** @type {never} */ (renderer));
|
|
200
|
+
renderer.push(LT + '/ogygia-region' + GT);
|
|
201
|
+
}
|
|
202
|
+
: createRawSnippet(() => ({
|
|
203
|
+
render: () => LT + 'ogygia-region' + attrs() + GT + LT + '/ogygia-region' + GT,
|
|
204
|
+
setup
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
/** Context mark: "this subtree renders inside Kit's own page pass" (see `kit_page_pass`). */
|
|
208
|
+
const KIT_PAGE_PASS = Symbol.for('ogygia.kit-page-pass');
|
|
209
|
+
|
|
210
|
+
// ─────────────────────────────────────────────── held: resolve (Promise `of`) ──
|
|
211
|
+
// `of` may be a Promise<RegionValue> (a remote call). Note an awaitable dual IS thenable too —
|
|
212
|
+
// the brand tells a real region value apart from a bare promise. Whether a usage passes a value
|
|
213
|
+
// or a promise is fixed per instance, so reading `of` once here is intentional.
|
|
214
|
+
// svelte-ignore state_referenced_locally
|
|
215
|
+
const of_is_promise =
|
|
216
|
+
!!of && typeof (/** @type {{ then?: unknown }} */ (of).then) === 'function' && !isRegion(of);
|
|
217
|
+
// A promise with no placeholder guarantees a blank window on first load (nothing to show while
|
|
218
|
+
// the promise and its stylesheet resolve). The model is "loading UI lives on the region" — say so.
|
|
219
|
+
// svelte-ignore state_referenced_locally
|
|
220
|
+
if (of_is_promise && !placeholder && !children && import.meta.env && import.meta.env.DEV) {
|
|
221
|
+
console.warn(
|
|
222
|
+
'[ogygia] <Region of={promise}> has no `placeholder` — the region will sit empty until the ' +
|
|
223
|
+
'promise resolves and its stylesheet loads. Add {#snippet placeholder()}…{/snippet} for the wait.'
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
// A promise is PromiseRegion's (the template hands it over): how it waits — in the render where the
|
|
227
|
+
// app runs async mode, a late slot on a streamed document, after hydration otherwise — is decided
|
|
228
|
+
// there, and what it resolves to comes back here as a value. Region renders values.
|
|
229
|
+
// What every held branch below renders: a value resolves synchronously (SSR renders it in this
|
|
230
|
+
// same pass — blocks/SDUI never see a placeholder).
|
|
231
|
+
const resolved = $derived(
|
|
232
|
+
of_is_promise ? undefined : /** @type {import('./region.js').RegionValue | undefined} */ (of)
|
|
233
|
+
);
|
|
234
|
+
// A LIVE region (a wire value with HTML, a deferred hole) is the runtime's to paint, on a Kit-hydrated
|
|
235
|
+
// page too; so is the one a promise will resolve to.
|
|
236
|
+
// svelte-ignore state_referenced_locally
|
|
237
|
+
const holds_live =
|
|
238
|
+
of_is_promise || /** @type {{ kind?: string } | undefined} */ (of)?.kind === 'deferred';
|
|
239
|
+
|
|
240
|
+
// A held interactive dual renders exactly like a placed island — same SSR-inline + self-hydrate —
|
|
241
|
+
// so both feed the island branch. A held static dual (no schedule) renders bare, like inline.
|
|
242
|
+
// These read fixed-per-instance props (`of`/`__mode` never change for a given wrapper), so reading
|
|
243
|
+
// them once is intentional — not a missed reactive capture. A Promise `of` is never a dual here:
|
|
244
|
+
// a promise resolves to a wire value (deferred) — only a same-pass VALUE can be a dual.
|
|
245
|
+
// svelte-ignore state_referenced_locally
|
|
246
|
+
const of_init = of_is_promise
|
|
247
|
+
? undefined
|
|
248
|
+
: /** @type {import('./region.js').RegionValue | undefined} */ (of);
|
|
249
|
+
const held_dual_island = !!(of_init && of_init.kind === 'dual' && of_init.hydrate);
|
|
250
|
+
// svelte-ignore state_referenced_locally
|
|
251
|
+
const is_island = __mode === 'island' || held_dual_island;
|
|
252
|
+
// svelte-ignore state_referenced_locally
|
|
253
|
+
const is_server = __mode === 'server';
|
|
254
|
+
// svelte-ignore state_referenced_locally
|
|
255
|
+
const is_lake = __mode === 'lake';
|
|
256
|
+
|
|
257
|
+
// Nested rule (islands/server): a region inside an already-awake region hydrates with its parent,
|
|
258
|
+
// so it degrades to a plain inline render. Read once at init (a wrapper's mode is fixed per usage).
|
|
259
|
+
// Except a HOLE in a live snippet's body: it keeps `render: 'deferred'` — a full hole, fetched on its
|
|
260
|
+
// schedule, never bundled into the island — and the snippet's hydrate adopts its element as it stands.
|
|
261
|
+
const in_live_snippet = isInLiveSnippet();
|
|
262
|
+
const nested = isNested() && !(is_server && in_live_snippet);
|
|
263
|
+
// (an island rendered inline in the snippet: the holes of its own template follow the nested rule)
|
|
264
|
+
if (is_island && nested && in_live_snippet) setInLiveSnippet(false);
|
|
265
|
+
// the contexts a hole created fresh in the browser renders its fallback with (`hole_adopt`): the
|
|
266
|
+
// page's, as when the fallback rendered in its tree
|
|
267
|
+
const region_contexts = typeof window !== 'undefined' && is_server ? getAllContexts() : undefined;
|
|
268
|
+
|
|
269
|
+
// `requestEvent()` inside a region rendered by Kit's OWN page pass: Kit's `__request__` context
|
|
270
|
+
// carries `{ page }` only (ogygia's render roots add `event` themselves). Re-set the same key
|
|
271
|
+
// for this region's subtree with the live event, so a component inside any island / lake /
|
|
272
|
+
// server island reads the request the same way wherever it renders. Server only, once per
|
|
273
|
+
// region, and only when no ancestor already did.
|
|
274
|
+
//
|
|
275
|
+
// The same fact — `{ page }` with no `event` — is what tells a KIT PAGE PASS apart from every
|
|
276
|
+
// other render root (a hole endpoint, a baked held region, a router document, a late region):
|
|
277
|
+
// only in Kit's own pass does the whole document flow through the handle's `transformPageChunk`,
|
|
278
|
+
// so only there can an island's props sidecar be deferred to the end of the body. The outermost
|
|
279
|
+
// region stamps the fact into context for its subtree (its own re-set of the request context
|
|
280
|
+
// hides the bare `{ page }` from nested regions).
|
|
281
|
+
let kit_page_pass = false;
|
|
282
|
+
// …and the positive twin: a render root OGYGIA started (`kit_render_context` hands every one the live
|
|
283
|
+
// event beside the page) — never Kit's own pass, whose `{ page }` carries none.
|
|
284
|
+
let ogygia_root = false;
|
|
285
|
+
if (typeof window === 'undefined') {
|
|
286
|
+
const req = /** @type {{ page?: unknown; event?: unknown } | undefined} */ (
|
|
287
|
+
getContext(KIT_REQUEST_CONTEXT)
|
|
288
|
+
);
|
|
289
|
+
kit_page_pass = getContext(KIT_PAGE_PASS) === true || !!(req && req.event == null);
|
|
290
|
+
ogygia_root = !kit_page_pass && !!(req && req.event != null);
|
|
291
|
+
if (kit_page_pass && getContext(KIT_PAGE_PASS) !== true) setContext(KIT_PAGE_PASS, true);
|
|
292
|
+
if (req && req.event == null) {
|
|
293
|
+
const event = kit_request_event();
|
|
294
|
+
if (event) setContext(KIT_REQUEST_CONTEXT, { ...req, event });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// THE DOCUMENT TAIL (server/document-tail.ts) for this render — non-null only inside Kit's page
|
|
298
|
+
// pass with a request tail installed. What the hints, the props sidecar and the seed-relative
|
|
299
|
+
// props codec all key on (see each site below).
|
|
300
|
+
const tail = typeof window === 'undefined' && kit_page_pass ? document_tail() : null;
|
|
301
|
+
// csr=true rule (ISLANDS only): on a Kit-hydrated page an interactive region should render its
|
|
302
|
+
// component INLINE in the Kit tree — no `<ogygia-region>`, no runtime — because Kit already
|
|
303
|
+
// hydrates it. Same degradation as `nested`, gated by the csr context the transform injects into
|
|
304
|
+
// csr=true route hosts. Server/deferred + lake regions are SERVER-DRIVEN UI, orthogonal to a
|
|
305
|
+
// page's csr, so they are deliberately NOT degraded here (they keep their endpoint + runtime).
|
|
306
|
+
// Does Kit hydrate this WHOLE document? (the leaf page's effective csr — the one fact that decides
|
|
307
|
+
// it.) If so, every island degrades to a plain inline component on both legs: no `<ogygia-region>`,
|
|
308
|
+
// no runtime claim, no FOUC. Server reads the build-time csr=true route map; client reads Kit's
|
|
309
|
+
// bootstrap. Identical both legs, so the inline/island choice can never desync at hydrate.
|
|
310
|
+
// INSIDE A LAKE the answer is always false: under Kit hydration a lake is adopted as opaque DOM
|
|
311
|
+
// (the lake branch below), so Kit never reaches the regions authored inside it — they stay real
|
|
312
|
+
// `<ogygia-region>`s on every page and the runtime wakes them. Server-side in practice (a lake's
|
|
313
|
+
// inside is never rendered on the client); the runtime mirrors it with `inside_frozen`.
|
|
314
|
+
// AN ERROR RENDER (`page.error` set — Kit sets it only when rendering `+error.svelte`; a form
|
|
315
|
+
// action's `fail(400)` renders the page itself, status ≥ 400 and error null) is Kit's LAYOUT-branch
|
|
316
|
+
// decision: the page node — and its `csr = false` — is dropped, so a 404 under a client-off page is
|
|
317
|
+
// hydrated whenever the layouts say so. The server map has a twin for exactly that.
|
|
318
|
+
function page_error_render() {
|
|
319
|
+
try {
|
|
320
|
+
return page.error != null;
|
|
321
|
+
} catch {
|
|
322
|
+
return false; // isolated render without a live page (a hole endpoint, a remote's region)
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
// ONLY KIT'S OWN PASS IS KIT'S TO HYDRATE: a render root ogygia starts (a held region baked by a
|
|
326
|
+
// remote or awaited in the render, a hole, a snippet body) becomes opaque HTML Kit never walks — its
|
|
327
|
+
// islands must be real `<ogygia-region>`s the runtime wakes, whatever the document's csr.
|
|
328
|
+
const is_csr = documentIsCsrTrue(page_error_render()) && !isInLake() && !ogygia_root;
|
|
329
|
+
// The island branch renders inline when nested OR on a csr=true page.
|
|
330
|
+
const island_inline = nested || is_csr;
|
|
331
|
+
if ((is_island || is_server) && !nested) setNested();
|
|
332
|
+
// A server island nested in an island renders its component INLINE (deferred ignored): mark the
|
|
333
|
+
// subtree so a `keepFallback()` inside it fails with the reason instead of Kit's 500 page.
|
|
334
|
+
if (is_server && nested) setHoleInline();
|
|
335
|
+
|
|
336
|
+
// ─────────────────────────────────────────────────────────── island branch ──
|
|
337
|
+
// Normalized island inputs, from placement props OR a held dual. `as_dual` is the type-narrowed
|
|
338
|
+
// reactive read of the dual value (a Promise `of` never lands here — see `held_dual_island`).
|
|
339
|
+
const as_dual = $derived(
|
|
340
|
+
/** @type {import('./region.js').DualRegion | undefined} */ (
|
|
341
|
+
held_dual_island && resolved?.kind === 'dual' ? resolved : undefined
|
|
342
|
+
)
|
|
343
|
+
);
|
|
344
|
+
const island_entry = $derived(as_dual ? as_dual.module : __mode === 'island' ? __entry : '');
|
|
345
|
+
const island_component = $derived(as_dual ? as_dual.component : __component);
|
|
346
|
+
// An inline island whose wrapper Kit CREATED on the client (a client-side navigation mounted it:
|
|
347
|
+
// no SSR, so no rendered stamp, so its lazy module answered `undefined`) has no component yet:
|
|
348
|
+
// LateIsland loads it through `__load`. Never on the server (the SSR wrapper imports the entry)
|
|
349
|
+
// and never at hydration (a stamped island arrives with its component in hand).
|
|
350
|
+
const late_load = $derived(
|
|
351
|
+
typeof window !== 'undefined' && island_inline && !__component ? __load : undefined
|
|
352
|
+
);
|
|
353
|
+
const island_props = $derived(as_dual ? as_dual.props : __props);
|
|
354
|
+
const island_children = $derived(children);
|
|
355
|
+
|
|
356
|
+
// Capture the page snapshot for the island seed. On SSR this reads Kit's REAL `$app/state` page —
|
|
357
|
+
// the only place the resolved load `data` is reachable (Kit merges it locally in render.js, never
|
|
358
|
+
// on RequestState, and reading page in a hook throws). The handle records it into the
|
|
359
|
+
// `application/ogygia-page` seed, so a hydrated island's `$page.data` / `.form` / `.error` /
|
|
360
|
+
// `.status` are populated (boundary law: page.data crosses). No-op on the client (recorder unset;
|
|
361
|
+
// the client `page` is already the shim seed), and a harmless no-op in an isolated server-island
|
|
362
|
+
// endpoint render (no recorder installed there either). `untrack` — one snapshot read, no dep.
|
|
363
|
+
//
|
|
364
|
+
// THE SEED SHIPS ONLY FOR A REGION WHOSE CLIENT CODE READS IT: `islandReadsPage(entry)` is the
|
|
365
|
+
// build's answer (the `$app/state` / `$app/stores` shim in the entry's chunk closure; fail-open for
|
|
366
|
+
// an entry the handoff does not know, and in dev). The snapshot is recorded either way — the
|
|
367
|
+
// handle also reads it for the freeze verdict and for server-side page reads — with `seed:false`
|
|
368
|
+
// when this region has no reader. A page whose islands take everything as props asks for no
|
|
369
|
+
// seed, and the handle then ships none: the whole `page.data` (hundreds of KB on a CMS page)
|
|
370
|
+
// neither serialized nor downloaded twice. A nested region hydrates with its parent, whose
|
|
371
|
+
// closure already includes it; a promise `of` resolves later with a module SSR cannot see, so it
|
|
372
|
+
// asks (fail-open).
|
|
373
|
+
//
|
|
374
|
+
// THE REMOTE SEED SHIPS ONLY FOR REMOTES SOME REGION'S CLIENT CAN CALL: `islandRemotes(entry)` is
|
|
375
|
+
// the build's list for this entry (the remote modules in its chunk closure). A region with no
|
|
376
|
+
// client entry (a lake, a static hole, an inline held value) records `[]`; the fail-open cases
|
|
377
|
+
// above record `null` ("may call anything"). The handle unions the records and seeds an
|
|
378
|
+
// SSR-resolved remote only when it is in that union — a lake or a page script awaiting a query
|
|
379
|
+
// no island imports (a whole CMS footer entry, measured 12.5 KB) no longer ships it as seed.
|
|
380
|
+
if (typeof window === 'undefined') {
|
|
381
|
+
untrack(() => {
|
|
382
|
+
const entry = nested
|
|
383
|
+
? ''
|
|
384
|
+
: is_island
|
|
385
|
+
? island_entry
|
|
386
|
+
: is_server
|
|
387
|
+
? __hydrate
|
|
388
|
+
? __module
|
|
389
|
+
: ''
|
|
390
|
+
: of_is_promise
|
|
391
|
+
? '?'
|
|
392
|
+
: of_init && of_init.kind === 'deferred'
|
|
393
|
+
? of_init.module
|
|
394
|
+
: '';
|
|
395
|
+
// SEED SHAPING: not a flag but an ask — which `page.data` keys this region's client reads
|
|
396
|
+
// (`islandPageKeys`, the build's AST answer over the chunk closure), `'all'` when the build
|
|
397
|
+
// could not pin them or does not know the entry, `false` when nothing in it reads the page.
|
|
398
|
+
const seed = !entry
|
|
399
|
+
? false
|
|
400
|
+
: entry === '?' || !islandReadsPage(entry)
|
|
401
|
+
? entry === '?'
|
|
402
|
+
? 'all'
|
|
403
|
+
: false
|
|
404
|
+
: (islandPageKeys(entry) ?? 'all');
|
|
405
|
+
const remotes = !entry ? [] : entry === '?' ? null : islandRemotes(entry);
|
|
406
|
+
try {
|
|
407
|
+
record_page(
|
|
408
|
+
{ data: page.data, form: page.form, error: page.error, status: page.status },
|
|
409
|
+
seed,
|
|
410
|
+
remotes,
|
|
411
|
+
entry === '?' ? '' : entry
|
|
412
|
+
);
|
|
413
|
+
} catch {
|
|
414
|
+
/* isolated render without a live page — the recorder is unset there anyway */
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// DEV diagnostic (declared HERE, after `island_entry`, so it never reads it in its temporal dead
|
|
420
|
+
// zone): a nested island can't wake independently — warn that its strategy is ignored. Dead-code
|
|
421
|
+
// eliminated in builds via the `import.meta.env.DEV` guard.
|
|
422
|
+
if (nested && (is_island || is_server) && import.meta.env && import.meta.env.DEV) {
|
|
423
|
+
const entry = untrack(() => (is_server ? __entry : island_entry));
|
|
424
|
+
console.warn(
|
|
425
|
+
is_server
|
|
426
|
+
? `[ogygia] nested server island "${entry}" is inside another island; it renders inline as frozen HTML (no JS ships; islands inside it wake on their own) — 'deferred' ignored.`
|
|
427
|
+
: `[ogygia] nested island "${entry}" is inside another island; it hydrates with its parent (strategy ignored).`
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
// Freeze bare snippet PROPS (named-snippet props) to static region snippets (server) so the island
|
|
431
|
+
// BODY and the serialized PAYLOAD render byte-for-byte identically — hydration then adopts the frozen
|
|
432
|
+
// HTML with no mismatch. A live (branded) snippet passes through; an INLINE island (nested, or on a
|
|
433
|
+
// csr=true page, where Kit's client renders the snippet as written) has no crossing, so untouched.
|
|
434
|
+
// CHILDREN are not frozen — they cross via the slot marker below.
|
|
435
|
+
const island_props_ready = $derived(
|
|
436
|
+
island_inline ? island_props : prepare_region_props(island_props)
|
|
437
|
+
);
|
|
438
|
+
|
|
439
|
+
// ── slot crossing: an island's children render IN-PLACE, the client ADOPTS them ──
|
|
440
|
+
// The marker id fencing THIS island's children to its payload pointer. Server-assigned; the client
|
|
441
|
+
// reads it back from the serialized descriptor, never regenerates it.
|
|
442
|
+
// (counted per island entry: another island's async timing never shifts this one's id)
|
|
443
|
+
const slot_id = next_slot_id(untrack(() => island_entry) ?? '');
|
|
444
|
+
const has_slot_children = $derived(!nested && island_children != null);
|
|
445
|
+
// The BODY-side children: a server-convention snippet (`(renderer) => …`) that emits EXACTLY ONE
|
|
446
|
+
// element — `<ogygia-slot>` wrapping the natural children — with no extra snippet-layer anchors.
|
|
447
|
+
// That single-element contract is what lets the client's revived slot snippet ADOPT the SSR DOM
|
|
448
|
+
// (svelte's raw-snippet hydration takes the element at the render position verbatim). SlotBoundary
|
|
449
|
+
// resets the nested context so an island INSIDE the children renders as a full region (own
|
|
450
|
+
// `<ogygia-region>` + payload) and wakes independently after adoption. Server-only by construction:
|
|
451
|
+
// on a csr=false page the client never renders Region, it revives the payload's slot pointer.
|
|
452
|
+
// The SAME reset wraps a server island's `ogygiaFallback` (markup below): the fallback is the
|
|
453
|
+
// PAGE's markup rendered inside the hole's shell, not the island's tree — an island in it (a login
|
|
454
|
+
// dropdown inside an actions hole) must be a full region, or a `keepFallback()`-kept fallback
|
|
455
|
+
// would stand forever with a dead, flattened component inside it (e2e/lake-kit.spec.ts).
|
|
456
|
+
const slot_children = (renderer) => {
|
|
457
|
+
renderer.push(slot_marker_open(slot_id));
|
|
458
|
+
SlotBoundary(renderer, { children: island_children });
|
|
459
|
+
renderer.push(SLOT_MARKER_CLOSE);
|
|
460
|
+
};
|
|
461
|
+
// Body props: children ride as a PROP (the island renders them via its own `{@render children()}`),
|
|
462
|
+
// never as Region's template slot — a template slot would pass an implicit children snippet that both
|
|
463
|
+
// OVERRIDES the prop and adds an extra `<!---->` anchor per layer, desyncing hydration.
|
|
464
|
+
const island_props_body = $derived(
|
|
465
|
+
has_slot_children && typeof window === 'undefined'
|
|
466
|
+
? { ...island_props_ready, children: slot_children }
|
|
467
|
+
: island_props_ready
|
|
468
|
+
);
|
|
469
|
+
// Wire props: the same children as a serializable slot POINTER the client revives into an adopting
|
|
470
|
+
// snippet. Everything else is shared with the body, so both legs agree byte-for-byte.
|
|
471
|
+
const island_props_wire = $derived(
|
|
472
|
+
has_slot_children
|
|
473
|
+
? { ...island_props_ready, children: slot_pointer(slot_id) }
|
|
474
|
+
: island_props_ready
|
|
475
|
+
);
|
|
476
|
+
// The `wake` value IS the strategy: 'load' | 'idle' | 'visible' | 'interaction' | a media query.
|
|
477
|
+
const hydrate_attr = $derived(
|
|
478
|
+
as_dual
|
|
479
|
+
? as_dual.hydrate
|
|
480
|
+
: media
|
|
481
|
+
? media
|
|
482
|
+
: idle
|
|
483
|
+
? 'idle'
|
|
484
|
+
: visible
|
|
485
|
+
? 'visible'
|
|
486
|
+
: interaction
|
|
487
|
+
? 'interaction'
|
|
488
|
+
: 'load'
|
|
489
|
+
);
|
|
490
|
+
const root_margin = $derived(
|
|
491
|
+
as_dual ? as_dual.hydrateMargin || undefined : typeof visible === 'string' ? visible : undefined
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
// `asset()` is the sole base/assets authority — every ogygia URL is baked base-LESS (prod
|
|
495
|
+
// `/${appDir}/immutable/…`, dev `/@id/…`) and resolved here once. (Kit dev serves `/@id/…` under
|
|
496
|
+
// base, and `asset()` supplies that prefix — so we never special-case dev URLs.)
|
|
497
|
+
const island_module_url = $derived(nested || !island_entry ? '' : asset(island_entry));
|
|
498
|
+
// IDENTITY vs LOCATION (server/entry-location.ts): `island_module_url` is the island's identity
|
|
499
|
+
// (the `entry` attribute, the graph key, the fingerprint input); the file the runtime loads is its
|
|
500
|
+
// location — content-hashed, so an `immutable` cache never serves a stale one. The client build's
|
|
501
|
+
// wrapper passes it (`__src`); the server reads the build handoff. None → the identity is loaded.
|
|
502
|
+
const location_of = (/** @type {string} */ identity) => {
|
|
503
|
+
const found = identity ? entryLocation(identity) : null;
|
|
504
|
+
return found ? asset(found) : '';
|
|
505
|
+
};
|
|
506
|
+
const island_src = $derived(nested || !island_entry ? '' : __src || location_of(island_entry));
|
|
507
|
+
// (written LAST on the element: every attribute before it keeps the order it had before
|
|
508
|
+
// locations, so HTML rewriters and scans keyed on `entry="…" wake="…"` still match)
|
|
509
|
+
|
|
510
|
+
// THE WIRE PLAN (server/props-wire.ts): one walk of this island's props picks its lane (plain
|
|
511
|
+
// JSON, or devalue for anything devalue exists for) and yields the CANONICAL, seed-independent
|
|
512
|
+
// text the fingerprint hashes. The sidecar's final text is produced later, when the document
|
|
513
|
+
// tail renders — by then the request knows whether the page seed ships, and a props subtree
|
|
514
|
+
// that is a seed node crosses as a reference (seed-refs.ts), whichever island rendered first.
|
|
515
|
+
const island_wire = $derived(
|
|
516
|
+
nested || !is_island || island_inline ? null : plan_props_wire(island_props_wire, island_entry)
|
|
517
|
+
);
|
|
518
|
+
// THE ISLAND'S FINGERPRINT (server/fingerprint.ts, through the client-stubbed virtual): its
|
|
519
|
+
// module URL + canonical props text, a native digest. Emitted as data-og-fp; the client only ever
|
|
520
|
+
// READS it (the reconciler's key, the sidecar id, the `x-ogygia-known` set it sends back on nav
|
|
521
|
+
// so the server can skip re-rendering an unchanged island). A function of the props alone: the
|
|
522
|
+
// same props give the same fingerprint with or without the seed.
|
|
523
|
+
const island_fp = $derived(
|
|
524
|
+
island_wire ? islandFingerprint(island_module_url, island_wire.canonical) : ''
|
|
525
|
+
);
|
|
526
|
+
// SERVER-DELTA (D3): SKIP rendering a NON-cached island the client already has live (its fp is
|
|
527
|
+
// in the SPA nav's x-ogygia-known set). Emit the region's identifying attrs + props script but NO
|
|
528
|
+
// component content — the reconciler keeps the live node (same data-key). Safe: known_region_fps()
|
|
529
|
+
// is empty on a full load / non-SPA request, so this never fires except on an SPA nav.
|
|
530
|
+
const island_skip = $derived(
|
|
531
|
+
is_island &&
|
|
532
|
+
!island_inline &&
|
|
533
|
+
!has_slot_children &&
|
|
534
|
+
(__cacheTtl ?? 0) <= 0 &&
|
|
535
|
+
!!island_fp &&
|
|
536
|
+
known_region_fps().has(island_fp)
|
|
537
|
+
);
|
|
538
|
+
// THE DOCUMENT TAIL (server/document-tail.ts): in Kit's page pass this region's module-preload
|
|
539
|
+
// hints and its props sidecar go to the end of the body — the handle emits the tail once, after
|
|
540
|
+
// the content, before the seeds — so the CSS and the hero are requested before a single island
|
|
541
|
+
// byte moves (480 KB of props and 1.7 MB of hinted chunks sat above the LCP image on one measured
|
|
542
|
+
// page). Any other render root has no tail (`document_tail()` → null): a hole response, a baked
|
|
543
|
+
// ticket, a router document keep their hints in the head and their sidecar adjacent, so the HTML
|
|
544
|
+
// stays self-contained wherever it is spliced. Decided once at init — the SSR pass renders each
|
|
545
|
+
// region exactly once.
|
|
546
|
+
const island_props_tail =
|
|
547
|
+
!!tail &&
|
|
548
|
+
untrack(() => {
|
|
549
|
+
const wire = island_wire;
|
|
550
|
+
const fp = island_fp;
|
|
551
|
+
if (!wire || !fp) return false;
|
|
552
|
+
// The sidecar is KEYED by the fingerprint (`data-ogygia-props` + `id`), so the runtime
|
|
553
|
+
// finds it wherever it sits — adjacent, or at the end of the body (runtime/sidecar.ts).
|
|
554
|
+
// The meta rides along for the profiler's Islands table (entry, wake, what the build saw).
|
|
555
|
+
tail.props(fp, wire, {
|
|
556
|
+
entry: island_entry,
|
|
557
|
+
// Svelte names the SSR function after the file (ProductCard.svelte → ProductCard) and
|
|
558
|
+
// the name survives a production bundle — the same name the profiler's CPU samples carry
|
|
559
|
+
name: island_component?.name ?? '',
|
|
560
|
+
// the module as SERVED (its location): what the profiler weighs
|
|
561
|
+
module_url: island_src || island_module_url,
|
|
562
|
+
wake: hydrate_attr,
|
|
563
|
+
interactivity: islandInteractivity(island_entry)
|
|
564
|
+
});
|
|
565
|
+
return true;
|
|
566
|
+
});
|
|
567
|
+
// Adjacent sidecar (no tail: a hole response, a baked ticket, a router document, a test render):
|
|
568
|
+
// self-contained, never seed-relative.
|
|
569
|
+
const island_props_inline = $derived(
|
|
570
|
+
island_props_tail || !island_wire
|
|
571
|
+
? ''
|
|
572
|
+
: props_sidecar(island_fp, island_wire.wire(null), 'adjacent', island_wire.wire_modules)
|
|
573
|
+
);
|
|
574
|
+
|
|
575
|
+
// THE ISLAND GRAPH (island-graph.ts): the chunks this island's code needs, as DATA. The runtime
|
|
576
|
+
// turns the list into modulepreload links when the island WAKES — after the wake gate, for exactly
|
|
577
|
+
// this island, beside its `import()` — so its whole graph downloads in parallel the moment it may
|
|
578
|
+
// start, nothing lands in the paint window, and an island that never wakes downloads nothing. A
|
|
579
|
+
// hint in the HTML could promise none of that: it fetches when the parser meets it. Every wake
|
|
580
|
+
// gets its graph (the runtime knows at wake time what the server could only guess: a media query,
|
|
581
|
+
// a scroll). Only SSR knows the closure: the client knows just the entry URL.
|
|
582
|
+
/**
|
|
583
|
+
* An island entry's graph: its chunks, as public URLs. Portable region-snippets riding the island's
|
|
584
|
+
* props come alive via `import(desc.e)` at hydrate — their entries (+ deps) join the graph.
|
|
585
|
+
* RENDER-GATED by construction: listed iff the island that carries the snippet rendered. The wire
|
|
586
|
+
* plan found each descriptor's public entry URL in the payload (props-wire.ts).
|
|
587
|
+
* @param {string} entry
|
|
588
|
+
* @param {string} self_url
|
|
589
|
+
* @param {readonly string[] | null | undefined} live_entries
|
|
590
|
+
* @returns {string[]}
|
|
591
|
+
*/
|
|
592
|
+
function graph_hrefs(entry, self_url, live_entries) {
|
|
593
|
+
const deps = islandDeps(entry);
|
|
594
|
+
if (!live_entries?.length) return deps.map((dep) => asset(dep));
|
|
595
|
+
const seen = new Set([self_url]);
|
|
596
|
+
/** @type {string[]} */
|
|
597
|
+
const hrefs = [];
|
|
598
|
+
/** @param {string} href */
|
|
599
|
+
const add = (href) => {
|
|
600
|
+
if (href && !seen.has(href)) {
|
|
601
|
+
seen.add(href);
|
|
602
|
+
hrefs.push(href);
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
for (const dep of deps) add(asset(dep));
|
|
606
|
+
for (const m of live_entries) {
|
|
607
|
+
// (the file the snippet's import fetches: its location, when the build named one)
|
|
608
|
+
add(location_of(m) || asset(m));
|
|
609
|
+
for (const dep of islandDeps(m)) add(asset(dep));
|
|
610
|
+
}
|
|
611
|
+
return hrefs;
|
|
612
|
+
}
|
|
613
|
+
// The live entries' LOCATIONS, keyed by the identity the snippet imports by (`desc.e`, as baked):
|
|
614
|
+
// no element carries them, so the island graph does (its `s` map, island-graph.ts).
|
|
615
|
+
const island_live_locations = $derived.by(() => {
|
|
616
|
+
const live = nested || !is_island ? null : island_wire?.live_entries;
|
|
617
|
+
if (!live?.length) return null;
|
|
618
|
+
/** @type {Map<string, string>} */
|
|
619
|
+
const out = new Map();
|
|
620
|
+
for (const m of live) {
|
|
621
|
+
const loc = location_of(m);
|
|
622
|
+
if (loc) out.set(m, loc);
|
|
623
|
+
}
|
|
624
|
+
return out.size ? out : null;
|
|
625
|
+
});
|
|
626
|
+
// Per render it is ONE pass over the build's list: that list is already unique and never holds the
|
|
627
|
+
// entry itself (island-deps.ts), so only portable snippets (which may share chunks) need a dedupe,
|
|
628
|
+
// and that one is a Set. A big app's island lists a few hundred chunks; a quadratic dedupe here
|
|
629
|
+
// was the hottest ogygia frame in a 21-island page's server profile.
|
|
630
|
+
const island_graph_hrefs = $derived.by(() =>
|
|
631
|
+
nested || !is_island || !island_module_url
|
|
632
|
+
? []
|
|
633
|
+
: graph_hrefs(island_entry, island_module_url, island_wire?.live_entries)
|
|
634
|
+
);
|
|
635
|
+
// A csr=true document's island is woken by KIT, not the runtime: its client wrapper imports the
|
|
636
|
+
// entry lazily (Kit's static graph no longer reaches it), so there the HTML hint stays — a `load`
|
|
637
|
+
// island only, at `fetchpriority="low"` (document-tail.ts `modulepreload_tag`): nothing it
|
|
638
|
+
// downloads is needed for first paint, so it must never outrank the CSS and the LCP image.
|
|
639
|
+
const island_kit_hint_hrefs = $derived(
|
|
640
|
+
// (the entry's LOCATION: the file its import fetches, not the stable name)
|
|
641
|
+
is_csr && hydrate_attr === 'load' && island_module_url
|
|
642
|
+
? [island_src || island_module_url, ...island_graph_hrefs]
|
|
643
|
+
: []
|
|
644
|
+
);
|
|
645
|
+
// Both ride the document tail on a Kit page (see `tail` above); the head everywhere else, so a
|
|
646
|
+
// self-contained render root carries its own.
|
|
647
|
+
const island_graph_tail =
|
|
648
|
+
!!tail &&
|
|
649
|
+
untrack(() => {
|
|
650
|
+
if (island_live_locations) for (const [m, loc] of island_live_locations) tail.locate(m, loc);
|
|
651
|
+
if (island_kit_hint_hrefs.length) tail.hints(island_kit_hint_hrefs, island_fp);
|
|
652
|
+
else if (!is_csr && island_module_url) {
|
|
653
|
+
// The page lists an entry once: a second instance of the same island reuses the list the
|
|
654
|
+
// first one recorded instead of building it again.
|
|
655
|
+
const hrefs = tail.graph_of(island_module_url) ?? island_graph_hrefs;
|
|
656
|
+
if (hrefs.length) tail.graph(island_module_url, hrefs, island_fp, island_src);
|
|
657
|
+
}
|
|
658
|
+
return true;
|
|
659
|
+
});
|
|
660
|
+
const island_preload_head = $derived(
|
|
661
|
+
island_graph_tail
|
|
662
|
+
? ''
|
|
663
|
+
: island_kit_hint_hrefs.length
|
|
664
|
+
? island_kit_hint_hrefs.map(modulepreload_tag).join('')
|
|
665
|
+
: !is_csr && (island_graph_hrefs.length || island_live_locations)
|
|
666
|
+
? island_graph_script(
|
|
667
|
+
new Map([[island_module_url, island_graph_hrefs]]),
|
|
668
|
+
island_live_locations
|
|
669
|
+
)
|
|
670
|
+
: ''
|
|
671
|
+
);
|
|
672
|
+
|
|
673
|
+
// ─────────────────────────────────────────────────────────── server branch ──
|
|
674
|
+
const server_endpoint = $derived.by(() => {
|
|
675
|
+
if (!is_server || nested) return '';
|
|
676
|
+
// Routed through the client-stubbed virtual (returns '' on the client); encodes, size-checks
|
|
677
|
+
// (throws), and signs on the server. Same URL/MAC/TTL as every other mint path. `__cacheTtl`
|
|
678
|
+
// (seconds, from the preset's `maxAge`) is signed in so the handle sets Cache-Control; absent
|
|
679
|
+
// → 0 → the hole is served `no-store` (dynamic by default).
|
|
680
|
+
// (+ the page facts it renders from, for a hole whose tree reads page.data: server/render-page.ts)
|
|
681
|
+
return mintServerIsland(__entry, __props || {}, __cacheTtl || 0) + kit_page_version(__entry);
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
// DOM `entry`: the importable module URL a deferred island wakes with AFTER its HTML swaps in.
|
|
685
|
+
// EMPTY for a static server island (`render: 'deferred'` with no `wake`) — it has no client module,
|
|
686
|
+
// so there is nothing to import. Must not fall back to the region id: the router's next-page warm
|
|
687
|
+
// scans `entry="…"` and `import()`s each as a module, so a bare id there fetches `/<id>` → 404 on
|
|
688
|
+
// nav. The endpoint (which fetches the hole's HTML) is minted from `__entry` above, independently.
|
|
689
|
+
const server_region_entry = $derived(!nested && __module ? asset(__module) : '');
|
|
690
|
+
// …and its location, the file that import fetches (as for an island)
|
|
691
|
+
const server_region_src = $derived(!nested && __module ? __src || location_of(__module) : '');
|
|
692
|
+
|
|
693
|
+
// A hydrating hole's props: ADJACENT and self-contained (the hole's HTML is spliced by the
|
|
694
|
+
// runtime), unkeyed, in whichever lane the props qualify for (props-wire.ts).
|
|
695
|
+
const server_wire = $derived(nested || !__hydrate ? null : plan_props_wire(__props, __entry));
|
|
696
|
+
const server_props_script = $derived(
|
|
697
|
+
server_wire
|
|
698
|
+
? props_sidecar('', server_wire.wire(null), 'adjacent', server_wire.wire_modules)
|
|
699
|
+
: ''
|
|
700
|
+
);
|
|
701
|
+
// The hole's IDENTITY — the fingerprint of its region id + canonical props, the same function on
|
|
702
|
+
// both legs (runtime/hash.ts), so the client leg computes the SAME value the server emitted. The
|
|
703
|
+
// runtime keys the server-minted facts (endpoint, props sidecar) on it: when Kit gives up
|
|
704
|
+
// hydrating a client-on document and mounts it fresh, the client leg renders this hole again
|
|
705
|
+
// with NO address (it cannot mint), and the runtime hands the SSR facts back by identity — never
|
|
706
|
+
// by position. Emitted on every top-level hole; costs one walk of the hole's (small) props.
|
|
707
|
+
const server_identity = $derived(
|
|
708
|
+
nested || !is_server
|
|
709
|
+
? ''
|
|
710
|
+
: fingerprint_of(
|
|
711
|
+
__entry,
|
|
712
|
+
'',
|
|
713
|
+
(server_wire ?? plan_props_wire(__props || {}, __entry)).canonical
|
|
714
|
+
)
|
|
715
|
+
);
|
|
716
|
+
// A hole a client hydrates over — in a live snippet's body, or on a KIT-HYDRATED document — is adopted
|
|
717
|
+
// (`adopt_region`): its browser leg cannot mint the hole's address, and as a template it blanked
|
|
718
|
+
// `endpoint` (Svelte sets a dynamic attribute during hydration) and, when the HTML had already landed,
|
|
719
|
+
// the content with it (a csr=true page's hole inside an inline island went empty in dev). A re-created
|
|
720
|
+
// one has no address; the runtime finds the hole's facts by identity, as for a hole Kit rebuilt.
|
|
721
|
+
const hole_attrs = () => {
|
|
722
|
+
/** @param {string} name @param {unknown} v */
|
|
723
|
+
const a = (name, v) =>
|
|
724
|
+
v == null || v === '' ? '' : ' ' + name + '="' + escape_attr(String(v)) + '"';
|
|
725
|
+
return (
|
|
726
|
+
' entry="' +
|
|
727
|
+
escape_attr(server_region_entry) +
|
|
728
|
+
'" render="defer"' +
|
|
729
|
+
a('stitch', __stitch) +
|
|
730
|
+
a('prefetch', __prefetch) +
|
|
731
|
+
a('when', __defer) +
|
|
732
|
+
a('wake', __hydrate) +
|
|
733
|
+
a('margin', __margin) +
|
|
734
|
+
a('hydrate-margin', __hydrateMargin) +
|
|
735
|
+
' endpoint="' +
|
|
736
|
+
escape_attr(server_endpoint) +
|
|
737
|
+
'"' +
|
|
738
|
+
a('data-og-hole', server_identity) +
|
|
739
|
+
a('src', server_region_src)
|
|
740
|
+
);
|
|
741
|
+
};
|
|
742
|
+
const hole_adopt = adopt_region(
|
|
743
|
+
hole_attrs,
|
|
744
|
+
(renderer) => {
|
|
745
|
+
if (ogygiaFallback)
|
|
746
|
+
SlotBoundary(renderer, /** @type {never} */ ({ children: ogygiaFallback }));
|
|
747
|
+
},
|
|
748
|
+
(el) => {
|
|
749
|
+
// created fresh (adopted, it holds the server's): its fallback, rendered here as the server
|
|
750
|
+
// did — the rebuilt hole's address comes back from the holes record, the fallback is the page's
|
|
751
|
+
if (el.firstChild || !ogygiaFallback) return;
|
|
752
|
+
const app = mount(SlotBoundary, {
|
|
753
|
+
target: el,
|
|
754
|
+
props: { children: ogygiaFallback },
|
|
755
|
+
context: region_contexts
|
|
756
|
+
});
|
|
757
|
+
return () => void unmount(app);
|
|
758
|
+
}
|
|
759
|
+
);
|
|
760
|
+
// A hole NESTED in an island renders in the page pass (`deferred` ignored, the nested rule) — as a
|
|
761
|
+
// LAKE: frozen server HTML the island adopts and lifts around its hydrate, never hydrated itself. A
|
|
762
|
+
// hole ships no JS wherever it sits (the client wrapper has no component — emit.ts), and the
|
|
763
|
+
// islands authored inside it emit real regions (LakeBoundary) and wake on their own.
|
|
764
|
+
const hole_frozen = adopt_region(
|
|
765
|
+
() => ' entry="' + escape_attr(String(__entry || '')) + '" wake="none" remount="cache"',
|
|
766
|
+
(renderer) => {
|
|
767
|
+
const Component = /** @type {(r: unknown, p: unknown) => void} */ (
|
|
768
|
+
/** @type {unknown} */ (__component)
|
|
769
|
+
);
|
|
770
|
+
if (Component)
|
|
771
|
+
LakeBoundary(
|
|
772
|
+
renderer,
|
|
773
|
+
/** @type {never} */ ({
|
|
774
|
+
children: (/** @type {unknown} */ r) => Component(r, __props || {})
|
|
775
|
+
})
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
);
|
|
779
|
+
// …and its stylesheets: the page never imported its component (the client wrapper has none), so
|
|
780
|
+
// link them as its endpoint answer would (server-only; the client hoists `data-ogygia-region-css`)
|
|
781
|
+
const hole_css_html = $derived.by(() => {
|
|
782
|
+
if (!is_server || !nested) return '';
|
|
783
|
+
let html = '';
|
|
784
|
+
for (const href of claim_region_css(holeCss(__entry || '')))
|
|
785
|
+
html += region_css_tag(href, asset(href));
|
|
786
|
+
return html;
|
|
787
|
+
});
|
|
788
|
+
// On a KIT-HYDRATED document the facts ride the document tail too (server/document-tail.ts
|
|
789
|
+
// `hole()`): Kit's root can be cleared and mounted fresh, the tail outside it cannot. Decided once
|
|
790
|
+
// at init — the SSR pass renders each region exactly once.
|
|
791
|
+
// So do a live snippet's holes, on any document: the island re-creates the snippet in the browser
|
|
792
|
+
// (an `{#if}` toggling), and the hole created fresh fetches by its identity, as a rebuilt one does.
|
|
793
|
+
if (tail && (is_csr || in_live_snippet) && is_server && !nested) {
|
|
794
|
+
untrack(() => {
|
|
795
|
+
const endpoint = server_endpoint;
|
|
796
|
+
if (endpoint) tail.hole(server_identity, endpoint, server_props_script);
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
// Every document: note the hole's schedule + cache policy for the profiler's hole economics.
|
|
800
|
+
if (tail && is_server && !nested)
|
|
801
|
+
untrack(() =>
|
|
802
|
+
tail.note_hole(
|
|
803
|
+
__entry,
|
|
804
|
+
__defer,
|
|
805
|
+
__hydrate || null,
|
|
806
|
+
__cacheTtl || 0,
|
|
807
|
+
island_component?.name ?? '',
|
|
808
|
+
__props,
|
|
809
|
+
server_endpoint ? hole_copy_of(server_endpoint) : ''
|
|
810
|
+
)
|
|
811
|
+
);
|
|
812
|
+
|
|
813
|
+
// A hydrating hole's island graph — the same data as `island_graph_hrefs`: the runtime preloads it
|
|
814
|
+
// when the hole's island wakes (phase 2, after its HTML landed). Every document: the runtime, not
|
|
815
|
+
// Kit, wakes a hole's island even on a csr=true page.
|
|
816
|
+
const server_graph_hrefs = $derived.by(() =>
|
|
817
|
+
nested || !__module || !__hydrate || !server_region_entry
|
|
818
|
+
? []
|
|
819
|
+
: graph_hrefs(__module, server_region_entry, null)
|
|
820
|
+
);
|
|
821
|
+
const server_fetch_preload = $derived.by(() => {
|
|
822
|
+
// Only `defer: 'load'`: start the endpoint fetch during HTML parse (warms the per-hole load).
|
|
823
|
+
if (nested || building || __defer !== 'load' || !server_endpoint) return '';
|
|
824
|
+
const href_attr = escape_amp(server_endpoint);
|
|
825
|
+
return (
|
|
826
|
+
LT + 'link rel="preload" as="fetch" crossorigin="anonymous" href="' + href_attr + '"' + GT
|
|
827
|
+
);
|
|
828
|
+
});
|
|
829
|
+
// The fetch preload STAYS in the head: it starts the hole's content request during the HTML parse
|
|
830
|
+
// (content, not island code). The island graph rides the tail.
|
|
831
|
+
const server_graph_tail =
|
|
832
|
+
!!tail &&
|
|
833
|
+
untrack(() => {
|
|
834
|
+
if (server_graph_hrefs.length) tail.graph(server_region_entry, server_graph_hrefs);
|
|
835
|
+
return true;
|
|
836
|
+
});
|
|
837
|
+
const server_preload = $derived(
|
|
838
|
+
server_fetch_preload +
|
|
839
|
+
(server_graph_tail || !server_graph_hrefs.length
|
|
840
|
+
? ''
|
|
841
|
+
: island_graph_script(new Map([[server_region_entry, server_graph_hrefs]])))
|
|
842
|
+
);
|
|
843
|
+
|
|
844
|
+
// ───────────────────────────────────────────────────────────── lake branch ──
|
|
845
|
+
// Lakes matter only inside an island (freeze + lift/restore). In the shell they render bare.
|
|
846
|
+
const lake_inside = is_lake && nested;
|
|
847
|
+
const lake_swr = $derived(__remount === 'swr');
|
|
848
|
+
const lake_endpoint = $derived(
|
|
849
|
+
lake_inside && lake_swr ? makeRegionEndpoint(__entry || '', __props || {}) : ''
|
|
850
|
+
);
|
|
851
|
+
// Every lake a client hydrates over — inside an island, or on a KIT-HYDRATED document (a csr=true
|
|
852
|
+
// page) — is adopted (`adopt_region`). The lake's component is the render-nothing placeholder on the
|
|
853
|
+
// client (its JS ships to no browser), so a normal template MISMATCHED wherever the lake's HTML was
|
|
854
|
+
// still there when the client hydrated: under Kit (Svelte discarded the SSR DOM and the lake
|
|
855
|
+
// vanished — a site header under a csr=true page), and inside a live snippet, which hydrates after
|
|
856
|
+
// its host island restored its lakes. An island's own lakes are lifted out around its hydrate, so
|
|
857
|
+
// it adopts the empty element and the runtime puts the HTML back (lakes.ts). It is a real frozen
|
|
858
|
+
// region: LakeBoundary resets `nested` and marks the lake's inside, so the islands and holes
|
|
859
|
+
// authored in there emit their real regions and wake on the runtime.
|
|
860
|
+
const lake_attrs = $derived.by(() => {
|
|
861
|
+
/** @param {unknown} v */
|
|
862
|
+
const esc = (v) => escape_attr(String(v));
|
|
863
|
+
let s = ' entry="' + esc(__entry || '') + '" wake="none" remount="' + esc(__remount) + '"';
|
|
864
|
+
if (lake_swr) s += ' when="' + esc(__when) + '"';
|
|
865
|
+
if (__maxAge != null) s += ' max-age="' + esc(String(__maxAge)) + '"';
|
|
866
|
+
if (__onExpire) s += ' on-expire="' + esc(__onExpire) + '"';
|
|
867
|
+
if (lake_swr && __margin) s += ' margin="' + esc(__margin) + '"';
|
|
868
|
+
if (lake_endpoint) s += ' endpoint="' + esc(lake_endpoint) + '"';
|
|
869
|
+
return s;
|
|
870
|
+
});
|
|
871
|
+
const lake_adopt = adopt_region(
|
|
872
|
+
() => lake_attrs,
|
|
873
|
+
(renderer) => LakeBoundary(renderer, /** @type {never} */ ({ children })),
|
|
874
|
+
(el) => {
|
|
875
|
+
// Created fresh on the client (a Kit client-side navigation mounted this lake, or Kit gave up
|
|
876
|
+
// hydrating the document and mounted fresh), so there was no SSR element to adopt: a lake is
|
|
877
|
+
// server HTML, and there is none here. The runtime repaints it from the copy it took of the SSR
|
|
878
|
+
// children when the lake first connected (lakes.ts), if this document had them; a route Kit
|
|
879
|
+
// client-renders from scratch has nothing. (Inside an island an empty element is the lifted
|
|
880
|
+
// lake, which the runtime fills right after.)
|
|
881
|
+
if (is_csr && !el.firstChild && import.meta.env && import.meta.env.DEV)
|
|
882
|
+
console.warn(
|
|
883
|
+
`[ogygia] lake "${__entry}" was mounted by Kit on the client with no server HTML to adopt (a client-side navigation, or a hydration failure — look for an error above). The runtime restores it from its server HTML when this document rendered it; otherwise it stays empty. A lake is server HTML: keep chrome lakes in a layout that persists across navigations, or serve that route csr=false.`
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
);
|
|
887
|
+
|
|
888
|
+
// ─────────────────────────────────────────────── head (runtime + preload) ──
|
|
889
|
+
// The runtime bootstrap for this page. Claim once, for a top-level island/server placement, and for
|
|
890
|
+
// a held region the runtime paints (a live wire value, a deferred hole, a promise) — on a Kit-hydrated
|
|
891
|
+
// page too, where nothing else may have shipped it (lakes render inside an island). With the router on,
|
|
892
|
+
// the handle injects the same script on island-less pages — this is the with-islands path, and it
|
|
893
|
+
// keeps islands hydrating even when the router is off (`ogygia({ router: false })`).
|
|
894
|
+
// The runtime's own static imports (the chunks it shares with the rest of the app) ride along as
|
|
895
|
+
// modulepreload hints, so they download with it rather than after it. Its location, not its
|
|
896
|
+
// stable name: the one bootstrap every document path shares (server/entry-location.ts).
|
|
897
|
+
const runtime_script =
|
|
898
|
+
!nested && ((is_island && !is_csr) || is_server || holds_live) && claimRuntimeEmit()
|
|
899
|
+
? runtime_bootstrap(asset) +
|
|
900
|
+
(hmrUrl
|
|
901
|
+
? LT +
|
|
902
|
+
'script type="module" data-ogygia-dev-hmr src="' +
|
|
903
|
+
asset(hmrUrl) +
|
|
904
|
+
'"' +
|
|
905
|
+
GT +
|
|
906
|
+
LT +
|
|
907
|
+
'/script' +
|
|
908
|
+
GT
|
|
909
|
+
: '')
|
|
910
|
+
: '';
|
|
911
|
+
// Held dual: the component was server-picked (a registry), so its CSS is on no page stylesheet —
|
|
912
|
+
// Kit links CSS from the route's STATIC import graph, never from what actually rendered. This
|
|
913
|
+
// render pass knows, so link it here: real `<link>`s into <head> via svelte:head, claimed
|
|
914
|
+
// per-request so a page rendering five of the same block links its sheet once. Server-only —
|
|
915
|
+
// `claim_region_css` returns [] on the client (SSR already emitted them).
|
|
916
|
+
const region_css_html = $derived.by(() => {
|
|
917
|
+
if (!resolved || resolved.kind !== 'dual' || !resolved.module) return '';
|
|
918
|
+
let html = '';
|
|
919
|
+
for (const href of claim_region_css(islandCss(resolved.module)))
|
|
920
|
+
html += region_css_tag(href, asset(href));
|
|
921
|
+
return html;
|
|
922
|
+
});
|
|
923
|
+
// A PLACED client island's CSS is ASSUMED to already sit in the page's own stylesheet (Kit links
|
|
924
|
+
// a route's static import graph). But Rollup can chunk-split the marked component's CSS — notably
|
|
925
|
+
// its `:global()` rules (a Bits UI dropdown trigger/menu, a scoped card) — into a route chunk this
|
|
926
|
+
// page never loads, so the island renders unstyled in a production build. Link the island's own
|
|
927
|
+
// CSS here, the SAME channel a held dual uses (`claim_region_css` dedups per-request, the client
|
|
928
|
+
// hoists `data-ogygia-region-css` into <head>). Keyed by the raw `island_entry`, exactly like
|
|
929
|
+
// `island_preload`'s `islandDeps` — not the asset URL. Server-only; dev routes through the same
|
|
930
|
+
// module-import hoist (`islandCss` returns the dev module URL there).
|
|
931
|
+
const island_css_html = $derived.by(() => {
|
|
932
|
+
// A csr=true document's inline island links its CSS here as well: the client wrapper imports
|
|
933
|
+
// the component lazily there, so Kit's route stylesheets no longer carry it (that static
|
|
934
|
+
// reach is what linked every registry block's sheet on every page). A NESTED island links
|
|
935
|
+
// its own too: it loads its component through the same lazy wrapper, and an island's CSS
|
|
936
|
+
// list is its chunk closure over STATIC edges — so the parent's list never carries the inner
|
|
937
|
+
// island's sheet (and a CMS container that finds its blocks in a registry at render time
|
|
938
|
+
// never imports them at all). Claims are per request, so a sheet the parent already linked
|
|
939
|
+
// is not linked twice.
|
|
940
|
+
if (__mode !== 'island' || !island_entry) return '';
|
|
941
|
+
let html = '';
|
|
942
|
+
for (const href of claim_region_css(islandCss(island_entry)))
|
|
943
|
+
html += region_css_tag(href, asset(href));
|
|
944
|
+
return html;
|
|
945
|
+
});
|
|
946
|
+
// The RENDERED stamp for an inline island (a csr=true document, or nested in a woken island):
|
|
947
|
+
// `<meta name="ogygia-kit-island" content="<entry>">`, once per entry per request. The client
|
|
948
|
+
// wrapper's lazy component module (emit.ts `lazy_entry_source`) reads it before Kit hydrates and
|
|
949
|
+
// imports the entry only for stamped islands — an unrendered registry block ships nothing.
|
|
950
|
+
const kit_island_meta = $derived.by(() => {
|
|
951
|
+
if (!is_island || !island_inline || !island_entry || !claim_kit_island(island_entry)) return '';
|
|
952
|
+
const content = escape_amp_quot(String(island_entry));
|
|
953
|
+
return LT + 'meta name="ogygia-kit-island" content="' + content + '"' + GT;
|
|
954
|
+
});
|
|
955
|
+
|
|
956
|
+
// A content BODY (an inline region from a `.svx`/`.md`) carries its own scoped `<style>`, but the
|
|
957
|
+
// corpus is server-only so that CSS joins no page stylesheet — the same blind spot a held dual has,
|
|
958
|
+
// one step further (there is no client module at all, just data). The markdown source baked a
|
|
959
|
+
// `content_id`; resolve it through the handoff (`contentCss`) and link the client CSS asset the
|
|
960
|
+
// plugin emitted, the SAME `data-ogygia-region-css` channel, deduped per-request by `claim_region_css`.
|
|
961
|
+
const content_css_html = $derived.by(() => {
|
|
962
|
+
if (resolved?.kind !== 'inline' || !resolved.content_id) return '';
|
|
963
|
+
let html = '';
|
|
964
|
+
for (const href of claim_region_css(contentCss(resolved.content_id)))
|
|
965
|
+
html += region_css_tag(href, asset(href));
|
|
966
|
+
return html;
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
const head_html = $derived(
|
|
970
|
+
(is_island
|
|
971
|
+
? runtime_script + island_preload_head + island_css_html + kit_island_meta
|
|
972
|
+
: is_server
|
|
973
|
+
? runtime_script + server_preload + hole_css_html
|
|
974
|
+
: runtime_script) +
|
|
975
|
+
region_css_html +
|
|
976
|
+
content_css_html
|
|
977
|
+
);
|
|
978
|
+
|
|
979
|
+
// ────────────────────────────────────────────────────── held: live / deferred ──
|
|
980
|
+
const stringify_devalue = stringify;
|
|
981
|
+
// A baked live region's FIRST HTML, read once: the markup the page was served with and hydrates
|
|
982
|
+
// against. Later values never re-render it (a re-render would recreate every node and remount the
|
|
983
|
+
// islands inside); the runtime morphs them in.
|
|
984
|
+
// svelte-ignore state_referenced_locally
|
|
985
|
+
const baked_html = __baked
|
|
986
|
+
? (/** @type {{ html?: string } | undefined} */ (resolved)?.html ?? '')
|
|
987
|
+
: '';
|
|
988
|
+
// The baked region is OPAQUE (region-attrs.ts `OPAQUE_SELECTOR`): its HTML is server-only, never a
|
|
989
|
+
// Svelte tree the client could hydrate — the same as a lake's — so it is adopted (`adopt_region`). As
|
|
990
|
+
// an `{@html}`, Svelte walked its siblings to the first empty comment and the render's own top-level
|
|
991
|
+
// markers stopped it inside: `hydration_mismatch`, and Kit remounted the page with the region
|
|
992
|
+
// emptied. Later values morph in.
|
|
993
|
+
/** @type {Element | null} */
|
|
994
|
+
let baked_el = $state(null);
|
|
995
|
+
const baked_adopt = adopt_region(
|
|
996
|
+
() => ' live data-og-baked',
|
|
997
|
+
(renderer) => /** @type {{ push(html: string): void }} */ (renderer).push(baked_html),
|
|
998
|
+
(el) => {
|
|
999
|
+
baked_el = el;
|
|
1000
|
+
return () => (baked_el = null);
|
|
1001
|
+
}
|
|
1002
|
+
);
|
|
1003
|
+
// (reads `resolved` too: a Promise `of` that re-resolves morphs the mounted region in place)
|
|
1004
|
+
$effect(() => {
|
|
1005
|
+
if (baked_el)
|
|
1006
|
+
apply_live(/** @type {Element & { applyLive?: (v: unknown) => void }} */ (baked_el));
|
|
1007
|
+
});
|
|
1008
|
+
/** @param {Element & { applyLive?: (v: unknown) => void }} node */
|
|
1009
|
+
function apply_live(node) {
|
|
1010
|
+
// Reads `resolved`, so the attachment re-runs when a Promise `of` re-resolves — the mounted
|
|
1011
|
+
// region morphs to the new HTML instead of remounting (LAG keeps the old content meanwhile).
|
|
1012
|
+
const f = resolved;
|
|
1013
|
+
if (!f || f.kind !== 'deferred' || f.html == null) return;
|
|
1014
|
+
node.applyLive?.({
|
|
1015
|
+
id: f.id,
|
|
1016
|
+
module: f.module,
|
|
1017
|
+
props: f.props,
|
|
1018
|
+
html: f.html,
|
|
1019
|
+
url: f.url,
|
|
1020
|
+
hydrate: f.hydrate,
|
|
1021
|
+
hydrateMargin: f.hydrateMargin
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
/** @param {import('./region.js').DeferredRegion} f */
|
|
1025
|
+
function identity(f) {
|
|
1026
|
+
try {
|
|
1027
|
+
return f.id + '' + stringify_devalue(f.props);
|
|
1028
|
+
} catch {
|
|
1029
|
+
return f.id;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
const held_props_script = $derived.by(() => {
|
|
1033
|
+
if (!resolved || resolved.kind !== 'deferred' || !resolved.hydrate || !resolved.url) return '';
|
|
1034
|
+
// devalue output is `<`-safe by itself; adjacent and unkeyed, like a hole's.
|
|
1035
|
+
return props_sidecar('', { text: stringify_devalue(resolved.props), json: false });
|
|
1036
|
+
});
|
|
1037
|
+
// DEVTOOLS (server realm): emit ONE `server.region.rendered` per real <ogygia-region> this SSR pass
|
|
1038
|
+
// produces (inline/nested components ship no region, so they are skipped). Reads the already-computed
|
|
1039
|
+
// deriveds via untrack (no reactive dep); the whole block DCEs when devtools is off. Rides the page
|
|
1040
|
+
// side-channel the handle injects — so a region's server render lands in the same client-side stream
|
|
1041
|
+
// as its wake, keyed by the SAME data-og-fp.
|
|
1042
|
+
if (DEVTOOLS && typeof window === 'undefined') {
|
|
1043
|
+
untrack(() => {
|
|
1044
|
+
try {
|
|
1045
|
+
if (is_island && !island_inline) {
|
|
1046
|
+
record_server_event({
|
|
1047
|
+
domain: 'server',
|
|
1048
|
+
name: 'server.region.rendered',
|
|
1049
|
+
fp: island_fp || '',
|
|
1050
|
+
mode: 'island',
|
|
1051
|
+
entry: island_module_url || undefined,
|
|
1052
|
+
propsBytes: island_wire?.canonical.length ?? 0
|
|
1053
|
+
});
|
|
1054
|
+
if (island_skip)
|
|
1055
|
+
record_server_event({
|
|
1056
|
+
domain: 'server',
|
|
1057
|
+
name: 'server.delta.skip',
|
|
1058
|
+
fp: island_fp || ''
|
|
1059
|
+
});
|
|
1060
|
+
} else if (is_server && !nested) {
|
|
1061
|
+
record_server_event({
|
|
1062
|
+
domain: 'server',
|
|
1063
|
+
name: 'server.region.rendered',
|
|
1064
|
+
fp: '',
|
|
1065
|
+
mode: 'server',
|
|
1066
|
+
entry: server_region_entry || undefined,
|
|
1067
|
+
propsBytes: server_wire?.canonical.length ?? 0
|
|
1068
|
+
});
|
|
1069
|
+
} else if (is_lake && lake_inside) {
|
|
1070
|
+
record_server_event({
|
|
1071
|
+
domain: 'server',
|
|
1072
|
+
name: 'server.region.rendered',
|
|
1073
|
+
fp: '',
|
|
1074
|
+
mode: 'lake',
|
|
1075
|
+
entry: __entry || undefined
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
} catch {
|
|
1079
|
+
/* devtools emit must never break a render */
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
</script>
|
|
1084
|
+
|
|
1085
|
+
<!-- svelte:head must be top-level (not inside {#if}); non-island/server modes leave it empty. -->
|
|
1086
|
+
<!-- SERVER-AUTHORED HTML: every {@html} below carries a string only the server can make — head
|
|
1087
|
+
links claimed once per request, a props sidecar the document tail may have taken instead.
|
|
1088
|
+
When a region renders in the browser (nested in an island a snippet brought), the browser's
|
|
1089
|
+
value differs by design, and hydration keeps the server's nodes: that is the behavior we
|
|
1090
|
+
want, so each block tells Svelte (svelte-ignore) instead of it warning on every such page. -->
|
|
1091
|
+
<svelte:head><!-- svelte-ignore hydration_html_changed -->{@html head_html}</svelte:head>
|
|
1092
|
+
{#if is_island}
|
|
1093
|
+
{@const Component = island_component}
|
|
1094
|
+
{#if island_inline}{#if Component}<Component {...island_props_ready}
|
|
1095
|
+
>{@render island_children?.()}</Component
|
|
1096
|
+
>{:else if late_load}<LateIsland
|
|
1097
|
+
load={late_load}
|
|
1098
|
+
props={island_props_ready}
|
|
1099
|
+
children={island_children}
|
|
1100
|
+
/>{/if}{:else if island_skip}<ogygia-region
|
|
1101
|
+
entry={island_module_url}
|
|
1102
|
+
wake={hydrate_attr}
|
|
1103
|
+
margin={root_margin || undefined}
|
|
1104
|
+
data-ogygia-keep={__keep || undefined}
|
|
1105
|
+
data-og-fp={island_fp || undefined}
|
|
1106
|
+
data-og-skipped
|
|
1107
|
+
src={island_src || undefined}
|
|
1108
|
+
|
|
1109
|
+
></ogygia-region><!-- svelte-ignore hydration_html_changed -->{@html island_props_inline}{:else}<ogygia-region
|
|
1110
|
+
entry={island_module_url}
|
|
1111
|
+
wake={hydrate_attr}
|
|
1112
|
+
margin={root_margin || undefined}
|
|
1113
|
+
data-ogygia-keep={__keep || undefined}
|
|
1114
|
+
data-og-fp={island_fp || undefined}
|
|
1115
|
+
src={island_src || undefined}
|
|
1116
|
+
>{#if Component}<Component {...island_props_body} />{/if}</ogygia-region
|
|
1117
|
+
><!-- svelte-ignore hydration_html_changed -->{@html island_props_inline}{/if}
|
|
1118
|
+
{:else if is_server}
|
|
1119
|
+
{@const Component = __component}
|
|
1120
|
+
{#if nested}{@render hole_frozen()}{:else if in_live_snippet || is_csr}{@render hole_adopt()}<!-- svelte-ignore hydration_html_changed -->{@html server_props_script}{:else}<ogygia-region
|
|
1121
|
+
entry={server_region_entry}
|
|
1122
|
+
render="defer"
|
|
1123
|
+
stitch={__stitch || undefined}
|
|
1124
|
+
prefetch={__prefetch || undefined}
|
|
1125
|
+
when={__defer}
|
|
1126
|
+
wake={__hydrate || undefined}
|
|
1127
|
+
margin={__margin || undefined}
|
|
1128
|
+
hydrate-margin={__hydrateMargin || undefined}
|
|
1129
|
+
endpoint={server_endpoint}
|
|
1130
|
+
data-og-hole={server_identity || undefined}
|
|
1131
|
+
src={server_region_src || undefined}
|
|
1132
|
+
>{#if ogygiaFallback}<SlotBoundary>{@render ogygiaFallback()}</SlotBoundary
|
|
1133
|
+
>{/if}</ogygia-region
|
|
1134
|
+
><!-- svelte-ignore hydration_html_changed -->{@html server_props_script}{/if}
|
|
1135
|
+
{:else if is_lake}
|
|
1136
|
+
{#if is_csr || lake_inside}{@render lake_adopt()}{:else}
|
|
1137
|
+
{@render children?.()}
|
|
1138
|
+
{/if}
|
|
1139
|
+
{:else if resolved?.kind === 'inline'}
|
|
1140
|
+
{@const Component = resolved.component}
|
|
1141
|
+
<Component {...resolved.props}
|
|
1142
|
+
>{#if children}{@render children()}{/if}</Component
|
|
1143
|
+
>
|
|
1144
|
+
{:else if resolved?.kind === 'dual'}
|
|
1145
|
+
{@const Component = resolved.component}
|
|
1146
|
+
<Component {...resolved.props}
|
|
1147
|
+
>{#if children}{@render children()}{/if}</Component
|
|
1148
|
+
>
|
|
1149
|
+
{:else if resolved?.html != null}
|
|
1150
|
+
<!-- Baked (awaited in the render): the first HTML is in the page, written ONCE — a later value
|
|
1151
|
+
never re-renders it, the runtime morphs it in (applyLive). Otherwise the placeholder (or legacy
|
|
1152
|
+
children) shows until the styled HTML paints. -->
|
|
1153
|
+
{#if __baked}{@render baked_adopt()}{:else}<ogygia-region live {@attach apply_live}
|
|
1154
|
+
>{#if placeholder}{@render placeholder()}{:else if children}{@render children()}{/if}</ogygia-region
|
|
1155
|
+
>{/if}
|
|
1156
|
+
{:else if resolved}
|
|
1157
|
+
{@const d = /** @type {import('./region.js').DeferredRegion} */ (resolved)}
|
|
1158
|
+
{#key identity(d)}
|
|
1159
|
+
<ogygia-region
|
|
1160
|
+
entry={d.module || ''}
|
|
1161
|
+
render="defer"
|
|
1162
|
+
when="load"
|
|
1163
|
+
wake={d.hydrate || undefined}
|
|
1164
|
+
hydrate-margin={d.hydrateMargin || undefined}
|
|
1165
|
+
endpoint={d.url}
|
|
1166
|
+
src={location_of(d.module || '') || undefined}
|
|
1167
|
+
>{#if placeholder}{@render placeholder()}{:else if children}{@render children()}{/if}</ogygia-region
|
|
1168
|
+
><!-- svelte-ignore hydration_html_changed -->{@html held_props_script}
|
|
1169
|
+
{/key}
|
|
1170
|
+
{:else if of_is_promise}
|
|
1171
|
+
<!-- A promise `of`: the region owns the whole wait — PromiseRegion decides how it waits. -->
|
|
1172
|
+
<PromiseRegion {of} {placeholder} {children} />
|
|
1173
|
+
{/if}
|