@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,256 @@
|
|
|
1
|
+
import { observe } from "./observe.js";
|
|
2
|
+
// src/runtime/schedule.ts
|
|
3
|
+
/**
|
|
4
|
+
* THE HYDRATION SCHEDULER — one island per task, viewport first.
|
|
5
|
+
*
|
|
6
|
+
* `customElements.define` upgrades every region on the page in one task; with 21 `wake:'load'`
|
|
7
|
+
* islands the old runtime then hydrated them back-to-back in microtasks — props parse + module
|
|
8
|
+
* continuation + Svelte hydrate, 21 times, in ONE long task, in document order, with the header
|
|
9
|
+
* nobody can see yet racing the hero everybody can. Here every island that is ready to hydrate
|
|
10
|
+
* asks for a TURN; turns are handed out one per task (`scheduler.yield()`, else a `MessageChannel`
|
|
11
|
+
* hop — never a timer), so the browser paints, scrolls and handles input between islands, and the
|
|
12
|
+
* next turn goes to a region that intersects the viewport NOW (one shared IntersectionObserver
|
|
13
|
+
* snapshot, taken at connect) before any that does not, document order within each group.
|
|
14
|
+
*
|
|
15
|
+
* What a turn covers is the island's whole synchronous hydrate step (props parse, Svelte hydrate,
|
|
16
|
+
* lake restore). Module imports are NOT serialized — every island's `import()` starts at its wake,
|
|
17
|
+
* in parallel; a turn is requested when the module has arrived. Arrivals are staggered (one task
|
|
18
|
+
* each, in network order), so "viewport first" also means: a ready island BELOW the fold holds its
|
|
19
|
+
* turn while a viewport island is still waiting for its module — bounded, so a chunk that never
|
|
20
|
+
* comes cannot stall the rest of the page.
|
|
21
|
+
*
|
|
22
|
+
* The viewport snapshot is asynchronous (the observer reports after layout). A drain waits for
|
|
23
|
+
* the snapshot of every queued region, bounded (a hidden document never lays out; a stalled
|
|
24
|
+
* observer must not stall hydration), so the boot's first island is the right one, not merely the
|
|
25
|
+
* first one.
|
|
26
|
+
*/
|
|
27
|
+
/** How long the drain waits for the observer's snapshot of a queued region before ignoring it. */
|
|
28
|
+
const SNAPSHOT_WAIT_MS = 48;
|
|
29
|
+
/** How long a ready below-the-fold island holds for a viewport island still loading its module. */
|
|
30
|
+
const HOLD_FOR_VIEWPORT_MS = 1e3;
|
|
31
|
+
const pending = [];
|
|
32
|
+
let draining = false;
|
|
33
|
+
/** Connect-order stamp per region — document order at upgrade, insertion order after a morph. */
|
|
34
|
+
const order_of = /* @__PURE__ */ new WeakMap();
|
|
35
|
+
let next_order = 0;
|
|
36
|
+
/** The snapshot: intersecting now? Absent = the observer has not reported yet. */
|
|
37
|
+
const in_viewport = /* @__PURE__ */ new WeakMap();
|
|
38
|
+
const unobserve_of = /* @__PURE__ */ new WeakMap();
|
|
39
|
+
/** Regions whose hydrate has STARTED (module in flight) and not yet taken its turn. */
|
|
40
|
+
const loading = /* @__PURE__ */ new Set();
|
|
41
|
+
let wait_timer = null;
|
|
42
|
+
/**
|
|
43
|
+
* Yield to the event loop: resolves in a NEW task, so whatever ran before is a finished task and
|
|
44
|
+
* the browser may render and handle input in between. `scheduler.yield()` where it exists (it
|
|
45
|
+
* keeps the continuation at the current task's priority); else a message hop — a `MessageChannel`
|
|
46
|
+
* post lands as a task without the 4 ms clamp `setTimeout` carries.
|
|
47
|
+
*/
|
|
48
|
+
let channel = null;
|
|
49
|
+
const hops = [];
|
|
50
|
+
function yield_task() {
|
|
51
|
+
const s = globalThis.scheduler;
|
|
52
|
+
if (s && typeof s.yield === "function") return s.yield();
|
|
53
|
+
return new Promise((resolve) => {
|
|
54
|
+
if (!channel) {
|
|
55
|
+
channel = new MessageChannel();
|
|
56
|
+
channel.port1.onmessage = () => hops.shift()?.();
|
|
57
|
+
}
|
|
58
|
+
hops.push(resolve);
|
|
59
|
+
channel.port2.postMessage(null);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Run `fn` at background priority, off the current task: `scheduler.postTask` at 'background' where
|
|
64
|
+
* it exists, else a macrotask. This orders MAIN-THREAD work only — it lets a pending render or input
|
|
65
|
+
* task go first. It does not hold back the network: while the page's resources download the main
|
|
66
|
+
* thread is idle, so a background task runs at once and an `import()` it starts competes with them.
|
|
67
|
+
* Holding island code back until the page has painted is `after_document_painted`'s job.
|
|
68
|
+
*/
|
|
69
|
+
function background_start(fn) {
|
|
70
|
+
background_queue.push(fn);
|
|
71
|
+
if (!background_armed) {
|
|
72
|
+
background_armed = true;
|
|
73
|
+
post_background(drain_background);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const background_queue = [];
|
|
77
|
+
let background_armed = false;
|
|
78
|
+
/** a drain yields to the page after this long, and continues in a new background task */
|
|
79
|
+
const BACKGROUND_BUDGET_MS = 30;
|
|
80
|
+
function drain_background() {
|
|
81
|
+
const until = performance.now() + BACKGROUND_BUDGET_MS;
|
|
82
|
+
let i = 0;
|
|
83
|
+
try {
|
|
84
|
+
while (i < background_queue.length) {
|
|
85
|
+
background_queue[i++]();
|
|
86
|
+
if (performance.now() >= until) break;
|
|
87
|
+
}
|
|
88
|
+
} finally {
|
|
89
|
+
background_queue.splice(0, i);
|
|
90
|
+
if (background_queue.length) post_background(drain_background);
|
|
91
|
+
else background_armed = false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function post_background(fn) {
|
|
95
|
+
const s = globalThis.scheduler;
|
|
96
|
+
if (s && typeof s.postTask === "function") try {
|
|
97
|
+
s.postTask(fn, { priority: "background" });
|
|
98
|
+
return;
|
|
99
|
+
} catch {}
|
|
100
|
+
setTimeout(fn, 0);
|
|
101
|
+
}
|
|
102
|
+
let document_painted = null;
|
|
103
|
+
/**
|
|
104
|
+
* Resolves once the document is parsed AND painted: after `DOMContentLoaded`, then one rendered
|
|
105
|
+
* frame. This is the moment SvelteKit starts hydrating (its start runs from a deferred module
|
|
106
|
+
* script, so never before DOMContentLoaded), and an island's wake starts no earlier: the runtime
|
|
107
|
+
* boots from a module script that runs BEFORE DOMContentLoaded — the app's other deferred scripts
|
|
108
|
+
* may still be executing and the first paint (and its LCP image) not yet happened — and an island
|
|
109
|
+
* `import()` started there takes bandwidth from both.
|
|
110
|
+
*
|
|
111
|
+
* `readyState` cannot tell "DOMContentLoaded fired" from "about to fire" (it reads `interactive` for
|
|
112
|
+
* both), so the navigation timing entry decides; `load` backs up the listener where there is none.
|
|
113
|
+
* A hidden document paints no frame (`requestAnimationFrame` never fires there) — nothing to protect,
|
|
114
|
+
* so it waits one task instead. Once resolved it stays resolved: a late region (SPA swap, a hole's
|
|
115
|
+
* answer) passes straight through.
|
|
116
|
+
*/
|
|
117
|
+
function after_document_painted() {
|
|
118
|
+
return document_painted ??= new Promise((resolve) => {
|
|
119
|
+
if (typeof document === "undefined") return resolve();
|
|
120
|
+
const painted = () => {
|
|
121
|
+
if (document.visibilityState === "hidden" || typeof requestAnimationFrame !== "function") setTimeout(resolve, 0);
|
|
122
|
+
else requestAnimationFrame(() => setTimeout(resolve, 0));
|
|
123
|
+
};
|
|
124
|
+
if (dom_content_loaded()) return painted();
|
|
125
|
+
let done = false;
|
|
126
|
+
const once = () => {
|
|
127
|
+
if (done) return;
|
|
128
|
+
done = true;
|
|
129
|
+
document.removeEventListener("DOMContentLoaded", once);
|
|
130
|
+
removeEventListener("load", once);
|
|
131
|
+
painted();
|
|
132
|
+
};
|
|
133
|
+
document.addEventListener("DOMContentLoaded", once);
|
|
134
|
+
addEventListener("load", once);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function dom_content_loaded() {
|
|
138
|
+
if (document.readyState === "complete") return true;
|
|
139
|
+
if (document.readyState === "loading") return false;
|
|
140
|
+
const nav = typeof performance !== "undefined" && performance.getEntriesByType?.("navigation")[0];
|
|
141
|
+
return !!nav && nav.domContentLoadedEventEnd > 0;
|
|
142
|
+
}
|
|
143
|
+
/** Test seam: forget the resolved gate (a test that fakes a fresh document). */
|
|
144
|
+
function reset_document_painted() {
|
|
145
|
+
document_painted = null;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Register a region with the scheduler at connect: stamp its order, start its viewport snapshot.
|
|
149
|
+
* Cheap on purpose (a stamp and an `observe`) — connect runs for every region in one task.
|
|
150
|
+
*/
|
|
151
|
+
function register_region(el) {
|
|
152
|
+
if (!order_of.has(el)) order_of.set(el, next_order++);
|
|
153
|
+
if (unobserve_of.has(el)) return;
|
|
154
|
+
unobserve_of.set(el, observe(el, "0px", (intersecting) => {
|
|
155
|
+
in_viewport.set(el, intersecting);
|
|
156
|
+
if (pending.length) schedule_drain();
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Drop a region from the scheduler (disconnect): its snapshot stops and any pending turn is handed
|
|
161
|
+
* out at once — the waiting hydrate step then sees `isConnected === false` and stands down (or, if
|
|
162
|
+
* the element was re-attached meanwhile, runs — exactly what an un-scheduled wait would have done).
|
|
163
|
+
*/
|
|
164
|
+
function unregister_region(el) {
|
|
165
|
+
stop_snapshot(el);
|
|
166
|
+
in_viewport.delete(el);
|
|
167
|
+
loading.delete(el);
|
|
168
|
+
for (let i = pending.length - 1; i >= 0; i--) {
|
|
169
|
+
if (pending[i].el !== el) continue;
|
|
170
|
+
const [turn] = pending.splice(i, 1);
|
|
171
|
+
turn.resolve();
|
|
172
|
+
}
|
|
173
|
+
if (pending.length) schedule_drain();
|
|
174
|
+
}
|
|
175
|
+
function stop_snapshot(el) {
|
|
176
|
+
unobserve_of.get(el)?.();
|
|
177
|
+
unobserve_of.delete(el);
|
|
178
|
+
}
|
|
179
|
+
/** The island's module is in flight: a viewport island here holds ready islands below the fold. */
|
|
180
|
+
function hydrate_started(el) {
|
|
181
|
+
loading.add(el);
|
|
182
|
+
}
|
|
183
|
+
/** The hydrate attempt is over (turn taken, or it never got there — no entry, a failed import). */
|
|
184
|
+
function hydrate_settled(el) {
|
|
185
|
+
if (!loading.delete(el)) return;
|
|
186
|
+
if (pending.length) schedule_drain();
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Wait for this region's turn. Resolves in a task of its own, after every region ahead of it in
|
|
190
|
+
* priority has had its task. Call it when the island can hydrate right now (module loaded) — the
|
|
191
|
+
* continuation after the `await` IS the turn: keep the whole synchronous hydrate step in it.
|
|
192
|
+
*/
|
|
193
|
+
function hydrate_turn(el) {
|
|
194
|
+
return new Promise((resolve) => {
|
|
195
|
+
pending.push({
|
|
196
|
+
el,
|
|
197
|
+
order: order_of.get(el) ?? (order_of.set(el, next_order), next_order++),
|
|
198
|
+
queued_at: now(),
|
|
199
|
+
resolve
|
|
200
|
+
});
|
|
201
|
+
schedule_drain();
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function now() {
|
|
205
|
+
return typeof performance !== "undefined" && performance.now ? performance.now() : Date.now();
|
|
206
|
+
}
|
|
207
|
+
function schedule_drain() {
|
|
208
|
+
if (draining) return;
|
|
209
|
+
draining = true;
|
|
210
|
+
yield_task().then(drain);
|
|
211
|
+
}
|
|
212
|
+
/** Re-drain after `ms` (one timer at a time — the earliest wait wins, later ones ride it). */
|
|
213
|
+
function drain_after(ms) {
|
|
214
|
+
if (wait_timer) return;
|
|
215
|
+
wait_timer = setTimeout(() => {
|
|
216
|
+
wait_timer = null;
|
|
217
|
+
schedule_drain();
|
|
218
|
+
}, Math.max(1, ms));
|
|
219
|
+
}
|
|
220
|
+
/** One turn per call: pick the best pending region, hand it its task; the next pick after a yield. */
|
|
221
|
+
function drain() {
|
|
222
|
+
draining = false;
|
|
223
|
+
if (!pending.length) return;
|
|
224
|
+
const t = now();
|
|
225
|
+
const hidden = typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
226
|
+
if (!hidden) for (const p of pending) {
|
|
227
|
+
if (in_viewport.has(p.el)) continue;
|
|
228
|
+
const left = SNAPSHOT_WAIT_MS - (t - p.queued_at);
|
|
229
|
+
if (left > 0) return drain_after(left);
|
|
230
|
+
}
|
|
231
|
+
let best = 0;
|
|
232
|
+
for (let i = 1; i < pending.length; i++) {
|
|
233
|
+
const a = pending[best];
|
|
234
|
+
const b = pending[i];
|
|
235
|
+
const va = in_viewport.get(a.el) === true;
|
|
236
|
+
const vb = in_viewport.get(b.el) === true;
|
|
237
|
+
if (vb !== va ? vb : b.order < a.order) best = i;
|
|
238
|
+
}
|
|
239
|
+
const turn = pending[best];
|
|
240
|
+
if (!hidden && in_viewport.get(turn.el) !== true) {
|
|
241
|
+
const left = HOLD_FOR_VIEWPORT_MS - (t - turn.queued_at);
|
|
242
|
+
if (left > 0) {
|
|
243
|
+
for (const el of loading) if (in_viewport.get(el) === true) return drain_after(left);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
pending.splice(best, 1);
|
|
247
|
+
loading.delete(turn.el);
|
|
248
|
+
stop_snapshot(turn.el);
|
|
249
|
+
turn.resolve();
|
|
250
|
+
if (pending.length) schedule_drain();
|
|
251
|
+
}
|
|
252
|
+
/** Test seam: is a hydration turn queued or being drained right now? */
|
|
253
|
+
function schedule_idle() {
|
|
254
|
+
return pending.length === 0 && !draining;
|
|
255
|
+
}
|
|
256
|
+
export { after_document_painted, background_start, hydrate_settled, hydrate_started, hydrate_turn, register_region, reset_document_painted, schedule_idle, unregister_region, yield_task };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PageSnapshot } from "../shims/page-store.svelte.js";
|
|
2
|
+
export declare const PAGE_SEED_SELECTOR = "script[type=\"application/ogygia-page\"]";
|
|
3
|
+
/** A seed or props script's payload, in its lane (wire-format.ts): JSON when the server marked
|
|
4
|
+
* it plain, devalue with `revivers` otherwise. Every seed / props read goes through here. */
|
|
5
|
+
export declare function parse_sidecar_text(el: Element, revivers?: Record<string, (d: never) => unknown>): unknown;
|
|
6
|
+
type PageSeed = Partial<Omit<PageSnapshot, "url"> & {
|
|
7
|
+
url: string | URL;
|
|
8
|
+
}>;
|
|
9
|
+
/** Test seam: how many page-seed scripts were parsed since boot (one per document is the law). */
|
|
10
|
+
export declare function seed_parse_count(): number;
|
|
11
|
+
/**
|
|
12
|
+
* The parsed seed of a document that is NOT the live one (a navigation's incoming document): parsed
|
|
13
|
+
* on first ask, remembered on the document. The router asks in its preflight (off the view
|
|
14
|
+
* transition's critical path); the soft-invalidate and any kept island's props absorb reuse it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function page_seed_of(doc: Document): PageSeed | null;
|
|
17
|
+
/**
|
|
18
|
+
* The `data` a seed reference resolves against: the live page store for the live document (seeded
|
|
19
|
+
* on first ask), the once-parsed seed for a foreign one. `undefined` when the document has no seed.
|
|
20
|
+
*/
|
|
21
|
+
export declare function seed_data_of(doc: Document): unknown;
|
|
22
|
+
export declare function seed_remote_once(): void;
|
|
23
|
+
/** Document-level page seed (one script from ogygiaHandle) — once per document; then any page facts
|
|
24
|
+
* an answer brought since. Every hydrate calls it, before the island reads `page`. */
|
|
25
|
+
export declare function seed_page_once(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Soft invalidate: refresh document-level page + remote **seeds** from a fetched HTML document
|
|
28
|
+
* without replacing `<body>`, remounting islands, or clearing live query/live instance maps. The
|
|
29
|
+
* router runs it on every navigation (before the body morph — seeds first, DOM second) and
|
|
30
|
+
* `invalidateAll` runs it alone, so Kit remote `form()` success does not view-transition wipe live
|
|
31
|
+
* island state. It is the ONLY seed writer on a navigation and marks the document seeded, so the
|
|
32
|
+
* next island to wake never re-parses. Does **not** auto-refresh live queries — callers that need
|
|
33
|
+
* that use `.refresh()`, or `submit().updates(q)` with server `requested(q).refreshAll()`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function apply_soft_invalidate_doc(doc: Document): void;
|
|
36
|
+
/**
|
|
37
|
+
* Reset per-document session + SSR remote seeds before a new body connects.
|
|
38
|
+
*
|
|
39
|
+
* Do **not** clear `query_map` / `live_query_map` here — old islands are still mounted, and Kit's
|
|
40
|
+
* LiveQueryProxy throws if its cache entry vanishes mid-render. Instance sweep happens in
|
|
41
|
+
* {@link finish_spa_document} after the swap.
|
|
42
|
+
*/
|
|
43
|
+
export declare function prepare_spa_document(): void;
|
|
44
|
+
/**
|
|
45
|
+
* After the body swap: old islands have disconnected; new ones have only queued their hydrate.
|
|
46
|
+
* Sweep Kit query/live instance maps so the next page cannot reuse a LiveQuery whose `#start` is
|
|
47
|
+
* already spent (`once`) — that reuse never opens SSE again and leaves "connecting…".
|
|
48
|
+
*/
|
|
49
|
+
export declare function finish_spa_document(): void;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { parse_wire_text, wire_is_json } from "./wire-format.js";
|
|
2
|
+
import { page_state, reset_page, set_page } from "../shims/page-store.svelte.js";
|
|
3
|
+
import { kit_bridge } from "../shims/kit-bridge.js";
|
|
4
|
+
import { install_page_defer, page_defer_revivers } from "./page-defer.js";
|
|
5
|
+
import { transport_decoders } from "./app-transport.js";
|
|
6
|
+
import { boot_link, slots } from "./slots.js";
|
|
7
|
+
// src/runtime/seeds.ts
|
|
8
|
+
/**
|
|
9
|
+
* THE PAGE SEED on the client — parsed ONCE per document, kept in ONE place.
|
|
10
|
+
*
|
|
11
|
+
* The handle ships `page.data` (and url/params/route/…) as `<script type="application/ogygia-page">`
|
|
12
|
+
* so islands can read `$page`, and a seed REFERENCE in an island's props (`seed-refs.ts`) points into
|
|
13
|
+
* that same tree. Both readers resolve here:
|
|
14
|
+
* • the LIVE document's seed is `page_state` — the `$app/state` store the shims already read. It is
|
|
15
|
+
* parsed once (`seed_page_once`, lazily on the first hydrate) and every seed reference resolves
|
|
16
|
+
* against `page_state.data` — the exact object the islands' `page.data` is, not a second parse.
|
|
17
|
+
* • a FOREIGN document (the one a navigation fetched) is parsed once per `Document` and remembered
|
|
18
|
+
* on it: a kept island absorbs the incoming page's props BEFORE the router applies that page's
|
|
19
|
+
* seed, so its references must resolve against the incoming seed, not the current one. The
|
|
20
|
+
* navigation's soft-invalidate then applies the SAME parse — never a second one.
|
|
21
|
+
* A parse count of one per document is what `test/browser/seed-single-parse.test.ts` pins; the old
|
|
22
|
+
* two-cache shape (a per-element cache the morph reused across pages) handed a navigated page the
|
|
23
|
+
* previous page's data — the stale-reference regression that test also carries.
|
|
24
|
+
*
|
|
25
|
+
* WIRE FORMATS: a seed or props script carries `data-og-format="json"` when its payload is plain
|
|
26
|
+
* JSON (no custom types, no seed references) — then it is `JSON.parse`d, nothing else. Without the
|
|
27
|
+
* attribute it is devalue text and parses with the revivers the caller hands in. One helper
|
|
28
|
+
* (`parse_sidecar_text`) is the only place that decision is made.
|
|
29
|
+
*
|
|
30
|
+
* After a successful parse the seed's TEXT is blanked (router on, devtools off): the graph lives in
|
|
31
|
+
* `page_state` from here on and nothing reads the script again — 690 KB of text on a CMS page has
|
|
32
|
+
* no second reader, and the morph carries the next page's seed in (already blank, parsed in the
|
|
33
|
+
* navigation's preflight). Devtools keeps the text: its byte ledger reads it. A props SIDECAR is
|
|
34
|
+
* never blanked: a region can read it again — an island moved by its host's snippet adoption
|
|
35
|
+
* disconnects, reconnects and hydrates anew (the island-children shape).
|
|
36
|
+
*/
|
|
37
|
+
const session = () => boot_link().runtime_session;
|
|
38
|
+
const DEVTOOLS = typeof __OGYGIA_DEVTOOLS__ !== "undefined" ? __OGYGIA_DEVTOOLS__ : false;
|
|
39
|
+
const PAGE_SEED_SELECTOR = "script[type=\"application/ogygia-page\"]";
|
|
40
|
+
const REMOTE_SEED_SELECTOR = "script[type=\"application/ogygia-remote\"]";
|
|
41
|
+
/** A seed or props script's payload, in its lane (wire-format.ts): JSON when the server marked
|
|
42
|
+
* it plain, devalue with `revivers` otherwise. Every seed / props read goes through here. */
|
|
43
|
+
function parse_sidecar_text(el, revivers) {
|
|
44
|
+
return parse_wire_text(el.textContent ?? "", wire_is_json(el), revivers);
|
|
45
|
+
}
|
|
46
|
+
let parses = 0;
|
|
47
|
+
/** Test seam: how many page-seed scripts were parsed since boot (one per document is the law). */
|
|
48
|
+
function seed_parse_count() {
|
|
49
|
+
return parses;
|
|
50
|
+
}
|
|
51
|
+
/** Parse one page-seed script; `null` when malformed. Blanks the text once parsed (see above). */
|
|
52
|
+
function parse_page_seed(el) {
|
|
53
|
+
parses++;
|
|
54
|
+
try {
|
|
55
|
+
install_page_defer(transport_decoders);
|
|
56
|
+
const raw = parse_sidecar_text(el, page_defer_revivers(transport_decoders));
|
|
57
|
+
if (slots.nav && !DEVTOOLS) el.textContent = "";
|
|
58
|
+
return raw;
|
|
59
|
+
} catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Feed a parsed seed into the `$app/state` page store (the devalue href string becomes a `URL`). */
|
|
64
|
+
function apply_page_seed(raw) {
|
|
65
|
+
if (!raw) return;
|
|
66
|
+
let url;
|
|
67
|
+
if (raw.url instanceof URL) url = raw.url;
|
|
68
|
+
else if (typeof raw.url === "string") try {
|
|
69
|
+
url = new URL(raw.url);
|
|
70
|
+
} catch {
|
|
71
|
+
url = void 0;
|
|
72
|
+
}
|
|
73
|
+
set_page({
|
|
74
|
+
...raw,
|
|
75
|
+
url
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/** Foreign (fetched) documents' seeds, one parse per `Document`. */
|
|
79
|
+
const foreign_seeds = /* @__PURE__ */ new WeakMap();
|
|
80
|
+
/**
|
|
81
|
+
* The parsed seed of a document that is NOT the live one (a navigation's incoming document): parsed
|
|
82
|
+
* on first ask, remembered on the document. The router asks in its preflight (off the view
|
|
83
|
+
* transition's critical path); the soft-invalidate and any kept island's props absorb reuse it.
|
|
84
|
+
*/
|
|
85
|
+
function page_seed_of(doc) {
|
|
86
|
+
const hit = foreign_seeds.get(doc);
|
|
87
|
+
if (hit !== void 0) return hit;
|
|
88
|
+
const el = doc.querySelector(PAGE_SEED_SELECTOR);
|
|
89
|
+
const seed = el ? parse_page_seed(el) : null;
|
|
90
|
+
foreign_seeds.set(doc, seed);
|
|
91
|
+
return seed;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The `data` a seed reference resolves against: the live page store for the live document (seeded
|
|
95
|
+
* on first ask), the once-parsed seed for a foreign one. `undefined` when the document has no seed.
|
|
96
|
+
*/
|
|
97
|
+
function seed_data_of(doc) {
|
|
98
|
+
if (typeof document !== "undefined" && doc === document) {
|
|
99
|
+
seed_page_once();
|
|
100
|
+
return page_state.data;
|
|
101
|
+
}
|
|
102
|
+
return page_seed_of(doc)?.data;
|
|
103
|
+
}
|
|
104
|
+
/** Apply `application/ogygia-remote` text into the reused Kit query seed bag. */
|
|
105
|
+
function apply_remote_seed_text(text) {
|
|
106
|
+
if (!text) return;
|
|
107
|
+
slots.remoteSeeds?.seed_query_responses(text);
|
|
108
|
+
}
|
|
109
|
+
function seed_remote_once() {
|
|
110
|
+
if (session().remote_seeded) return;
|
|
111
|
+
session().mark_remote_seeded();
|
|
112
|
+
if (typeof document === "undefined") return;
|
|
113
|
+
apply_remote_seed_text(document.querySelector(REMOTE_SEED_SELECTOR)?.textContent);
|
|
114
|
+
}
|
|
115
|
+
/** Document-level page seed (one script from ogygiaHandle) — once per document; then any page facts
|
|
116
|
+
* an answer brought since. Every hydrate calls it, before the island reads `page`. */
|
|
117
|
+
function seed_page_once() {
|
|
118
|
+
if (!session().page_seeded) {
|
|
119
|
+
session().mark_page_seeded();
|
|
120
|
+
if (typeof document === "undefined") return;
|
|
121
|
+
const el = document.querySelector(PAGE_SEED_SELECTOR);
|
|
122
|
+
if (el) apply_page_seed(parse_page_seed(el));
|
|
123
|
+
}
|
|
124
|
+
if (session().page_facts.length) absorb_page_facts();
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* ONE PAGE, NOT TWO (server/render-page.ts): an answer rendered outside its page — a hole, a region a
|
|
128
|
+
* remote call refreshed — carries the `page.data` keys its islands read, as the server just looked
|
|
129
|
+
* them up. They join the page store before those islands wake, so the islands hydrate against the
|
|
130
|
+
* values their HTML was rendered from, and every island reading the same keys sees them too (the
|
|
131
|
+
* page's data changed: a locale saved, a sign-in). On a Kit-hydrated page Kit owns `page.data`: the
|
|
132
|
+
* page's data is older than the answer's, and dev says to refresh it (`invalidateAll()`) first.
|
|
133
|
+
*/
|
|
134
|
+
function absorb_page_facts() {
|
|
135
|
+
const queued = session().page_facts.splice(0);
|
|
136
|
+
let merged = null;
|
|
137
|
+
for (const text of queued) {
|
|
138
|
+
let facts;
|
|
139
|
+
try {
|
|
140
|
+
facts = parse_wire_text(text, false, transport_decoders);
|
|
141
|
+
} catch {
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (!facts || typeof facts !== "object") continue;
|
|
145
|
+
merged = merged ? Object.assign(merged, facts) : { ...facts };
|
|
146
|
+
}
|
|
147
|
+
if (!merged) return;
|
|
148
|
+
const kit = kit_bridge();
|
|
149
|
+
if (kit) {
|
|
150
|
+
if (import.meta.env.DEV) {
|
|
151
|
+
const data = kit.page.data ?? {};
|
|
152
|
+
const older = Object.keys(merged).filter((k) => data[k] !== merged[k] && JSON.stringify(data[k]) !== JSON.stringify(merged[k]));
|
|
153
|
+
if (older.length) console.warn(`[ogygia] a region came back rendered with newer page.data (${older.join(", ")}) than this Kit page holds. Refresh the page's data (invalidateAll()) before refreshing the region, or the islands inside it hydrate against the older values.`);
|
|
154
|
+
}
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
set_page({
|
|
158
|
+
url: page_state.url,
|
|
159
|
+
params: page_state.params,
|
|
160
|
+
route: page_state.route,
|
|
161
|
+
status: page_state.status,
|
|
162
|
+
data: {
|
|
163
|
+
...page_state.data,
|
|
164
|
+
...merged
|
|
165
|
+
},
|
|
166
|
+
form: page_state.form,
|
|
167
|
+
error: page_state.error,
|
|
168
|
+
state: page_state.state
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Soft invalidate: refresh document-level page + remote **seeds** from a fetched HTML document
|
|
173
|
+
* without replacing `<body>`, remounting islands, or clearing live query/live instance maps. The
|
|
174
|
+
* router runs it on every navigation (before the body morph — seeds first, DOM second) and
|
|
175
|
+
* `invalidateAll` runs it alone, so Kit remote `form()` success does not view-transition wipe live
|
|
176
|
+
* island state. It is the ONLY seed writer on a navigation and marks the document seeded, so the
|
|
177
|
+
* next island to wake never re-parses. Does **not** auto-refresh live queries — callers that need
|
|
178
|
+
* that use `.refresh()`, or `submit().updates(q)` with server `requested(q).refreshAll()`.
|
|
179
|
+
*/
|
|
180
|
+
function apply_soft_invalidate_doc(doc) {
|
|
181
|
+
if (typeof document === "undefined") return;
|
|
182
|
+
slots.remoteSeeds?.clear_remote_seeds();
|
|
183
|
+
apply_remote_seed_text(doc.querySelector(REMOTE_SEED_SELECTOR)?.textContent);
|
|
184
|
+
session().mark_remote_seeded();
|
|
185
|
+
apply_page_seed(page_seed_of(doc));
|
|
186
|
+
session().mark_page_seeded();
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Reset per-document session + SSR remote seeds before a new body connects.
|
|
190
|
+
*
|
|
191
|
+
* Do **not** clear `query_map` / `live_query_map` here — old islands are still mounted, and Kit's
|
|
192
|
+
* LiveQueryProxy throws if its cache entry vanishes mid-render. Instance sweep happens in
|
|
193
|
+
* {@link finish_spa_document} after the swap.
|
|
194
|
+
*/
|
|
195
|
+
function prepare_spa_document() {
|
|
196
|
+
session().reset();
|
|
197
|
+
slots.remoteSeeds?.clear_remote_seeds();
|
|
198
|
+
reset_page();
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* After the body swap: old islands have disconnected; new ones have only queued their hydrate.
|
|
202
|
+
* Sweep Kit query/live instance maps so the next page cannot reuse a LiveQuery whose `#start` is
|
|
203
|
+
* already spent (`once`) — that reuse never opens SSE again and leaves "connecting…".
|
|
204
|
+
*/
|
|
205
|
+
function finish_spa_document() {
|
|
206
|
+
slots.remoteSeeds?.clear_remote_instances();
|
|
207
|
+
}
|
|
208
|
+
export { PAGE_SEED_SELECTOR, apply_soft_invalidate_doc, finish_spa_document, page_seed_of, parse_sidecar_text, prepare_spa_document, seed_data_of, seed_page_once, seed_parse_count, seed_remote_once };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ConcurrencyGate } from "./concurrency.js";
|
|
2
|
+
/** Cached SSR DOM (+ optional SWR endpoint) for `{#if}` remount of hydrate:none regions.
|
|
3
|
+
* Keyed by lake entry id — size is O(unique lakes on the page), not O(toggles).
|
|
4
|
+
* Cleared on SPA body swap via `reset()`. SWR refresh replaces the entry (does not grow). */
|
|
5
|
+
export type LakeCacheEntry = {
|
|
6
|
+
frag: Node;
|
|
7
|
+
endpoint: string;
|
|
8
|
+
when: string;
|
|
9
|
+
/** `Date.now()` when this entry was first cached or last successfully revalidated. */
|
|
10
|
+
cachedAt: number;
|
|
11
|
+
/** Client TTL in ms; `0` = no expiry. */
|
|
12
|
+
maxAgeMs: number;
|
|
13
|
+
};
|
|
14
|
+
export declare class RuntimeSession {
|
|
15
|
+
#private;
|
|
16
|
+
/** Page-owned head nodes (see above). Survives `reset()`: it is the document's, not a page's. */
|
|
17
|
+
readonly page_head: WeakSet<Node>;
|
|
18
|
+
/** Island-owned head ELEMENTS still to watch (pruned when they leave the document). */
|
|
19
|
+
readonly island_head: Set<Element>;
|
|
20
|
+
/** Mark a node this document's page owns (the router / runtime inserted it for the page). */
|
|
21
|
+
claim_page_head(node: Node): void;
|
|
22
|
+
/** At boot: everything already in <head> came from the server — the page owns it. */
|
|
23
|
+
adopt_document_head(): void;
|
|
24
|
+
/** After an island's hydrate: the head elements it added (not in `before`, not page-owned) are
|
|
25
|
+
* that island's; then retire the page's copies of them. */
|
|
26
|
+
record_island_head(before: ReadonlySet<Node>): void;
|
|
27
|
+
/**
|
|
28
|
+
* Remove every PAGE-owned head element that duplicates a live island-owned one (same markup), and
|
|
29
|
+
* the page's `<title>` once an island renders its own (the browser honours the first title, and
|
|
30
|
+
* the island's is the reactive one). Runs after an island hydrates and after a navigation merge.
|
|
31
|
+
*/
|
|
32
|
+
retire_page_head_copies(): void;
|
|
33
|
+
readonly lake_cache: Map<string, LakeCacheEntry>;
|
|
34
|
+
readonly settled_lakes: WeakSet<Element>;
|
|
35
|
+
readonly initialized_lakes: Set<string>;
|
|
36
|
+
readonly server_gate: ConcurrencyGate;
|
|
37
|
+
/** The page facts answers rendered with (server/render-page.ts), queued at the answer seam
|
|
38
|
+
* (`region_fragment`) for the next hydrate to merge into the page store (seeds.ts). */
|
|
39
|
+
readonly page_facts: string[];
|
|
40
|
+
get remote_seeded(): boolean;
|
|
41
|
+
mark_remote_seeded(): void;
|
|
42
|
+
get page_seeded(): boolean;
|
|
43
|
+
mark_page_seeded(): void;
|
|
44
|
+
get kit_page(): boolean | undefined;
|
|
45
|
+
set kit_page(v: boolean | undefined);
|
|
46
|
+
/** Insert/replace a lake cache entry; evict oldest if over LAKE_CACHE_MAX. */
|
|
47
|
+
set_lake_cache(id: string, entry: LakeCacheEntry): void;
|
|
48
|
+
settle_lakes_in(root: ParentNode): void;
|
|
49
|
+
reset(): void;
|
|
50
|
+
}
|
|
51
|
+
/** Process-wide session for the islands runtime (one client module graph). */
|
|
52
|
+
export declare const runtime_session: RuntimeSession;
|