@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,487 @@
|
|
|
1
|
+
import { fnv1a } from "./runtime/hash.js";
|
|
2
|
+
// src/seed-refs.ts
|
|
3
|
+
/**
|
|
4
|
+
* SEED REFERENCES — island props that point into the page seed instead of copying it.
|
|
5
|
+
*
|
|
6
|
+
* THE DUPLICATION: on a csr=false page the handle ships `page.data` once as the page seed (so
|
|
7
|
+
* islands can read `$page`), and every island ships its props as its own sidecar. A CMS page hands
|
|
8
|
+
* each block island its slice of the same `page.data` tree, so the same JSON crosses twice —
|
|
9
|
+
* measured on one landing page: 674 KB of seed and 481 KB of props, of which 94% were verbatim
|
|
10
|
+
* seed subtrees. Twice the bytes, and twice the server-side serialization (the larger part of that
|
|
11
|
+
* page's remaining TTFB gap to a plain Kit render).
|
|
12
|
+
*
|
|
13
|
+
* THE CODEC: when the seed ships, an island's props are serialized RELATIVE to it. Any plain
|
|
14
|
+
* object / array in the props that is also a node of `page.data` — by IDENTITY (the app passed the
|
|
15
|
+
* same object) or by STRUCTURE (the app cloned it: a JSON round-trip, a spread — CMS SDKs do) — is
|
|
16
|
+
* written as `["OgygiaSeedRef", <path>]`, a path from `page.data` to that node. The client revives
|
|
17
|
+
* the reference against the ONE parsed seed of its document (the same graph `page.data` reads —
|
|
18
|
+
* `runtime/seeds.ts`) and hands the island the seed's own node, by reference: island props are a
|
|
19
|
+
* snapshot either way, and the DEV mutation guard warns on a write into them. Largest matching
|
|
20
|
+
* ancestor wins, so a block whose whole props object is one seed node becomes one short reference.
|
|
21
|
+
*
|
|
22
|
+
* WHAT MATCHES: plain objects and arrays whose subtree holds only plain objects, arrays, primitives
|
|
23
|
+
* and Dates — no class instances (wired values, stores, snippets keep their own codec), no Maps or
|
|
24
|
+
* Sets, no cycles. Small nodes are skipped (`min_bytes`): a reference costs ~30 bytes, so it must
|
|
25
|
+
* save more than that.
|
|
26
|
+
*
|
|
27
|
+
* WHEN: only inside Kit's page pass of THIS document, and only when the seed ships — a reference
|
|
28
|
+
* into a seed that never arrives would be a hole in the island's props. The decision is made ONCE
|
|
29
|
+
* per request, when the document tail renders (server/props-wire.ts): every island on the page
|
|
30
|
+
* gets references then, whichever rendered first. Every other render root (a hole endpoint, a
|
|
31
|
+
* baked ticket, a foreign fragment) never references: its props must be self-contained wherever
|
|
32
|
+
* the HTML is spliced.
|
|
33
|
+
*
|
|
34
|
+
* ONE WALK PER NODE PER REQUEST: `measure` visits a node once and remembers what it learned —
|
|
35
|
+
* byte estimate, referenceability, JSON-exactness, a streamed promise inside — as ONE NUMBER in a
|
|
36
|
+
* memo shared by every root measured in the same request (`set_measure_memo_reader`; the handle
|
|
37
|
+
* hands out its request's memo). The seed's `page.data` is walked once; the twenty block islands
|
|
38
|
+
* whose props ARE seed nodes cost a lookup each, not a walk each; the shaped seed, the props plans
|
|
39
|
+
* and the handle's lane / streaming decisions all read the same memo. Nothing is allocated per
|
|
40
|
+
* node beyond the memo entry: no measure object, no cycle stack (the memo's in-progress mark is
|
|
41
|
+
* the cycle detector), no path array until a node is actually referenced.
|
|
42
|
+
*
|
|
43
|
+
* Universal module (no Node imports): the index + reducer run on the server, the resolver on the
|
|
44
|
+
* client, and the unit tests exercise both ends against a real devalue round trip.
|
|
45
|
+
*/
|
|
46
|
+
/** The devalue type tag. */
|
|
47
|
+
const SEED_REF_KEY = "OgygiaSeedRef";
|
|
48
|
+
/** A node the codec may reference: a plain object or an array (own prototype only). */
|
|
49
|
+
function is_plain(v) {
|
|
50
|
+
if (v === null || typeof v !== "object") return false;
|
|
51
|
+
if (Array.isArray(v)) return true;
|
|
52
|
+
const proto = Object.getPrototypeOf(v);
|
|
53
|
+
return proto === Object.prototype || proto === null;
|
|
54
|
+
}
|
|
55
|
+
const is_thenable = (v) => typeof v?.then === "function";
|
|
56
|
+
/** Leaves that a plain deep copy reproduces exactly. */
|
|
57
|
+
function is_leaf(v) {
|
|
58
|
+
return v === null || v === void 0 || typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "bigint" || v instanceof Date;
|
|
59
|
+
}
|
|
60
|
+
const leaf_text = (v) => v === void 0 ? "u" : v === null ? "n" : v instanceof Date ? "d" + v.getTime() : typeof v + ":" + String(v);
|
|
61
|
+
/**
|
|
62
|
+
* Post-order structural hash + byte estimate of a plain subtree. `null` when the subtree is not
|
|
63
|
+
* referenceable (a non-plain value inside, or a cycle). Visits each node once per walk; results
|
|
64
|
+
* are memoised in `memo` so a graph with shared nodes stays linear.
|
|
65
|
+
*/
|
|
66
|
+
function hash_subtree(v, memo, on_stack) {
|
|
67
|
+
if (is_leaf(v)) {
|
|
68
|
+
const t = leaf_text(v);
|
|
69
|
+
return {
|
|
70
|
+
hash: t,
|
|
71
|
+
bytes: t.length
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (!is_plain(v)) return null;
|
|
75
|
+
const cached = memo.get(v);
|
|
76
|
+
if (cached !== void 0) return cached;
|
|
77
|
+
if (on_stack.has(v)) return null;
|
|
78
|
+
on_stack.add(v);
|
|
79
|
+
let bytes = 0;
|
|
80
|
+
let acc = Array.isArray(v) ? "A" : "O";
|
|
81
|
+
let ok = true;
|
|
82
|
+
if (Array.isArray(v)) for (const item of v) {
|
|
83
|
+
const h = hash_subtree(item, memo, on_stack);
|
|
84
|
+
if (!h) {
|
|
85
|
+
ok = false;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
acc += "|" + h.hash;
|
|
89
|
+
bytes += h.bytes + 1;
|
|
90
|
+
}
|
|
91
|
+
else for (const key of Object.keys(v).sort()) {
|
|
92
|
+
const h = hash_subtree(v[key], memo, on_stack);
|
|
93
|
+
if (!h) {
|
|
94
|
+
ok = false;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
acc += "|" + key + "=" + h.hash;
|
|
98
|
+
bytes += key.length + h.bytes + 3;
|
|
99
|
+
}
|
|
100
|
+
on_stack.delete(v);
|
|
101
|
+
const result = ok ? {
|
|
102
|
+
hash: fnv1a(acc),
|
|
103
|
+
bytes
|
|
104
|
+
} : null;
|
|
105
|
+
memo.set(v, result);
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
/** Exact structural equality for the shapes `hash_subtree` accepts — the check behind a hash hit. */
|
|
109
|
+
function deep_equal_plain(a, b) {
|
|
110
|
+
if (a === b) return true;
|
|
111
|
+
if (a instanceof Date || b instanceof Date) return a instanceof Date && b instanceof Date && a.getTime() === b.getTime();
|
|
112
|
+
if (is_leaf(a) || is_leaf(b)) return false;
|
|
113
|
+
if (!is_plain(a) || !is_plain(b)) return false;
|
|
114
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
115
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
116
|
+
if (a.length !== b.length) return false;
|
|
117
|
+
for (let i = 0; i < a.length; i++) if (!deep_equal_plain(a[i], b[i])) return false;
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
const ka = Object.keys(a);
|
|
121
|
+
const kb = Object.keys(b);
|
|
122
|
+
if (ka.length !== kb.length) return false;
|
|
123
|
+
for (const k of ka) {
|
|
124
|
+
if (!Object.prototype.hasOwnProperty.call(b, k)) return false;
|
|
125
|
+
if (!deep_equal_plain(a[k], b[k])) return false;
|
|
126
|
+
}
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
const F_REF = 1;
|
|
130
|
+
const F_JSON = 2;
|
|
131
|
+
const F_THENABLE = 4;
|
|
132
|
+
const P_OPAQUE = 0;
|
|
133
|
+
const P_THENABLE = F_THENABLE;
|
|
134
|
+
const P_NULLISH_JSON = 35;
|
|
135
|
+
const P_UNDEFINED = 33;
|
|
136
|
+
const P_NUMBER = 67;
|
|
137
|
+
const P_NUMBER_NOJSON = 65;
|
|
138
|
+
const P_BIGINT = 65;
|
|
139
|
+
const P_DATE = 193;
|
|
140
|
+
/** The memo mark of a node whose walk has not finished: meeting it again is a cycle. */
|
|
141
|
+
const IN_PROGRESS = -1;
|
|
142
|
+
const bytes_of = (p) => (p - (p & 7)) / 8;
|
|
143
|
+
function unpack(p) {
|
|
144
|
+
return {
|
|
145
|
+
bytes: bytes_of(p),
|
|
146
|
+
ref: (p & F_REF) !== 0,
|
|
147
|
+
json: (p & F_JSON) !== 0,
|
|
148
|
+
thenable: (p & F_THENABLE) !== 0
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The one walk: measure a value (post-order, memoised per plain node in `memo`). Every child is
|
|
153
|
+
* measured even after one disqualifies the parent: a clean sibling deeper in the tree must still
|
|
154
|
+
* get its own entry (the index walk reads the memo). Strings never enter the memo. A node already
|
|
155
|
+
* in the memo — from this root or from any other root measured with the same memo — is a lookup.
|
|
156
|
+
*/
|
|
157
|
+
function measure(v, memo) {
|
|
158
|
+
switch (typeof v) {
|
|
159
|
+
case "string": return (v.length + 2) * 8 + F_REF + F_JSON;
|
|
160
|
+
case "number": return Number.isFinite(v) && !Object.is(v, -0) ? P_NUMBER : P_NUMBER_NOJSON;
|
|
161
|
+
case "boolean": return P_NULLISH_JSON;
|
|
162
|
+
case "undefined": return P_UNDEFINED;
|
|
163
|
+
case "bigint": return P_BIGINT;
|
|
164
|
+
case "object": break;
|
|
165
|
+
default: return P_OPAQUE;
|
|
166
|
+
}
|
|
167
|
+
if (v === null) return P_NULLISH_JSON;
|
|
168
|
+
if (v instanceof Date) return P_DATE;
|
|
169
|
+
if (!is_plain(v)) return is_thenable(v) ? P_THENABLE : P_OPAQUE;
|
|
170
|
+
const cached = memo.get(v);
|
|
171
|
+
if (cached !== void 0) return cached === IN_PROGRESS ? P_OPAQUE : cached;
|
|
172
|
+
if (!Array.isArray(v) && Object.getOwnPropertySymbols(v).length > 0) {
|
|
173
|
+
memo.set(v, P_OPAQUE);
|
|
174
|
+
return P_OPAQUE;
|
|
175
|
+
}
|
|
176
|
+
let bytes = 0;
|
|
177
|
+
let lanes = 3;
|
|
178
|
+
let thenable = 0;
|
|
179
|
+
let marked = false;
|
|
180
|
+
if (Array.isArray(v)) for (let i = 0; i < v.length; i++) {
|
|
181
|
+
const c = v[i];
|
|
182
|
+
if (typeof c === "string") {
|
|
183
|
+
bytes += c.length + 3;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (!marked && typeof c === "object" && c !== null) {
|
|
187
|
+
memo.set(v, IN_PROGRESS);
|
|
188
|
+
marked = true;
|
|
189
|
+
}
|
|
190
|
+
const p = measure(c, memo);
|
|
191
|
+
bytes += bytes_of(p) + 1;
|
|
192
|
+
lanes &= p;
|
|
193
|
+
thenable |= p & F_THENABLE;
|
|
194
|
+
}
|
|
195
|
+
else for (const key in v) {
|
|
196
|
+
const c = v[key];
|
|
197
|
+
if (typeof c === "string") {
|
|
198
|
+
bytes += c.length + key.length + 5;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (c === void 0) {
|
|
202
|
+
bytes += key.length + 4;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
if (!marked && typeof c === "object" && c !== null) {
|
|
206
|
+
memo.set(v, IN_PROGRESS);
|
|
207
|
+
marked = true;
|
|
208
|
+
}
|
|
209
|
+
const p = measure(c, memo);
|
|
210
|
+
bytes += bytes_of(p) + key.length + 3;
|
|
211
|
+
lanes &= p;
|
|
212
|
+
thenable |= p & F_THENABLE;
|
|
213
|
+
}
|
|
214
|
+
const result = bytes * 8 + (lanes & 3) + thenable;
|
|
215
|
+
memo.set(v, result);
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
let memo_reader = null;
|
|
219
|
+
/** Server (`hooks.ts`) installs a request-scoped reader: every root measured during one request
|
|
220
|
+
* shares one memo, so a subtree reached from two roots (the seed and an island's props) is walked
|
|
221
|
+
* once. `null` uninstalls; off-request (a hole endpoint, a test) each root gets its own memo. */
|
|
222
|
+
function set_measure_memo_reader(fn) {
|
|
223
|
+
memo_reader = fn;
|
|
224
|
+
}
|
|
225
|
+
const analysis_cache = /* @__PURE__ */ new WeakMap();
|
|
226
|
+
/** The walk, cached per plain root object: the seed's `page.data` is measured once per request
|
|
227
|
+
* however many islands, lanes and decisions ask; a props object once per island — and against
|
|
228
|
+
* the request's shared memo, so a props object that is a seed node costs a lookup. */
|
|
229
|
+
function analysis(value) {
|
|
230
|
+
if (!is_plain(value)) {
|
|
231
|
+
const memo = /* @__PURE__ */ new Map();
|
|
232
|
+
return {
|
|
233
|
+
root: unpack(measure(value, memo)),
|
|
234
|
+
memo
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
const hit = analysis_cache.get(value);
|
|
238
|
+
if (hit) return hit;
|
|
239
|
+
const memo = memo_reader?.() ?? /* @__PURE__ */ new Map();
|
|
240
|
+
const a = {
|
|
241
|
+
root: unpack(measure(value, memo)),
|
|
242
|
+
memo
|
|
243
|
+
};
|
|
244
|
+
analysis_cache.set(value, a);
|
|
245
|
+
return a;
|
|
246
|
+
}
|
|
247
|
+
/** What one walk says about a value (see {@link Measure}). */
|
|
248
|
+
function analyze(value) {
|
|
249
|
+
return analysis(value).root;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* WHY a tree is not JSON-exact: the path of the first leaf that disqualifies it, with what it
|
|
253
|
+
* is — `config.updated (Date)`, `rows[3].price (NaN)`, `facets (Map)`, `meta (class Foo)`. A
|
|
254
|
+
* separate walk on purpose (the measuring walk carries no paths); the handle runs it only for a
|
|
255
|
+
* tree that left the JSON lane and only while the profiler records. `null` for a JSON tree.
|
|
256
|
+
*/
|
|
257
|
+
function json_culprit(value, max_depth = 64) {
|
|
258
|
+
const seen = /* @__PURE__ */ new Set();
|
|
259
|
+
const why = (v) => {
|
|
260
|
+
switch (typeof v) {
|
|
261
|
+
case "string":
|
|
262
|
+
case "boolean": return null;
|
|
263
|
+
case "number": return Number.isFinite(v) ? Object.is(v, -0) ? "-0" : null : Number.isNaN(v) ? "NaN" : "Infinity";
|
|
264
|
+
case "undefined": return "undefined";
|
|
265
|
+
case "bigint": return "bigint";
|
|
266
|
+
case "function": return "function";
|
|
267
|
+
case "symbol": return "symbol";
|
|
268
|
+
default: return null;
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
const walk = (v, path, depth) => {
|
|
272
|
+
const leaf = why(v);
|
|
273
|
+
if (leaf) return `${path || "(root)"} (${leaf})`;
|
|
274
|
+
if (v === null || typeof v !== "object") return null;
|
|
275
|
+
if (v instanceof Date) return `${path || "(root)"} (Date)`;
|
|
276
|
+
if (v instanceof Map) return `${path || "(root)"} (Map)`;
|
|
277
|
+
if (v instanceof Set) return `${path || "(root)"} (Set)`;
|
|
278
|
+
if (typeof v.then === "function") return `${path || "(root)"} (Promise)`;
|
|
279
|
+
if (!is_plain(v)) {
|
|
280
|
+
const name = Object.getPrototypeOf(v)?.constructor?.name;
|
|
281
|
+
return `${path || "(root)"} (class ${name || "instance"})`;
|
|
282
|
+
}
|
|
283
|
+
if (seen.has(v)) return `${path || "(root)"} (cycle)`;
|
|
284
|
+
if (depth > max_depth) return null;
|
|
285
|
+
seen.add(v);
|
|
286
|
+
if (Array.isArray(v)) for (let i = 0; i < v.length; i++) {
|
|
287
|
+
if (v[i] === void 0) return `${path}[${i}] (undefined in array)`;
|
|
288
|
+
const r = walk(v[i], `${path}[${i}]`, depth + 1);
|
|
289
|
+
if (r) return r;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
if (Object.getOwnPropertySymbols(v).length > 0) return `${path || "(root)"} (symbol-branded)`;
|
|
293
|
+
for (const key in v) {
|
|
294
|
+
const c = v[key];
|
|
295
|
+
if (c === void 0) continue;
|
|
296
|
+
const r = walk(c, path ? `${path}.${key}` : key, depth + 1);
|
|
297
|
+
if (r) return r;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
seen.delete(v);
|
|
301
|
+
return null;
|
|
302
|
+
};
|
|
303
|
+
return walk(value, "", 0);
|
|
304
|
+
}
|
|
305
|
+
function path_of(at) {
|
|
306
|
+
if (at.path !== null) return at.path;
|
|
307
|
+
const path = at.parent === null ? [] : [...path_of(at.parent), at.key];
|
|
308
|
+
at.path = path;
|
|
309
|
+
return path;
|
|
310
|
+
}
|
|
311
|
+
const EMPTY_NODES = [];
|
|
312
|
+
const EMPTY_INDEX = {
|
|
313
|
+
by_identity: {
|
|
314
|
+
get: () => void 0,
|
|
315
|
+
has: () => false
|
|
316
|
+
},
|
|
317
|
+
candidates: () => EMPTY_NODES,
|
|
318
|
+
hash_of: () => null,
|
|
319
|
+
size: 0,
|
|
320
|
+
touched: /* @__PURE__ */ new Set()
|
|
321
|
+
};
|
|
322
|
+
const index_cache = /* @__PURE__ */ new WeakMap();
|
|
323
|
+
/**
|
|
324
|
+
* Index the seed's `data` for referencing: every referenceable node at or above `min_bytes`, by
|
|
325
|
+
* identity now and by structural hash on demand (first occurrence wins — the shortest path is not
|
|
326
|
+
* guaranteed, the first in key order is, which is deterministic). Cached per `data` object: one
|
|
327
|
+
* index per request, however many islands ask. It reads the one measuring walk (`analyze`) and
|
|
328
|
+
* prunes: a node below `min_bytes` cannot hold a child at or above it (a child is never larger
|
|
329
|
+
* than its parent), so its subtree is skipped BEFORE anything is materialised — on a CMS tree that
|
|
330
|
+
* is most of the nodes.
|
|
331
|
+
*/
|
|
332
|
+
function index_seed(data, min_bytes = 96) {
|
|
333
|
+
if (!is_plain(data)) return {
|
|
334
|
+
...EMPTY_INDEX,
|
|
335
|
+
touched: /* @__PURE__ */ new Set()
|
|
336
|
+
};
|
|
337
|
+
const hit = index_cache.get(data);
|
|
338
|
+
if (hit) return hit;
|
|
339
|
+
const memo = analysis(data).memo;
|
|
340
|
+
const at = /* @__PURE__ */ new WeakMap();
|
|
341
|
+
const nodes = [];
|
|
342
|
+
const seen = /* @__PURE__ */ new Set();
|
|
343
|
+
const enter = (c) => {
|
|
344
|
+
if (!is_plain(c) || seen.has(c)) return false;
|
|
345
|
+
const p = memo.get(c);
|
|
346
|
+
return p !== void 0 && bytes_of(p) >= min_bytes;
|
|
347
|
+
};
|
|
348
|
+
const visit = (v, here) => {
|
|
349
|
+
seen.add(v);
|
|
350
|
+
if (memo.get(v) & F_REF) {
|
|
351
|
+
at.set(v, here);
|
|
352
|
+
nodes.push(v);
|
|
353
|
+
}
|
|
354
|
+
if (Array.isArray(v)) for (let i = 0; i < v.length; i++) {
|
|
355
|
+
const c = v[i];
|
|
356
|
+
if (enter(c)) visit(c, {
|
|
357
|
+
parent: here,
|
|
358
|
+
key: i,
|
|
359
|
+
path: null
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
else for (const key in v) {
|
|
363
|
+
const c = v[key];
|
|
364
|
+
if (enter(c)) visit(c, {
|
|
365
|
+
parent: here,
|
|
366
|
+
key,
|
|
367
|
+
path: null
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
if (enter(data)) visit(data, {
|
|
372
|
+
parent: null,
|
|
373
|
+
key: "",
|
|
374
|
+
path: []
|
|
375
|
+
});
|
|
376
|
+
let by_bytes = null;
|
|
377
|
+
const buckets = () => {
|
|
378
|
+
if (by_bytes === null) {
|
|
379
|
+
by_bytes = /* @__PURE__ */ new Map();
|
|
380
|
+
for (const n of nodes) {
|
|
381
|
+
const b = bytes_of(memo.get(n));
|
|
382
|
+
const bucket = by_bytes.get(b);
|
|
383
|
+
if (bucket) bucket.push(n);
|
|
384
|
+
else by_bytes.set(b, [n]);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return by_bytes;
|
|
388
|
+
};
|
|
389
|
+
const hash_memo = /* @__PURE__ */ new Map();
|
|
390
|
+
const index = {
|
|
391
|
+
by_identity: {
|
|
392
|
+
get: (node) => {
|
|
393
|
+
const here = at.get(node);
|
|
394
|
+
return here === void 0 ? void 0 : path_of(here);
|
|
395
|
+
},
|
|
396
|
+
has: (node) => at.has(node)
|
|
397
|
+
},
|
|
398
|
+
candidates: (b) => buckets().get(b) ?? EMPTY_NODES,
|
|
399
|
+
hash_of: (node) => hash_subtree(node, hash_memo, /* @__PURE__ */ new Set())?.hash ?? null,
|
|
400
|
+
size: nodes.length,
|
|
401
|
+
touched: /* @__PURE__ */ new Set()
|
|
402
|
+
};
|
|
403
|
+
index_cache.set(data, index);
|
|
404
|
+
return index;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Plan one island's references: walk the props once, top-down, largest matching ancestor first —
|
|
408
|
+
* identity first (a pointer lookup per node, no hashing), then structure (hash + exact comparison,
|
|
409
|
+
* only for a large plain node the seed does not own, and only against the seed nodes of exactly the
|
|
410
|
+
* same byte size — usually none, or one). Nodes under a matched ancestor are never visited (they
|
|
411
|
+
* ride inside the reference), and neither is anything under a node below `min_bytes` (no child
|
|
412
|
+
* of it can be referenced). The props' own measures come from the request memo, so the plan adds
|
|
413
|
+
* no walk of its own beyond the pointer lookups.
|
|
414
|
+
*/
|
|
415
|
+
function plan_seed_refs(index, props, min_bytes = 96) {
|
|
416
|
+
const matched = /* @__PURE__ */ new WeakMap();
|
|
417
|
+
const keys = /* @__PURE__ */ new Set();
|
|
418
|
+
let count = 0;
|
|
419
|
+
if (index.size > 0) {
|
|
420
|
+
const memo = analysis(props).memo;
|
|
421
|
+
const hashed = /* @__PURE__ */ new Map();
|
|
422
|
+
const seen = /* @__PURE__ */ new Set();
|
|
423
|
+
const hit = (v, path) => {
|
|
424
|
+
matched.set(v, path);
|
|
425
|
+
index.touched.add(String(path[0]));
|
|
426
|
+
keys.add(String(path[0]));
|
|
427
|
+
count++;
|
|
428
|
+
};
|
|
429
|
+
const visit = (v) => {
|
|
430
|
+
if (!is_plain(v) || seen.has(v)) return;
|
|
431
|
+
seen.add(v);
|
|
432
|
+
const by_id = index.by_identity.get(v);
|
|
433
|
+
if (by_id) return hit(v, by_id);
|
|
434
|
+
const p = memo.get(v) ?? measure(v, memo);
|
|
435
|
+
const bytes = bytes_of(p);
|
|
436
|
+
if (bytes < min_bytes) return;
|
|
437
|
+
if (p & F_REF) {
|
|
438
|
+
const cands = index.candidates(bytes);
|
|
439
|
+
if (cands.length) {
|
|
440
|
+
const h = hash_subtree(v, hashed, /* @__PURE__ */ new Set())?.hash ?? null;
|
|
441
|
+
const cand = h ? cands.find((c) => index.hash_of(c) === h) : void 0;
|
|
442
|
+
if (cand && deep_equal_plain(cand, v)) return hit(v, index.by_identity.get(cand));
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (Array.isArray(v)) for (const item of v) visit(item);
|
|
446
|
+
else for (const key in v) visit(v[key]);
|
|
447
|
+
};
|
|
448
|
+
visit(props);
|
|
449
|
+
}
|
|
450
|
+
return {
|
|
451
|
+
reducer: (value) => value === null || typeof value !== "object" ? void 0 : matched.get(value),
|
|
452
|
+
count,
|
|
453
|
+
keys
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
/** Client: the node a path points at, or `undefined` when the seed does not have it. */
|
|
457
|
+
function resolve_seed_ref(data, path) {
|
|
458
|
+
let cur = data;
|
|
459
|
+
for (const key of path) {
|
|
460
|
+
if (cur === null || typeof cur !== "object") return void 0;
|
|
461
|
+
cur = cur[key];
|
|
462
|
+
}
|
|
463
|
+
return cur;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Client reviver for the devalue type: resolve BY REFERENCE. The island receives the seed's own
|
|
467
|
+
* node — the same object its `page.data` read would hand it, shared exactly the way `page.data`
|
|
468
|
+
* already is between islands. A deep copy per reference (129 of them on a measured page) bought
|
|
469
|
+
* nothing: island props are a snapshot either way, and the DEV mutation guard the runtime wraps
|
|
470
|
+
* every island's props in (`PropMutationGuard`) already warns on a write into them. `get_data` is
|
|
471
|
+
* called lazily, once per reviver — the first reference resolves the seed. A dangling path (no seed,
|
|
472
|
+
* or a seed that does not carry the node) revives to `undefined` and, in dev, says why.
|
|
473
|
+
*/
|
|
474
|
+
function seed_ref_reviver(get_data) {
|
|
475
|
+
let data;
|
|
476
|
+
let resolved = false;
|
|
477
|
+
return (path) => {
|
|
478
|
+
if (!resolved) {
|
|
479
|
+
data = get_data();
|
|
480
|
+
resolved = true;
|
|
481
|
+
}
|
|
482
|
+
const node = resolve_seed_ref(data, path);
|
|
483
|
+
if (node === void 0 && typeof console !== "undefined" && import.meta.env?.DEV) console.warn(`[ogygia] island props reference page.data at ${JSON.stringify(path)} but the page seed does not carry it — the island receives undefined there.`);
|
|
484
|
+
return node;
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
export { SEED_REF_KEY, analyze, deep_equal_plain, index_seed, json_culprit, plan_seed_refs, resolve_seed_ref, seed_ref_reviver, set_measure_memo_reader };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The app's settings the rule reads. */
|
|
2
|
+
export interface LifetimeSettings {
|
|
3
|
+
/** prerendering (Kit's `building`) */
|
|
4
|
+
building: boolean;
|
|
5
|
+
/** `ogygia({ ttl })`, seconds */
|
|
6
|
+
region_ttl: number;
|
|
7
|
+
/** `ogygia({ maxPageAge })`, seconds */
|
|
8
|
+
renew_window: number;
|
|
9
|
+
/** the request being rendered (null off-request: prerender, a test) */
|
|
10
|
+
request(): Request | null;
|
|
11
|
+
}
|
|
12
|
+
export interface CapabilityLifetime {
|
|
13
|
+
/**
|
|
14
|
+
* The `exp` (unix seconds) of a capability minted now, in the render running now. Prerendered
|
|
15
|
+
* (real PPR) or a render a plugin may store (`facts.storable`): prerender-grade, since the stored
|
|
16
|
+
* HTML outlives any `ttl` (a stored page must never carry expired hole URLs). An anonymous hole on
|
|
17
|
+
* a document the app marked shared-cacheable (a load's `cache-control`) outlives that cache life
|
|
18
|
+
* (server/shared-cache.ts). Everything else, and anything sealed to a `session`, keeps the short
|
|
19
|
+
* `ttl` window so harvested URLs age out.
|
|
20
|
+
*/
|
|
21
|
+
mint_expiry(session: string): number;
|
|
22
|
+
/** The `exp` of a capability RENEWED now (an expired one re-signed at hole time): the short `ttl`
|
|
23
|
+
* window — its document is already old, and the runtime adopts the fresh URL for later fetches. */
|
|
24
|
+
renewed_expiry(): number;
|
|
25
|
+
/** Seconds after expiry a capability still renews (`0` renews nothing). */
|
|
26
|
+
readonly renew_window: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function capability_lifetime(app: LifetimeSettings): CapabilityLifetime;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { current_facts } from "../plugin/facts.js";
|
|
2
|
+
import { capability_expiry } from "./endpoint.js";
|
|
3
|
+
import { document_shared_lifetime, mint_ttl_sec } from "./shared-cache.js";
|
|
4
|
+
// src/server/capability-lifetime.ts
|
|
5
|
+
/**
|
|
6
|
+
* THE CAPABILITY LIFETIME — when a signed hole URL minted now expires, and when a renewed one does.
|
|
7
|
+
* One rule for every capability the app signs: core's region holes (server/region-endpoint.ts) and a
|
|
8
|
+
* plugin's own (`app.capability`, plugin/capability.ts — a remote region's hole). Expiry is unix
|
|
9
|
+
* SECONDS everywhere: the runtime reads it from the URL to tell an expired capability
|
|
10
|
+
* (runtime/region-endpoint-url.ts `capability_expired`) and retries it once with `&renew=1`.
|
|
11
|
+
*
|
|
12
|
+
* Pure: the app's settings come in (server/region-endpoint.ts binds them from the virtuals), so the
|
|
13
|
+
* plugin test harness (plugin/testing.ts) runs the same rule without a Kit app.
|
|
14
|
+
*/
|
|
15
|
+
function capability_lifetime(app) {
|
|
16
|
+
const now_sec = () => Math.floor(Date.now() / 1e3);
|
|
17
|
+
return {
|
|
18
|
+
mint_expiry(session) {
|
|
19
|
+
const stored = app.building || current_facts()?.storable === true;
|
|
20
|
+
return capability_expiry(now_sec(), mint_ttl_sec({
|
|
21
|
+
stored,
|
|
22
|
+
session,
|
|
23
|
+
shared: stored || session !== "" ? 0 : document_shared_lifetime(app.request()),
|
|
24
|
+
region_ttl: app.region_ttl
|
|
25
|
+
}));
|
|
26
|
+
},
|
|
27
|
+
renewed_expiry: () => capability_expiry(now_sec(), app.region_ttl),
|
|
28
|
+
renew_window: app.renew_window
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export { capability_lifetime };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function drop_dead_kit_resolves(response: Response): Response;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/server/dead-kit-resolves.ts
|
|
2
|
+
/**
|
|
3
|
+
* Drop Kit's streamed resolve scripts from a document with no Kit client (csr=false). A load that
|
|
4
|
+
* returns promises makes Kit stream `<script>__sveltekit_x.resolve(…)<\/script>` chunks after the
|
|
5
|
+
* document; they call a global only Kit's client bootstrap defines, so on a csr=false page each one
|
|
6
|
+
* throws. (When an island reads the page, `stream_page_deferred` replaces the whole tail instead.)
|
|
7
|
+
*
|
|
8
|
+
* Only a chunk that STARTS with `<script` is decoded and looked at — the document and every other
|
|
9
|
+
* chunk (late regions included) pass untouched: no copy, no scan of a big page.
|
|
10
|
+
*/
|
|
11
|
+
const SCRIPT_BYTES = [
|
|
12
|
+
60,
|
|
13
|
+
115,
|
|
14
|
+
99,
|
|
15
|
+
114,
|
|
16
|
+
105,
|
|
17
|
+
112,
|
|
18
|
+
116
|
|
19
|
+
];
|
|
20
|
+
function drop_dead_kit_resolves(response) {
|
|
21
|
+
const body = response.body;
|
|
22
|
+
if (!body) return response;
|
|
23
|
+
const decoder = new TextDecoder();
|
|
24
|
+
const out = body.pipeThrough(new TransformStream({ transform(chunk, controller) {
|
|
25
|
+
let starts = chunk.length >= SCRIPT_BYTES.length;
|
|
26
|
+
for (let i = 0; starts && i < SCRIPT_BYTES.length; i++) if (chunk[i] !== SCRIPT_BYTES[i]) starts = false;
|
|
27
|
+
if (starts && chunk.length < 1 << 20) {
|
|
28
|
+
const text = decoder.decode(chunk);
|
|
29
|
+
if (text.includes("__sveltekit_") && text.includes(".resolve(")) return;
|
|
30
|
+
}
|
|
31
|
+
controller.enqueue(chunk);
|
|
32
|
+
} }));
|
|
33
|
+
return new Response(out, {
|
|
34
|
+
status: response.status,
|
|
35
|
+
statusText: response.statusText,
|
|
36
|
+
headers: new Headers(response.headers)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export { drop_dead_kit_resolves };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOCUMENT ASSEMBLY — how the handle puts its head and body injections into Kit's page HTML.
|
|
3
|
+
*
|
|
4
|
+
* Kit hands `transformPageChunk` the whole document as one string on a non-streamed page (2.6 MB on
|
|
5
|
+
* a large CMS page). Everything ogygia adds goes to exactly two places: just before `</head>` and
|
|
6
|
+
* just before `</body>`. So the document is located ONCE — `</head>` from the front (it sits within
|
|
7
|
+
* the first few KB), `</body>` from the back (the last few bytes) — and assembled ONCE from slices:
|
|
8
|
+
* `head + head_inject + middle + body_inject + rest`. V8 keeps `slice` results and `+` chains as
|
|
9
|
+
* views and ropes, so the body bytes are never copied here; Kit flattens the result once when it
|
|
10
|
+
* encodes the response. Before this, the transform ran eight to nine whole-document regex/replace
|
|
11
|
+
* passes and made four to five full copies per request (~13 MB of transient garbage on that page).
|
|
12
|
+
*
|
|
13
|
+
* Every presence check and dedupe the handle still does runs on the HEAD SLICE alone (see
|
|
14
|
+
* head-presence.ts); the csr fact is a build-time route fact (context.ts), not a scan.
|
|
15
|
+
*/
|
|
16
|
+
export interface DocumentSpans {
|
|
17
|
+
/** Index of `</head>` (-1 when this chunk has none — a streamed body chunk). */
|
|
18
|
+
head_end: number;
|
|
19
|
+
/** Index of the LAST `</body>` (-1 when this chunk has none — a streamed head/middle chunk). */
|
|
20
|
+
body_end: number;
|
|
21
|
+
}
|
|
22
|
+
/** The two injection points, each found with one bounded scan. */
|
|
23
|
+
export declare function locate(html: string): DocumentSpans;
|
|
24
|
+
/**
|
|
25
|
+
* Put `head_inject` before `</head>` and `body_inject` before `</body>`, replacing the head slice
|
|
26
|
+
* with `head` when the caller rewrote it (the deduped head; `null` = unchanged). A missing
|
|
27
|
+
* injection point drops that injection (a streamed chunk without `</body>` gets no body work).
|
|
28
|
+
* Returns `html` itself when there is nothing to do.
|
|
29
|
+
*/
|
|
30
|
+
export declare function assemble(html: string, { head_end, body_end }: DocumentSpans, head: string | null, head_inject: string, body_inject: string): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/server/document-assembly.ts
|
|
2
|
+
const HEAD_CLOSE = "</head>";
|
|
3
|
+
const BODY_CLOSE = "</body>";
|
|
4
|
+
/** The two injection points, each found with one bounded scan. */
|
|
5
|
+
function locate(html) {
|
|
6
|
+
return {
|
|
7
|
+
head_end: html.indexOf(HEAD_CLOSE),
|
|
8
|
+
body_end: html.lastIndexOf(BODY_CLOSE)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Put `head_inject` before `</head>` and `body_inject` before `</body>`, replacing the head slice
|
|
13
|
+
* with `head` when the caller rewrote it (the deduped head; `null` = unchanged). A missing
|
|
14
|
+
* injection point drops that injection (a streamed chunk without `</body>` gets no body work).
|
|
15
|
+
* Returns `html` itself when there is nothing to do.
|
|
16
|
+
*/
|
|
17
|
+
function assemble(html, { head_end, body_end }, head, head_inject, body_inject) {
|
|
18
|
+
const has_head = head_end !== -1 && (head !== null || head_inject !== "");
|
|
19
|
+
const has_body = body_end !== -1 && body_inject !== "";
|
|
20
|
+
if (!has_head && !has_body) return html;
|
|
21
|
+
if (!has_head) return html.slice(0, body_end) + body_inject + html.slice(body_end);
|
|
22
|
+
const front = (head ?? html.slice(0, head_end)) + head_inject;
|
|
23
|
+
if (!has_body) return front + html.slice(head_end);
|
|
24
|
+
return front + html.slice(head_end, body_end) + body_inject + html.slice(body_end);
|
|
25
|
+
}
|
|
26
|
+
export { assemble, locate };
|