@ogygia/core 0.0.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/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 +185 -0
- package/dist/compiler/ctx.js +203 -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,66 @@
|
|
|
1
|
+
// src/server/remote-seed-gate.ts
|
|
2
|
+
/**
|
|
3
|
+
* REMOTE SEED ONLY WHEN REACHABLE — the handle's per-remote decision when it builds the
|
|
4
|
+
* `application/ogygia-remote` seed: does any region rendered on this page have client code that
|
|
5
|
+
* can call this remote? The seed exists so a hydrating island that re-runs the same query resolves
|
|
6
|
+
* it from the document (zero-flash, no re-fetch). A remote no island on the page imports — a lake
|
|
7
|
+
* or a page script awaiting a query for its own server render — has no such reader, and its
|
|
8
|
+
* result is pure download weight (a CMS footer entry: 12.5 KB, measured).
|
|
9
|
+
*
|
|
10
|
+
* `wanted` is the union of every rendered region's `islandRemotes(entry)` (Region.svelte →
|
|
11
|
+
* page-seed-registry → the request bag): Kit id-hashes, the prefix of a remote's `internals.id`
|
|
12
|
+
* (`${hash}/${name}`). `null` = some region answered fail-open ("may call anything": a promise `of`,
|
|
13
|
+
* an entry the build handoff does not know, dev) → every remote seeds, exactly as before the gate.
|
|
14
|
+
* Pure, so it is unit-tested on its own.
|
|
15
|
+
*/
|
|
16
|
+
function remote_seed_wanted(remote_id, wanted) {
|
|
17
|
+
if (wanted === null) return true;
|
|
18
|
+
const slash = remote_id.indexOf("/");
|
|
19
|
+
if (slash === -1) return true;
|
|
20
|
+
return wanted.has(remote_id.slice(0, slash));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Mirror Kit's OWN seed bucketing (server/remote.js) over the side-channel — Kit only serializes
|
|
24
|
+
* remote data inline when csr===true, so on csr=false pages the handle does it here. Buckets every
|
|
25
|
+
* implicit remote by type: q(query) / p(prerender) / l(query.live) / f(form). Seeding PRERENDER
|
|
26
|
+
* remotes (not only queries) is the fix for the async-island FOUC: a prerender remote awaited inside
|
|
27
|
+
* an island otherwise re-fetches on hydrate, so the component re-renders and Svelte RE-MOUNTS the
|
|
28
|
+
* subtree — a frame of unstyled DOM. With the seed in `prerender_responses`, the client resolves it
|
|
29
|
+
* synchronously and never re-fetches. Keys use `create_remote_key`, exactly like Kit's client.
|
|
30
|
+
*
|
|
31
|
+
* Skips, in order: a PRIVATE remote (no id — must never be serialized), a remote NO REGION'S
|
|
32
|
+
* CLIENT CAN CALL (`wanted`, above), an ERRORED or still-PENDING result (the client fetches it
|
|
33
|
+
* itself; an entry without `v` would hydrate as `undefined`), and a value carrying a BAKED region
|
|
34
|
+
* (`skip_value`: SSR HTML in the ticket — a page body from a `doc`-style remote is a page-sized
|
|
35
|
+
* RENDER the page already rendered; seeding it ships the body twice, ~130 KB/page measured).
|
|
36
|
+
*
|
|
37
|
+
* Pure over what it is handed (the implicit map, the request's memo of results, the two
|
|
38
|
+
* predicates); the handle serializes what comes back. Unit-tested across every permutation.
|
|
39
|
+
*/
|
|
40
|
+
async function collect_remote_seed(implicit, wanted, opts) {
|
|
41
|
+
const data = {
|
|
42
|
+
q: {},
|
|
43
|
+
p: {},
|
|
44
|
+
l: {},
|
|
45
|
+
f: {}
|
|
46
|
+
};
|
|
47
|
+
for (const [internals, record] of implicit) {
|
|
48
|
+
if (!internals.id) continue;
|
|
49
|
+
if (!remote_seed_wanted(internals.id, wanted)) continue;
|
|
50
|
+
const type = internals.type;
|
|
51
|
+
const bucket = type === "query_live" ? "l" : type[0];
|
|
52
|
+
if (bucket !== "q" && bucket !== "p" && bucket !== "l" && bucket !== "f") continue;
|
|
53
|
+
for (const payload in record) {
|
|
54
|
+
const remote_key = type === "form" ? payload : opts.key(internals.id, payload);
|
|
55
|
+
const promise = opts.memo?.(internals)?.[payload] ?? record[payload]();
|
|
56
|
+
let resolved = true;
|
|
57
|
+
await Promise.race([Promise.resolve(promise).then((v) => {
|
|
58
|
+
if (resolved && !opts.skip_value?.(v)) data[bucket][remote_key] = { v };
|
|
59
|
+
}, () => {}), Promise.resolve().then(() => {
|
|
60
|
+
resolved = false;
|
|
61
|
+
})]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
export { collect_remote_seed, remote_seed_wanted };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Cache key for a region render — id + props payload + session seal. `exp`/`sig` (which rotate per
|
|
2
|
+
* mint) and `ttl` (a cache-window declaration, not a render input) are DELIBERATELY excluded so
|
|
3
|
+
* two renders of the same region+props+user hit; session is INCLUDED so users never cross. */
|
|
4
|
+
export declare function render_cache_key(id: string, props_payload: string, session: string): string;
|
|
5
|
+
/** Cached HTML for `key`, or null on miss/expiry. A live hit is an LRU touch. */
|
|
6
|
+
export declare function render_cache_get(key: string, now: number): string | null;
|
|
7
|
+
/** Cache `html` for `ttl_sec` seconds. No-op for `ttl_sec <= 0` (dynamic holes are never cached). */
|
|
8
|
+
export declare function render_cache_set(key: string, html: string, ttl_sec: number, now: number): void;
|
|
9
|
+
/** Test/ops hook: drop everything. */
|
|
10
|
+
export declare function render_cache_clear(): void;
|
|
11
|
+
/** Test/ops hook: live entries + resident bytes. */
|
|
12
|
+
export declare function render_cache_stats(): {
|
|
13
|
+
entries: number;
|
|
14
|
+
bytes: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* THE shared cache-fronted render (G2) — the ONE seam both the deferred-region endpoint
|
|
18
|
+
* (#render_component) and the inline-island page render (Region.svelte) call. A hit returns the
|
|
19
|
+
* memo; a miss renders via `render_body()` (the caller supplies it — the endpoint wraps its render
|
|
20
|
+
* in a concurrency gate + timeout, the inline path renders directly), then caches. `cache` is
|
|
21
|
+
* `undefined`/`ttl<=0` for a dynamic hole → always renders, never stores. `now` injected for tests.
|
|
22
|
+
*/
|
|
23
|
+
export declare function cached_render(render_body: () => string | null | Promise<string | null>, cache: {
|
|
24
|
+
key: string;
|
|
25
|
+
ttl: number;
|
|
26
|
+
} | undefined, now: number, report?: (outcome: "hit" | "miss" | "none") => void): Promise<string | null>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { SizedLru } from "./sized-lru.js";
|
|
2
|
+
const store = new SizedLru(67108864, 500);
|
|
3
|
+
/** Cache key for a region render — id + props payload + session seal. `exp`/`sig` (which rotate per
|
|
4
|
+
* mint) and `ttl` (a cache-window declaration, not a render input) are DELIBERATELY excluded so
|
|
5
|
+
* two renders of the same region+props+user hit; session is INCLUDED so users never cross. */
|
|
6
|
+
function render_cache_key(id, props_payload, session) {
|
|
7
|
+
return id + " " + props_payload + " " + session;
|
|
8
|
+
}
|
|
9
|
+
/** Cached HTML for `key`, or null on miss/expiry. A live hit is an LRU touch. */
|
|
10
|
+
function render_cache_get(key, now) {
|
|
11
|
+
return store.get(key, now);
|
|
12
|
+
}
|
|
13
|
+
/** Cache `html` for `ttl_sec` seconds. No-op for `ttl_sec <= 0` (dynamic holes are never cached). */
|
|
14
|
+
function render_cache_set(key, html, ttl_sec, now) {
|
|
15
|
+
if (ttl_sec <= 0) return;
|
|
16
|
+
store.set(key, html, html.length, now + ttl_sec * 1e3);
|
|
17
|
+
}
|
|
18
|
+
/** Test/ops hook: drop everything. */
|
|
19
|
+
function render_cache_clear() {
|
|
20
|
+
store.clear();
|
|
21
|
+
}
|
|
22
|
+
/** Test/ops hook: live entries + resident bytes. */
|
|
23
|
+
function render_cache_stats() {
|
|
24
|
+
return {
|
|
25
|
+
entries: store.size,
|
|
26
|
+
bytes: store.bytes
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* THE shared cache-fronted render (G2) — the ONE seam both the deferred-region endpoint
|
|
31
|
+
* (#render_component) and the inline-island page render (Region.svelte) call. A hit returns the
|
|
32
|
+
* memo; a miss renders via `render_body()` (the caller supplies it — the endpoint wraps its render
|
|
33
|
+
* in a concurrency gate + timeout, the inline path renders directly), then caches. `cache` is
|
|
34
|
+
* `undefined`/`ttl<=0` for a dynamic hole → always renders, never stores. `now` injected for tests.
|
|
35
|
+
*/
|
|
36
|
+
async function cached_render(render_body, cache, now, report) {
|
|
37
|
+
if (cache !== void 0 && cache.ttl > 0) {
|
|
38
|
+
const hit = render_cache_get(cache.key, now);
|
|
39
|
+
if (hit !== null) {
|
|
40
|
+
report?.("hit");
|
|
41
|
+
return hit;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const body = await render_body();
|
|
45
|
+
if (cache !== void 0 && cache.ttl > 0 && body !== null) {
|
|
46
|
+
render_cache_set(cache.key, body, cache.ttl, now);
|
|
47
|
+
report?.("miss");
|
|
48
|
+
} else report?.("none");
|
|
49
|
+
return body;
|
|
50
|
+
}
|
|
51
|
+
export { cached_render, render_cache_clear, render_cache_get, render_cache_key, render_cache_set, render_cache_stats };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { KitPage } from "./kit-context.js";
|
|
2
|
+
import { PageSnapshot } from "../page-seed-registry.js";
|
|
3
|
+
import { SeedAsk } from "./seed-shape.js";
|
|
4
|
+
import { RequestEvent } from "@sveltejs/kit";
|
|
5
|
+
type Transport = Record<string, {
|
|
6
|
+
decode: (v: unknown) => unknown;
|
|
7
|
+
encode: (v: unknown) => unknown;
|
|
8
|
+
}>;
|
|
9
|
+
/** Where a dev warning goes (the handle's setting). */
|
|
10
|
+
export declare function configure_render_page(o: {
|
|
11
|
+
warn: ((message: string) => void) | null;
|
|
12
|
+
}): void;
|
|
13
|
+
/** A request rendering on behalf of a page it is not: the islands endpoint or a remote call. */
|
|
14
|
+
export declare function renders_for_a_page(event: RequestEvent): boolean;
|
|
15
|
+
/** The page a request renders for: the same-origin Referer of a request rendering for a page, else
|
|
16
|
+
* the request's own url. */
|
|
17
|
+
export declare function page_url_of(event: RequestEvent): URL;
|
|
18
|
+
/**
|
|
19
|
+
* Before an async render root starts: in a request rendering FOR a page, that page's facts, looked
|
|
20
|
+
* up once. `reads_data`: does this render read `page.data` (`null`: unknown here — a remote call
|
|
21
|
+
* looks up, a hole relies on its tree's build answer). The venue is the request's kind, as Kit and
|
|
22
|
+
* the islands endpoint name it — never whether some per-request state happens to exist.
|
|
23
|
+
*/
|
|
24
|
+
export declare function prepare_render_page(event: RequestEvent | undefined, transport: Transport | undefined, reads_data: boolean | null): Promise<void> | void;
|
|
25
|
+
/**
|
|
26
|
+
* The page a render sees. `snapshot`: what this request's page render recorded, if anything. `null`
|
|
27
|
+
* when there is neither a snapshot nor a request (a render off-request: the caller's empty page).
|
|
28
|
+
*/
|
|
29
|
+
export declare function render_page(snapshot: PageSnapshot | undefined, event: RequestEvent | undefined): KitPage | null;
|
|
30
|
+
/**
|
|
31
|
+
* A HOLE'S ADDRESS NAMES ITS PAGE: the call (id + props) and the page facts its tree renders from.
|
|
32
|
+
* A region refreshed after the page's data changed (a locale saved) re-mints its holes with a new
|
|
33
|
+
* version, so each fetches its new answer; a refresh that changed nothing keeps the address and the
|
|
34
|
+
* answer it has. The version of this request's page: its looked-up facts (a render for a page) or
|
|
35
|
+
* its recorded snapshot (in the page) — hashed once per request; `''` when there is no data.
|
|
36
|
+
*/
|
|
37
|
+
export declare function render_page_version(event: RequestEvent | undefined, snapshot: PageSnapshot | undefined): string;
|
|
38
|
+
/**
|
|
39
|
+
* An island rendering FOR a page asks for the `page.data` keys its client reads (Region.svelte's
|
|
40
|
+
* record, the build's answer): kept for the answer's facts. `true` when the request renders for a
|
|
41
|
+
* page — the ask is this model's, never a page render's snapshot.
|
|
42
|
+
*/
|
|
43
|
+
export declare function note_render_page_ask(event: RequestEvent, seed: SeedAsk): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* ONE PAGE, NOT TWO: what an answer rendered FOR a page carries — the looked-up `page.data` keys its
|
|
46
|
+
* islands read, so they hydrate against the values their HTML was rendered from (the runtime merges
|
|
47
|
+
* them into the page store: seeds.ts). `''` when no island in it reads the page, the page was not
|
|
48
|
+
* looked up, or a value does not serialize (a still-streaming promise).
|
|
49
|
+
*/
|
|
50
|
+
export declare function render_page_facts_script(event: RequestEvent | undefined, transport: Transport | undefined): string;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { islands_endpoint } from "./endpoint.js";
|
|
2
|
+
import { look_up_page } from "./page-facts.js";
|
|
3
|
+
import { merge_seed_ask, shape_page_data } from "./seed-shape.js";
|
|
4
|
+
import { PAGE_FACTS_SCRIPT_TYPE } from "../page-facts-script.js";
|
|
5
|
+
import * as devalue from "devalue";
|
|
6
|
+
// src/server/render-page.ts
|
|
7
|
+
let warn = null;
|
|
8
|
+
/** Where a dev warning goes (the handle's setting). */
|
|
9
|
+
function configure_render_page(o) {
|
|
10
|
+
warn = o.warn;
|
|
11
|
+
}
|
|
12
|
+
/** A request rendering on behalf of a page it is not: the islands endpoint or a remote call. */
|
|
13
|
+
function renders_for_a_page(event) {
|
|
14
|
+
return event.url.pathname.endsWith(islands_endpoint()) || event.isRemoteRequest === true;
|
|
15
|
+
}
|
|
16
|
+
/** The page a request renders for: the same-origin Referer of a request rendering for a page, else
|
|
17
|
+
* the request's own url. */
|
|
18
|
+
function page_url_of(event) {
|
|
19
|
+
if (!renders_for_a_page(event)) return event.url;
|
|
20
|
+
const referer = event.request.headers.get("referer");
|
|
21
|
+
if (!referer) return event.url;
|
|
22
|
+
try {
|
|
23
|
+
const page = new URL(referer);
|
|
24
|
+
if (page.origin === event.url.origin) return page;
|
|
25
|
+
} catch {}
|
|
26
|
+
return event.url;
|
|
27
|
+
}
|
|
28
|
+
const looked_up = /* @__PURE__ */ new WeakMap();
|
|
29
|
+
const facts_of = /* @__PURE__ */ new WeakMap();
|
|
30
|
+
/**
|
|
31
|
+
* Before an async render root starts: in a request rendering FOR a page, that page's facts, looked
|
|
32
|
+
* up once. `reads_data`: does this render read `page.data` (`null`: unknown here — a remote call
|
|
33
|
+
* looks up, a hole relies on its tree's build answer). The venue is the request's kind, as Kit and
|
|
34
|
+
* the islands endpoint name it — never whether some per-request state happens to exist.
|
|
35
|
+
*/
|
|
36
|
+
function prepare_render_page(event, transport, reads_data) {
|
|
37
|
+
if (!event || !renders_for_a_page(event)) return;
|
|
38
|
+
if (!(reads_data ?? event.isRemoteRequest === true)) return;
|
|
39
|
+
const request = event.request;
|
|
40
|
+
const known = looked_up.get(request);
|
|
41
|
+
if (known) return known;
|
|
42
|
+
const page = page_url_of(event);
|
|
43
|
+
if (page === event.url) return;
|
|
44
|
+
const decoders = {};
|
|
45
|
+
for (const name in transport ?? {}) decoders[name] = transport[name].decode;
|
|
46
|
+
const p = look_up_page(page, event.fetch, decoders).then((facts) => {
|
|
47
|
+
if ("miss" in facts) warn?.(`[ogygia] ${page.pathname}: the page's data for a render outside it is unavailable: ${facts.miss}. The render sees an empty page.data.`);
|
|
48
|
+
else facts_of.set(request, facts);
|
|
49
|
+
});
|
|
50
|
+
looked_up.set(request, p);
|
|
51
|
+
return p;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The page a render sees. `snapshot`: what this request's page render recorded, if anything. `null`
|
|
55
|
+
* when there is neither a snapshot nor a request (a render off-request: the caller's empty page).
|
|
56
|
+
*/
|
|
57
|
+
function render_page(snapshot, event) {
|
|
58
|
+
if (!snapshot && !event) return null;
|
|
59
|
+
if (event && renders_for_a_page(event)) {
|
|
60
|
+
const facts = facts_of.get(event.request);
|
|
61
|
+
return {
|
|
62
|
+
url: facts?.url ?? page_url_of(event),
|
|
63
|
+
params: facts?.params ?? {},
|
|
64
|
+
route: facts?.route ?? { id: null },
|
|
65
|
+
status: 200,
|
|
66
|
+
data: facts && warn ? watched_data(facts, warn) : facts?.data ?? {},
|
|
67
|
+
form: null,
|
|
68
|
+
error: null,
|
|
69
|
+
state: {}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const snap = snapshot ?? {};
|
|
73
|
+
return {
|
|
74
|
+
url: snap.url?.href ? new URL(snap.url.href) : event?.url,
|
|
75
|
+
params: snap.params ?? event?.params ?? {},
|
|
76
|
+
route: snap.route ?? { id: event?.route.id ?? null },
|
|
77
|
+
status: snap.status ?? 200,
|
|
78
|
+
data: snap.data ?? {},
|
|
79
|
+
form: snap.form ?? null,
|
|
80
|
+
error: snap.error ?? null,
|
|
81
|
+
state: {}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** Reads a component makes without meaning a page key (Svelte, devalue, a thenable check). */
|
|
85
|
+
const NOT_A_KEY = /* @__PURE__ */ new Set([
|
|
86
|
+
"then",
|
|
87
|
+
"toJSON",
|
|
88
|
+
"constructor",
|
|
89
|
+
"valueOf",
|
|
90
|
+
"toString",
|
|
91
|
+
"$$typeof",
|
|
92
|
+
"nodeType"
|
|
93
|
+
]);
|
|
94
|
+
const warned_keys = /* @__PURE__ */ new WeakMap();
|
|
95
|
+
/**
|
|
96
|
+
* DEV: a render for a page reading a `page.data` key the page's server loads did not produce — most
|
|
97
|
+
* often one a UNIVERSAL load (`+page.ts` / `+layout.ts`) makes, which exists only inside a full page
|
|
98
|
+
* render. Said once per key, naming it, instead of rendering `undefined` silently (a header that
|
|
99
|
+
* comes out "signed out" with no error anywhere).
|
|
100
|
+
*/
|
|
101
|
+
function watched_data(facts, say) {
|
|
102
|
+
return new Proxy(facts.data, { get(target, key, receiver) {
|
|
103
|
+
if (typeof key === "string" && !NOT_A_KEY.has(key) && !(key in target)) {
|
|
104
|
+
let seen = warned_keys.get(facts);
|
|
105
|
+
if (!seen) warned_keys.set(facts, seen = /* @__PURE__ */ new Set());
|
|
106
|
+
if (!seen.has(key)) {
|
|
107
|
+
seen.add(key);
|
|
108
|
+
say(`[ogygia] ${facts.url.pathname}: a region rendered outside its page read page.data.${key}, which this page's server loads do not produce. A key a universal load (+page.ts / +layout.ts) returns exists only inside a full page render: return it from a server load, or pass it as a prop.`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return Reflect.get(target, key, receiver);
|
|
112
|
+
} });
|
|
113
|
+
}
|
|
114
|
+
const versions = /* @__PURE__ */ new WeakMap();
|
|
115
|
+
/**
|
|
116
|
+
* A HOLE'S ADDRESS NAMES ITS PAGE: the call (id + props) and the page facts its tree renders from.
|
|
117
|
+
* A region refreshed after the page's data changed (a locale saved) re-mints its holes with a new
|
|
118
|
+
* version, so each fetches its new answer; a refresh that changed nothing keeps the address and the
|
|
119
|
+
* answer it has. The version of this request's page: its looked-up facts (a render for a page) or
|
|
120
|
+
* its recorded snapshot (in the page) — hashed once per request; `''` when there is no data.
|
|
121
|
+
*/
|
|
122
|
+
function render_page_version(event, snapshot) {
|
|
123
|
+
if (!event) return "";
|
|
124
|
+
const known = versions.get(event.request);
|
|
125
|
+
if (known !== void 0) return known;
|
|
126
|
+
const data = renders_for_a_page(event) ? facts_of.get(event.request)?.data : snapshot?.data;
|
|
127
|
+
let v = "";
|
|
128
|
+
if (data && typeof data === "object") try {
|
|
129
|
+
v = fnv1a(JSON.stringify(data));
|
|
130
|
+
} catch {}
|
|
131
|
+
if (v) versions.set(event.request, v);
|
|
132
|
+
return v;
|
|
133
|
+
}
|
|
134
|
+
/** 32-bit FNV-1a, base36: a version tag, not a security boundary. */
|
|
135
|
+
function fnv1a(text) {
|
|
136
|
+
let h = 2166136261;
|
|
137
|
+
for (let i = 0; i < text.length; i++) {
|
|
138
|
+
h ^= text.charCodeAt(i);
|
|
139
|
+
h = Math.imul(h, 16777619);
|
|
140
|
+
}
|
|
141
|
+
return (h >>> 0).toString(36);
|
|
142
|
+
}
|
|
143
|
+
const asks_of = /* @__PURE__ */ new WeakMap();
|
|
144
|
+
/**
|
|
145
|
+
* An island rendering FOR a page asks for the `page.data` keys its client reads (Region.svelte's
|
|
146
|
+
* record, the build's answer): kept for the answer's facts. `true` when the request renders for a
|
|
147
|
+
* page — the ask is this model's, never a page render's snapshot.
|
|
148
|
+
*/
|
|
149
|
+
function note_render_page_ask(event, seed) {
|
|
150
|
+
if (!renders_for_a_page(event)) return false;
|
|
151
|
+
if (seed !== false) {
|
|
152
|
+
const merged = merge_seed_ask(asks_of.get(event.request) ?? null, seed);
|
|
153
|
+
if (merged) asks_of.set(event.request, merged);
|
|
154
|
+
}
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* ONE PAGE, NOT TWO: what an answer rendered FOR a page carries — the looked-up `page.data` keys its
|
|
159
|
+
* islands read, so they hydrate against the values their HTML was rendered from (the runtime merges
|
|
160
|
+
* them into the page store: seeds.ts). `''` when no island in it reads the page, the page was not
|
|
161
|
+
* looked up, or a value does not serialize (a still-streaming promise).
|
|
162
|
+
*/
|
|
163
|
+
function render_page_facts_script(event, transport) {
|
|
164
|
+
if (!event || !renders_for_a_page(event)) return "";
|
|
165
|
+
const facts = facts_of.get(event.request);
|
|
166
|
+
const keys = asks_of.get(event.request);
|
|
167
|
+
if (!facts || !keys) return "";
|
|
168
|
+
const encoders = {};
|
|
169
|
+
for (const name in transport ?? {}) encoders[name] = transport[name].encode;
|
|
170
|
+
try {
|
|
171
|
+
return `<script type="${PAGE_FACTS_SCRIPT_TYPE}">${devalue.stringify(shape_page_data(facts.data, keys), encoders)}<\/script>`;
|
|
172
|
+
} catch {
|
|
173
|
+
return "";
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
export { configure_render_page, note_render_page_ask, page_url_of, prepare_render_page, render_page, render_page_facts_script, render_page_version, renders_for_a_page };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { region_css_tags } from "./html-scan.js";
|
|
2
|
+
import { kit_page_facts_tail, kit_page_ready, kit_render_context } from "./kit-context.js";
|
|
3
|
+
import { render } from "svelte/server";
|
|
4
|
+
import { islandCss } from "virtual:ogygia/island-deps";
|
|
5
|
+
/** context.ts's LAKE key (`isInLake`), by its global name — context.ts reaches virtual modules. */
|
|
6
|
+
const LAKE_SUBTREE_KEY = Symbol.for("ogygia.lake-subtree");
|
|
7
|
+
async function render_region_html(component, module_url, props) {
|
|
8
|
+
await kit_page_ready();
|
|
9
|
+
const context = kit_render_context();
|
|
10
|
+
context.set(LAKE_SUBTREE_KEY, true);
|
|
11
|
+
const r = await render(component, {
|
|
12
|
+
props,
|
|
13
|
+
context
|
|
14
|
+
});
|
|
15
|
+
let own = "";
|
|
16
|
+
for (const href of islandCss(module_url)) own += "<link rel=\"stylesheet\" href=\"" + href + "\" data-ogygia-region-css>";
|
|
17
|
+
return own + region_css_tags(r.head) + r.body + kit_page_facts_tail();
|
|
18
|
+
}
|
|
19
|
+
export { render_region_html };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OGYGIA'S OWN COST PER REQUEST — what the handle added to a Kit page: the transform's wall time,
|
|
3
|
+
* how many islands' sidecars and hints went to the tail, and the bytes of every side-channel
|
|
4
|
+
* (page seed, remote seed, props tail, fn manifest, context bridge).
|
|
5
|
+
*
|
|
6
|
+
* The handle (hooks.ts) writes one record per page request; the profiler reads it back when it
|
|
7
|
+
* finalizes the request's log entry, so a report can say "ogygia: 4 ms, seed 292 KB, props 131 KB
|
|
8
|
+
* over 21 islands" and a finding can point at an oversized seed. Keyed by the `Request` in a
|
|
9
|
+
* WeakMap — the record dies with the request, nothing is deleted, and the two modules never
|
|
10
|
+
* import each other (hooks.ts imports the profiler lazily; the profiler must not import hooks).
|
|
11
|
+
*
|
|
12
|
+
* DETAIL is opt-in (`set_request_stats_detail`): the profiler turns it on for the length of a
|
|
13
|
+
* recording, and only then does the handle spend anything on the per-island rows, the seed
|
|
14
|
+
* explainer and the hole notes below. Off, a request pays one WeakMap write of the totals.
|
|
15
|
+
*/
|
|
16
|
+
/** One island's row in the report's Islands table. */
|
|
17
|
+
export interface IslandStat {
|
|
18
|
+
fp: string;
|
|
19
|
+
/** the island's source entry (what the handoff keys on) */
|
|
20
|
+
entry: string;
|
|
21
|
+
/** the component's name (Svelte's SSR function name, `ProductCard`); '' when unknown */
|
|
22
|
+
name: string;
|
|
23
|
+
/** the client module URL the region imports: its LOCATION (the content-hashed file served), not
|
|
24
|
+
* its identity (`entry`) */
|
|
25
|
+
module_url: string;
|
|
26
|
+
/** `load` | `idle` | `visible` | `interaction` | a media query */
|
|
27
|
+
wake: string;
|
|
28
|
+
/** the props sidecar as shipped */
|
|
29
|
+
props_bytes: number;
|
|
30
|
+
/** canonical (unreferenced) props size — what the fingerprint hashes */
|
|
31
|
+
canonical_bytes: number;
|
|
32
|
+
/** that canonical text itself, when it is short (≤ 4 KB): the report compares an island across its
|
|
33
|
+
* renders and names the prop that moved its fingerprint */
|
|
34
|
+
canonical?: string;
|
|
35
|
+
/** the sidecar took the JSON lane */
|
|
36
|
+
json: boolean;
|
|
37
|
+
/** the first leaf that kept the props off the JSON lane, when devalue was used */
|
|
38
|
+
culprit: string | null;
|
|
39
|
+
/** seed references written into the sidecar, and the top-level page.data keys they point at */
|
|
40
|
+
refs: number;
|
|
41
|
+
ref_keys: string[];
|
|
42
|
+
/** the module-preload hrefs this island contributed (its JS closure) */
|
|
43
|
+
hints: string[];
|
|
44
|
+
/** what the build saw in the island's components (handlers, $state, bind:, use:) */
|
|
45
|
+
interactivity: IslandInteractivity | null;
|
|
46
|
+
/** how many regions on the page share this fingerprint */
|
|
47
|
+
count: number;
|
|
48
|
+
/** a grouped row (`group_islands`): how many distinct fingerprints it merged */
|
|
49
|
+
variants?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface IslandInteractivity {
|
|
52
|
+
handlers: number;
|
|
53
|
+
state: number;
|
|
54
|
+
effects: number;
|
|
55
|
+
binds: number;
|
|
56
|
+
actions: number;
|
|
57
|
+
/** remote functions its code can call (a query that streams, a form, a command) and `await` in
|
|
58
|
+
* its markup: what changes it after it wakes without a handler of its own (older builds: absent) */
|
|
59
|
+
remotes?: number;
|
|
60
|
+
awaits?: number;
|
|
61
|
+
/** context reads and rune-module imports: state another island can change */
|
|
62
|
+
shared?: number;
|
|
63
|
+
/** `.svelte` files in the island's closure that were scanned */
|
|
64
|
+
files: number;
|
|
65
|
+
}
|
|
66
|
+
/** One top-level `page.data` key in the seed explainer. */
|
|
67
|
+
export interface SeedKeyStat {
|
|
68
|
+
key: string;
|
|
69
|
+
/** serialized size estimate of the value */
|
|
70
|
+
bytes: number;
|
|
71
|
+
/** islands whose client code reads this key (the build's answer) */
|
|
72
|
+
readers: string[];
|
|
73
|
+
/** islands whose props sidecar points into this key (seed references) */
|
|
74
|
+
referenced_by: string[];
|
|
75
|
+
shipped: boolean;
|
|
76
|
+
/** why it ships: read by an island, referenced by a sidecar, or some island reads the page whole */
|
|
77
|
+
reason: "read" | "referenced" | "whole" | null;
|
|
78
|
+
}
|
|
79
|
+
/** A deferred hole the page rendered (its fallback in the shell, its content on the endpoint). */
|
|
80
|
+
export interface HoleStat {
|
|
81
|
+
/** region id (the server manifest key) */
|
|
82
|
+
id: string;
|
|
83
|
+
/** the component's name (`Recommendations`); '' when unknown */
|
|
84
|
+
name: string;
|
|
85
|
+
/** a short preview of the props (`{"forProduct":"P1"}`), what tells two holes of one component apart */
|
|
86
|
+
props: string;
|
|
87
|
+
/** fetch schedule (`load` | `visible` | …) */
|
|
88
|
+
when: string;
|
|
89
|
+
/** phase-2 wake, when it hydrates */
|
|
90
|
+
hydrate: string | null;
|
|
91
|
+
/** response cache max-age in seconds (0 = no-store) */
|
|
92
|
+
ttl: number;
|
|
93
|
+
count: number;
|
|
94
|
+
/** each copy by its key (runtime/hash.ts `hole_copy_key`) with its props preview — what the
|
|
95
|
+
* browser's report and the hole's requests name a copy by (at most 12) */
|
|
96
|
+
copies?: {
|
|
97
|
+
p: string;
|
|
98
|
+
props: string;
|
|
99
|
+
}[];
|
|
100
|
+
}
|
|
101
|
+
export interface OgygiaRequestStats {
|
|
102
|
+
/** wall ms of `inject_client_seeds` (locate, dedupe, tail render, seed serialize, assemble) */
|
|
103
|
+
transform_ms: number;
|
|
104
|
+
/** props sidecars in the tail (one per distinct island fingerprint) */
|
|
105
|
+
islands: number;
|
|
106
|
+
/** module-preload hints in the tail */
|
|
107
|
+
hints: number;
|
|
108
|
+
/** deferred holes recorded in the tail (Kit-hydrated documents only) */
|
|
109
|
+
holes: number;
|
|
110
|
+
/** bytes of the `application/ogygia-page` seed ('' → 0) */
|
|
111
|
+
seed_bytes: number;
|
|
112
|
+
/** bytes of the `application/ogygia-remote` seed */
|
|
113
|
+
remote_seed_bytes: number;
|
|
114
|
+
/** bytes of the whole tail (hints + props sidecars + holes record) */
|
|
115
|
+
tail_bytes: number;
|
|
116
|
+
/** bytes of the og.$ factory manifest script */
|
|
117
|
+
fnm_bytes: number;
|
|
118
|
+
/** bytes of the drop-in setContext bridge */
|
|
119
|
+
ctx_bytes: number;
|
|
120
|
+
/** whether the seed went out on the JSON lane (else devalue) */
|
|
121
|
+
seed_json: boolean;
|
|
122
|
+
/** the first leaf that kept the SEED off the JSON lane, when devalue was used */
|
|
123
|
+
seed_culprit?: string | null;
|
|
124
|
+
island_rows?: IslandStat[];
|
|
125
|
+
seed?: {
|
|
126
|
+
keys: SeedKeyStat[];
|
|
127
|
+
/** islands that read `page.data` whole (`'all'` asks) — the reason everything ships */
|
|
128
|
+
whole_by: string[];
|
|
129
|
+
};
|
|
130
|
+
hole_rows?: HoleStat[];
|
|
131
|
+
}
|
|
132
|
+
/** What the islands endpoint did for one hole request. */
|
|
133
|
+
export interface HoleRequestStats {
|
|
134
|
+
kind: "hole";
|
|
135
|
+
id: string;
|
|
136
|
+
/** `hit` served from the render cache; `miss` rendered and stored; `none` = no cache (ttl 0) */
|
|
137
|
+
cache: "hit" | "miss" | "none";
|
|
138
|
+
ttl: number;
|
|
139
|
+
/** ms it waited for a render slot (the server renders a few holes at a time); absent on a hit */
|
|
140
|
+
queue_ms?: number;
|
|
141
|
+
/** its component's name (the server manifest's): names the hole where no page row does */
|
|
142
|
+
name?: string;
|
|
143
|
+
/** which copy (runtime/hash.ts `hole_copy_key` of its props payload): copies share the id */
|
|
144
|
+
p?: string;
|
|
145
|
+
}
|
|
146
|
+
/** A reader of these stats is installed (the profiler, from `@ogygia/devtools`): the handle records
|
|
147
|
+
* each request's totals. Off, it records nothing — no stats object per request in an app without one. */
|
|
148
|
+
export declare function want_request_stats(): void;
|
|
149
|
+
export declare function request_stats_wanted(): boolean;
|
|
150
|
+
export declare function record_request_stats(request: Request, s: OgygiaRequestStats): void;
|
|
151
|
+
export declare function request_stats_of(request: Request): OgygiaRequestStats | undefined;
|
|
152
|
+
export declare function record_hole_stats(request: Request, s: HoleRequestStats): void;
|
|
153
|
+
export declare function hole_stats_of(request: Request): HoleRequestStats | undefined;
|
|
154
|
+
/** One hole rendered inside a BATCH request (the page's first-load holes, a navigation's): the
|
|
155
|
+
* profiler logs each as its own hole request, timed by its own render within the batch. */
|
|
156
|
+
export interface BatchHoleStats extends HoleRequestStats {
|
|
157
|
+
/** the hole's own time in the batch: its wait for a slot and its render (ms) */
|
|
158
|
+
ms: number;
|
|
159
|
+
/** 200 rendered; 500 its render failed */
|
|
160
|
+
status: number;
|
|
161
|
+
}
|
|
162
|
+
export declare function set_batch_hole_listener(fn: ((request: Request, s: BatchHoleStats) => void) | null): void;
|
|
163
|
+
export declare function has_batch_hole_listener(): boolean;
|
|
164
|
+
export declare function record_batch_hole_stats(request: Request, s: BatchHoleStats): void;
|
|
165
|
+
/**
|
|
166
|
+
* The profiler turns detail on for a recording; off, the handle records totals only. COUNTED, not a
|
|
167
|
+
* switch: the flag is the process's, while a recorder lock is one profiler instance's — and two can
|
|
168
|
+
* live at once (the dev server re-runs the app's hooks on an edit and `ogygia.handle()` builds a new
|
|
169
|
+
* profiler, while the old one's sample and trap timers still record). The first window to end then
|
|
170
|
+
* turned detail off under the other's render: its report kept no island rows ("islands 1, rows 0")
|
|
171
|
+
* and named its islands by their files. On while any window records.
|
|
172
|
+
*/
|
|
173
|
+
export declare function set_request_stats_detail(on: boolean): void;
|
|
174
|
+
export declare function request_stats_detailed(): boolean;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/server/request-stats.ts
|
|
2
|
+
const stats = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
const hole_stats = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
let detailed = false;
|
|
5
|
+
let wanted = false;
|
|
6
|
+
/** A reader of these stats is installed (the profiler, from `@ogygia/devtools`): the handle records
|
|
7
|
+
* each request's totals. Off, it records nothing — no stats object per request in an app without one. */
|
|
8
|
+
function want_request_stats() {
|
|
9
|
+
wanted = true;
|
|
10
|
+
}
|
|
11
|
+
function request_stats_wanted() {
|
|
12
|
+
return wanted;
|
|
13
|
+
}
|
|
14
|
+
function record_request_stats(request, s) {
|
|
15
|
+
stats.set(request, s);
|
|
16
|
+
}
|
|
17
|
+
function request_stats_of(request) {
|
|
18
|
+
return stats.get(request);
|
|
19
|
+
}
|
|
20
|
+
function record_hole_stats(request, s) {
|
|
21
|
+
hole_stats.set(request, s);
|
|
22
|
+
}
|
|
23
|
+
function hole_stats_of(request) {
|
|
24
|
+
return hole_stats.get(request);
|
|
25
|
+
}
|
|
26
|
+
/** The batch streams: its holes settle AFTER the handle returned (and the profiler logged the
|
|
27
|
+
* request), so each is handed on as it lands — to the profiler that asked, or nowhere. */
|
|
28
|
+
let batch_listener = null;
|
|
29
|
+
function set_batch_hole_listener(fn) {
|
|
30
|
+
batch_listener = fn;
|
|
31
|
+
}
|
|
32
|
+
function has_batch_hole_listener() {
|
|
33
|
+
return batch_listener !== null;
|
|
34
|
+
}
|
|
35
|
+
function record_batch_hole_stats(request, s) {
|
|
36
|
+
batch_listener?.(request, s);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The profiler turns detail on for a recording; off, the handle records totals only. COUNTED, not a
|
|
40
|
+
* switch: the flag is the process's, while a recorder lock is one profiler instance's — and two can
|
|
41
|
+
* live at once (the dev server re-runs the app's hooks on an edit and `ogygia.handle()` builds a new
|
|
42
|
+
* profiler, while the old one's sample and trap timers still record). The first window to end then
|
|
43
|
+
* turned detail off under the other's render: its report kept no island rows ("islands 1, rows 0")
|
|
44
|
+
* and named its islands by their files. On while any window records.
|
|
45
|
+
*/
|
|
46
|
+
function set_request_stats_detail(on) {
|
|
47
|
+
detail_depth = on ? detail_depth + 1 : Math.max(0, detail_depth - 1);
|
|
48
|
+
detailed = detail_depth > 0;
|
|
49
|
+
}
|
|
50
|
+
let detail_depth = 0;
|
|
51
|
+
function request_stats_detailed() {
|
|
52
|
+
return detailed;
|
|
53
|
+
}
|
|
54
|
+
export { has_batch_hole_listener, hole_stats_of, record_batch_hole_stats, record_hole_stats, record_request_stats, request_stats_detailed, request_stats_of, request_stats_wanted, set_batch_hole_listener, set_request_stats_detail, want_request_stats };
|