@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,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SEED SHAPING — the server half. The build says which top-level `page.data` keys the islands on a
|
|
3
|
+
* page read (link/page-keys.ts → island-deps handoff → Region records per island); the handle
|
|
4
|
+
* unions those asks per request and ships only that slice of `page.data` in the page seed.
|
|
5
|
+
*
|
|
6
|
+
* The ask is `'all'` whenever ANY region on the page could not be pinned (a promise `of` whose
|
|
7
|
+
* module SSR cannot see, an entry the handoff does not know, a closure that hands `page.data` to
|
|
8
|
+
* a function) — then the seed ships whole, exactly as before shaping existed.
|
|
9
|
+
*/
|
|
10
|
+
/** What a region asks of the page seed: nothing, everything, or these keys of `page.data`. */
|
|
11
|
+
export type SeedAsk = false | "all" | readonly string[];
|
|
12
|
+
/** The request's union of asks: `'all'`, or the key set. (No ask at all = no seed.) */
|
|
13
|
+
export type SeedKeys = "all" | Set<string>;
|
|
14
|
+
/** Fold one region's ask into the request's union. */
|
|
15
|
+
export declare function merge_seed_ask(current: SeedKeys | null, ask: SeedAsk): SeedKeys | null;
|
|
16
|
+
/**
|
|
17
|
+
* The slice of `page.data` to ship. A plain object is picked down to `keys` (present keys only — a
|
|
18
|
+
* key the load never returned stays absent, so `page.data.x` is `undefined` on both legs alike);
|
|
19
|
+
* `'all'`, or a non-object (a load returned nothing, or something exotic), ships as is. A key
|
|
20
|
+
* whose value is a promise stays a promise: the streaming/settling that follows sees the same shape.
|
|
21
|
+
*/
|
|
22
|
+
export declare function shape_page_data(data: unknown, keys: SeedKeys | null): unknown;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/server/seed-shape.ts
|
|
2
|
+
/** Fold one region's ask into the request's union. */
|
|
3
|
+
function merge_seed_ask(current, ask) {
|
|
4
|
+
if (ask === false) return current;
|
|
5
|
+
if (ask === "all" || current === "all") return "all";
|
|
6
|
+
const next = current ?? /* @__PURE__ */ new Set();
|
|
7
|
+
for (const k of ask) next.add(k);
|
|
8
|
+
return next;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The slice of `page.data` to ship. A plain object is picked down to `keys` (present keys only — a
|
|
12
|
+
* key the load never returned stays absent, so `page.data.x` is `undefined` on both legs alike);
|
|
13
|
+
* `'all'`, or a non-object (a load returned nothing, or something exotic), ships as is. A key
|
|
14
|
+
* whose value is a promise stays a promise: the streaming/settling that follows sees the same shape.
|
|
15
|
+
*/
|
|
16
|
+
function shape_page_data(data, keys) {
|
|
17
|
+
if (keys === null || keys === "all") return data;
|
|
18
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) return data;
|
|
19
|
+
const src = data;
|
|
20
|
+
const out = {};
|
|
21
|
+
for (const k of keys) if (Object.prototype.hasOwnProperty.call(src, k)) out[k] = src[k];
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
export { merge_seed_ask, shape_page_data };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The default for how long after expiry a capability can still be renewed
|
|
2
|
+
* (`maxPageAge`): the longest a stale document is expected to live in a shared cache (a
|
|
3
|
+
* week of `s-maxage` plus a day of revalidation). */
|
|
4
|
+
export declare const RENEW_WINDOW_SEC: number;
|
|
5
|
+
/**
|
|
6
|
+
* How long shared caches may serve a document with this `cache-control`, in seconds: its freshness
|
|
7
|
+
* (`s-maxage`, else `max-age`) plus `stale-while-revalidate`. 0 when shared caches may not keep it
|
|
8
|
+
* (`private`, `no-store`) or must revalidate every use (`no-cache`). `max-age` counts without
|
|
9
|
+
* `public`: a shared cache may store any response not marked `private` (RFC 9111 §3).
|
|
10
|
+
* `stale-if-error` does not count: it serves a stale copy only while the origin is failing, when a
|
|
11
|
+
* hole could not render anyway.
|
|
12
|
+
*/
|
|
13
|
+
export declare function shared_cache_lifetime(cache_control: string): number;
|
|
14
|
+
/**
|
|
15
|
+
* The capability lifetime to mint with: prerender-grade for a stored page (prerender / postrender);
|
|
16
|
+
* for an anonymous hole on a document shared caches keep for `shared` seconds, twice that (so the
|
|
17
|
+
* window-aligned expiry still covers the whole cache life), capped at prerender-grade; else
|
|
18
|
+
* `ttl`. A session-bound hole is never extended — its document is the visitor's own.
|
|
19
|
+
*/
|
|
20
|
+
export declare function mint_ttl_sec(o: {
|
|
21
|
+
stored: boolean;
|
|
22
|
+
session: string;
|
|
23
|
+
shared: number;
|
|
24
|
+
region_ttl: number;
|
|
25
|
+
}): number;
|
|
26
|
+
/** A renewable expiry: an integer that HAS passed, by at most `window` seconds (the app's
|
|
27
|
+
* `maxPageAge`; `0` renews nothing). */
|
|
28
|
+
export declare function renewable_expiry(exp_raw: string, now_sec: number, window?: number): boolean;
|
|
29
|
+
/** Why a capability's `exp` refuses it, or null: past it (`expired`); for a renewal, not inside
|
|
30
|
+
* the renew window (`renew-window`), so a URL that has not expired never renews. */
|
|
31
|
+
export declare function expiry_refusal(exp_raw: string, now_sec: number, renewal: boolean, window: number): "expired" | "renew-window" | null;
|
|
32
|
+
/** The handle: a load set `cache-control` on this page request. */
|
|
33
|
+
export declare function note_cache_control(request: Request, cache_control: string): void;
|
|
34
|
+
/** The mint: how long shared caches keep the document this request renders (0 = unknown / none). */
|
|
35
|
+
export declare function document_shared_lifetime(request: Request | null | undefined): number;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { PRERENDER_REGION_TTL_SEC } from "./endpoint.js";
|
|
2
|
+
// src/server/shared-cache.ts
|
|
3
|
+
/**
|
|
4
|
+
* HOLES ON A CACHED DOCUMENT — a deferred hole's capability must outlive the document it sits in.
|
|
5
|
+
*
|
|
6
|
+
* A page whose load says `cache-control: public, s-maxage=604800` is served from a CDN for a week,
|
|
7
|
+
* but its holes were minted for `ttl` (an hour by default, capped at a day): once that passed,
|
|
8
|
+
* every visitor served the cached copy got a 403 for every hole, and nothing logged it. Prerender
|
|
9
|
+
* already solves the same problem by signing for the life of the deploy; this is the request-time
|
|
10
|
+
* equivalent, bounded by what the app itself declared.
|
|
11
|
+
*
|
|
12
|
+
* 1. The handle notes the `cache-control` a load sets (`setHeaders`) on the page request; the mint
|
|
13
|
+
* reads it and signs an ANONYMOUS hole for twice that lifetime (`capability_expiry` guarantees
|
|
14
|
+
* only half of a ttl). Same safety argument as prerender: the props are already in the public
|
|
15
|
+
* HTML, and nothing session-bound is extended.
|
|
16
|
+
* 2. A document already cached with short-lived holes (or one whose cache header a handle set after
|
|
17
|
+
* the render, where the mint cannot see it) is rescued by RENEWAL: the runtime retries an expired
|
|
18
|
+
* hole once with `&renew=1`, and the handle re-signs a capability it minted itself, anonymous,
|
|
19
|
+
* expired by at most {@link RENEW_WINDOW_SEC}.
|
|
20
|
+
*
|
|
21
|
+
* State rides ONE `globalThis` + `Symbol.for` slot (the PAGE-STATE-SINGLETON law): the handle
|
|
22
|
+
* (hooks.js) records and the mint (server/region-endpoint.js) reads, and dist entries can each carry
|
|
23
|
+
* their own evaluation of this module — a module-local map would split the seam.
|
|
24
|
+
*/
|
|
25
|
+
/** The default for how long after expiry a capability can still be renewed
|
|
26
|
+
* (`maxPageAge`): the longest a stale document is expected to live in a shared cache (a
|
|
27
|
+
* week of `s-maxage` plus a day of revalidation). */
|
|
28
|
+
const RENEW_WINDOW_SEC = 691200;
|
|
29
|
+
/**
|
|
30
|
+
* How long shared caches may serve a document with this `cache-control`, in seconds: its freshness
|
|
31
|
+
* (`s-maxage`, else `max-age`) plus `stale-while-revalidate`. 0 when shared caches may not keep it
|
|
32
|
+
* (`private`, `no-store`) or must revalidate every use (`no-cache`). `max-age` counts without
|
|
33
|
+
* `public`: a shared cache may store any response not marked `private` (RFC 9111 §3).
|
|
34
|
+
* `stale-if-error` does not count: it serves a stale copy only while the origin is failing, when a
|
|
35
|
+
* hole could not render anyway.
|
|
36
|
+
*/
|
|
37
|
+
function shared_cache_lifetime(cache_control) {
|
|
38
|
+
let s_maxage = -1;
|
|
39
|
+
let max_age = -1;
|
|
40
|
+
let swr = 0;
|
|
41
|
+
for (const part of cache_control.toLowerCase().split(",")) {
|
|
42
|
+
const eq = part.indexOf("=");
|
|
43
|
+
const name = (eq === -1 ? part : part.slice(0, eq)).trim();
|
|
44
|
+
if (name === "private" || name === "no-store" || name === "no-cache") return 0;
|
|
45
|
+
if (eq === -1) continue;
|
|
46
|
+
const n = seconds(part.slice(eq + 1));
|
|
47
|
+
if (n === null) continue;
|
|
48
|
+
if (name === "s-maxage") s_maxage = n;
|
|
49
|
+
else if (name === "max-age") max_age = n;
|
|
50
|
+
else if (name === "stale-while-revalidate") swr = n;
|
|
51
|
+
}
|
|
52
|
+
return (s_maxage >= 0 ? s_maxage : max_age >= 0 ? max_age : 0) + swr;
|
|
53
|
+
}
|
|
54
|
+
/** A delta-seconds value (optionally quoted), or null. */
|
|
55
|
+
function seconds(raw) {
|
|
56
|
+
let v = raw.trim();
|
|
57
|
+
if (v.length >= 2 && v[0] === "\"" && v[v.length - 1] === "\"") v = v.slice(1, -1);
|
|
58
|
+
if (v === "" || v.length > 10) return null;
|
|
59
|
+
for (let i = 0; i < v.length; i++) {
|
|
60
|
+
const c = v.charCodeAt(i);
|
|
61
|
+
if (c < 48 || c > 57) return null;
|
|
62
|
+
}
|
|
63
|
+
return Number(v);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The capability lifetime to mint with: prerender-grade for a stored page (prerender / postrender);
|
|
67
|
+
* for an anonymous hole on a document shared caches keep for `shared` seconds, twice that (so the
|
|
68
|
+
* window-aligned expiry still covers the whole cache life), capped at prerender-grade; else
|
|
69
|
+
* `ttl`. A session-bound hole is never extended — its document is the visitor's own.
|
|
70
|
+
*/
|
|
71
|
+
function mint_ttl_sec(o) {
|
|
72
|
+
if (o.stored) return PRERENDER_REGION_TTL_SEC;
|
|
73
|
+
if (o.session !== "" || o.shared <= 0) return o.region_ttl;
|
|
74
|
+
return Math.min(PRERENDER_REGION_TTL_SEC, Math.max(o.region_ttl, 2 * o.shared));
|
|
75
|
+
}
|
|
76
|
+
/** A renewable expiry: an integer that HAS passed, by at most `window` seconds (the app's
|
|
77
|
+
* `maxPageAge`; `0` renews nothing). */
|
|
78
|
+
function renewable_expiry(exp_raw, now_sec, window = RENEW_WINDOW_SEC) {
|
|
79
|
+
if (window <= 0 || exp_raw === "" || exp_raw.length > 12) return false;
|
|
80
|
+
for (let i = 0; i < exp_raw.length; i++) {
|
|
81
|
+
const c = exp_raw.charCodeAt(i);
|
|
82
|
+
if (c < 48 || c > 57) return false;
|
|
83
|
+
}
|
|
84
|
+
const exp = Number(exp_raw);
|
|
85
|
+
return exp < now_sec && now_sec - exp <= window;
|
|
86
|
+
}
|
|
87
|
+
/** Why a capability's `exp` refuses it, or null: past it (`expired`); for a renewal, not inside
|
|
88
|
+
* the renew window (`renew-window`), so a URL that has not expired never renews. */
|
|
89
|
+
function expiry_refusal(exp_raw, now_sec, renewal, window) {
|
|
90
|
+
if (renewal) return renewable_expiry(exp_raw, now_sec, window) ? null : "renew-window";
|
|
91
|
+
const exp = Number(exp_raw);
|
|
92
|
+
return !Number.isFinite(exp) || exp < now_sec ? "expired" : null;
|
|
93
|
+
}
|
|
94
|
+
const SLOT_KEY = Symbol.for("ogygia.shared-cache");
|
|
95
|
+
const slot = globalThis[SLOT_KEY] ??= { by_request: /* @__PURE__ */ new WeakMap() };
|
|
96
|
+
/** The handle: a load set `cache-control` on this page request. */
|
|
97
|
+
function note_cache_control(request, cache_control) {
|
|
98
|
+
slot.by_request.set(request, shared_cache_lifetime(cache_control));
|
|
99
|
+
}
|
|
100
|
+
/** The mint: how long shared caches keep the document this request renders (0 = unknown / none). */
|
|
101
|
+
function document_shared_lifetime(request) {
|
|
102
|
+
return request ? slot.by_request.get(request) ?? 0 : 0;
|
|
103
|
+
}
|
|
104
|
+
export { RENEW_WINDOW_SEC, document_shared_lifetime, expiry_refusal, mint_ttl_sec, note_cache_control, renewable_expiry, shared_cache_lifetime };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SigningKey {
|
|
2
|
+
secret: string;
|
|
3
|
+
/** env-provided: survives redeploys and is shared by every deployment that sets the same value */
|
|
4
|
+
stable: boolean;
|
|
5
|
+
/** 8-char key fingerprint (`&k=` on capabilities, `x-ogygia-key` on refusals) */
|
|
6
|
+
fp: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function signing_key(): SigningKey;
|
|
9
|
+
export declare function key_fingerprint(secret: string): string;
|
|
10
|
+
/** Tests: forget the decided key. */
|
|
11
|
+
export declare function reset_signing_key(): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { buildHadSecret, buildKey } from "virtual:ogygia/secret";
|
|
2
|
+
import { sign } from "virtual:ogygia/sign";
|
|
3
|
+
import { building } from "$app/env";
|
|
4
|
+
// src/server/signing-key.ts
|
|
5
|
+
/**
|
|
6
|
+
* THE region signing key, decided once at first use (the first mint or verify), not at module eval:
|
|
7
|
+
* a host that fills `process.env` after the server's modules load (an adapter loading a `.env` late)
|
|
8
|
+
* still counts. The runtime's `OGYGIA_SECRET` wins; else this build's random key.
|
|
9
|
+
*
|
|
10
|
+
* A capability carries its minter's key FINGERPRINT (`&k=`): an HMAC of a constant under the key —
|
|
11
|
+
* the same on every instance sharing the key, and it reveals nothing of the key. A deployment that
|
|
12
|
+
* verifies a capability minted under another key can then say so (`x-ogygia-deny: foreign-key`)
|
|
13
|
+
* instead of an opaque 403: the page and its islands endpoint came from different deployments (a CDN
|
|
14
|
+
* routing them to two backends, HTML cached across a key change).
|
|
15
|
+
*/
|
|
16
|
+
let key;
|
|
17
|
+
function signing_key() {
|
|
18
|
+
if (key) return key;
|
|
19
|
+
const from_env = typeof process !== "undefined" && process.env?.OGYGIA_SECRET || "";
|
|
20
|
+
const secret = from_env || buildKey;
|
|
21
|
+
key = {
|
|
22
|
+
secret,
|
|
23
|
+
stable: from_env !== "",
|
|
24
|
+
fp: key_fingerprint(secret)
|
|
25
|
+
};
|
|
26
|
+
if (!key.stable && !import.meta.env.DEV) warn_build_key();
|
|
27
|
+
return key;
|
|
28
|
+
}
|
|
29
|
+
function key_fingerprint(secret) {
|
|
30
|
+
return sign(secret, "ogygia:key-fp").slice(0, 8);
|
|
31
|
+
}
|
|
32
|
+
/** One message per process (a shared Symbol: one across every copy of this module): a server
|
|
33
|
+
* signing with this build's random key. */
|
|
34
|
+
function warn_build_key() {
|
|
35
|
+
const g = globalThis;
|
|
36
|
+
const K = Symbol.for("ogygia.build-key-warned");
|
|
37
|
+
if (g[K]) return;
|
|
38
|
+
g[K] = true;
|
|
39
|
+
if (building) console.warn("[ogygia] prerendered page mints region capabilities signed with a per-build random key — they stop verifying after your next deploy while the static HTML lives on. Set a stable OGYGIA_SECRET env var so prerendered holes survive redeploys.");
|
|
40
|
+
else if (buildHadSecret) console.error("[ogygia] OGYGIA_SECRET was set when this app was built but is not set where it runs: region capabilities are signed with this build's random key, so every hole minted by another deployment (another backend behind the same CDN, the previous deploy) is refused (403, x-ogygia-deny: foreign-key). Set OGYGIA_SECRET in the server's runtime environment.");
|
|
41
|
+
else console.warn("[ogygia] OGYGIA_SECRET is not set: region capabilities are signed with this build's random key, so a page cached across a deploy, or served by another deployment than its islands endpoint, gets its holes refused (403, x-ogygia-deny: foreign-key). Set a stable OGYGIA_SECRET.");
|
|
42
|
+
}
|
|
43
|
+
/** Tests: forget the decided key. */
|
|
44
|
+
function reset_signing_key() {
|
|
45
|
+
key = void 0;
|
|
46
|
+
}
|
|
47
|
+
export { key_fingerprint, reset_signing_key, signing_key };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class SizedLru<V> {
|
|
2
|
+
#private;
|
|
3
|
+
readonly max_bytes: number;
|
|
4
|
+
readonly max_entries: number;
|
|
5
|
+
constructor(max_bytes: number, max_entries: number);
|
|
6
|
+
/** The live value for `key` (an LRU touch), or `null` on a miss or past `expires`. */
|
|
7
|
+
get(key: string, now: number): V | null;
|
|
8
|
+
has(key: string): boolean;
|
|
9
|
+
/** Store `value` (`bytes` big, live until `expires`), evicting the least recently used entries
|
|
10
|
+
* to make room. A value larger than the whole budget is not stored. */
|
|
11
|
+
set(key: string, value: V, bytes: number, expires: number): void;
|
|
12
|
+
delete(key: string): boolean;
|
|
13
|
+
/** Every live key (insertion order — least recently used first). */
|
|
14
|
+
keys(): IterableIterator<string>;
|
|
15
|
+
/** Drop everything past `expires` (harness counts want live entries only). */
|
|
16
|
+
sweep(now: number): void;
|
|
17
|
+
clear(): void;
|
|
18
|
+
get size(): number;
|
|
19
|
+
get bytes(): number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// src/server/sized-lru.ts
|
|
2
|
+
var SizedLru = class {
|
|
3
|
+
#entries = /* @__PURE__ */ new Map();
|
|
4
|
+
#bytes = 0;
|
|
5
|
+
max_bytes;
|
|
6
|
+
max_entries;
|
|
7
|
+
constructor(max_bytes, max_entries) {
|
|
8
|
+
this.max_bytes = max_bytes;
|
|
9
|
+
this.max_entries = max_entries;
|
|
10
|
+
}
|
|
11
|
+
/** The live value for `key` (an LRU touch), or `null` on a miss or past `expires`. */
|
|
12
|
+
get(key, now) {
|
|
13
|
+
const e = this.#entries.get(key);
|
|
14
|
+
if (e === void 0) return null;
|
|
15
|
+
if (now >= e.expires) {
|
|
16
|
+
this.delete(key);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
this.#entries.delete(key);
|
|
20
|
+
this.#entries.set(key, e);
|
|
21
|
+
return e.value;
|
|
22
|
+
}
|
|
23
|
+
has(key) {
|
|
24
|
+
return this.#entries.has(key);
|
|
25
|
+
}
|
|
26
|
+
/** Store `value` (`bytes` big, live until `expires`), evicting the least recently used entries
|
|
27
|
+
* to make room. A value larger than the whole budget is not stored. */
|
|
28
|
+
set(key, value, bytes, expires) {
|
|
29
|
+
this.delete(key);
|
|
30
|
+
if (bytes > this.max_bytes) return;
|
|
31
|
+
while (this.#entries.size > 0 && (this.#bytes + bytes > this.max_bytes || this.#entries.size >= this.max_entries)) {
|
|
32
|
+
const oldest = this.#entries.keys().next().value;
|
|
33
|
+
this.delete(oldest);
|
|
34
|
+
}
|
|
35
|
+
this.#entries.set(key, {
|
|
36
|
+
value,
|
|
37
|
+
bytes,
|
|
38
|
+
expires
|
|
39
|
+
});
|
|
40
|
+
this.#bytes += bytes;
|
|
41
|
+
}
|
|
42
|
+
delete(key) {
|
|
43
|
+
const e = this.#entries.get(key);
|
|
44
|
+
if (e === void 0) return false;
|
|
45
|
+
this.#entries.delete(key);
|
|
46
|
+
this.#bytes -= e.bytes;
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
/** Every live key (insertion order — least recently used first). */
|
|
50
|
+
keys() {
|
|
51
|
+
return this.#entries.keys();
|
|
52
|
+
}
|
|
53
|
+
/** Drop everything past `expires` (harness counts want live entries only). */
|
|
54
|
+
sweep(now) {
|
|
55
|
+
for (const [key, e] of this.#entries) if (now >= e.expires) this.delete(key);
|
|
56
|
+
}
|
|
57
|
+
clear() {
|
|
58
|
+
this.#entries.clear();
|
|
59
|
+
this.#bytes = 0;
|
|
60
|
+
}
|
|
61
|
+
get size() {
|
|
62
|
+
return this.#entries.size;
|
|
63
|
+
}
|
|
64
|
+
get bytes() {
|
|
65
|
+
return this.#bytes;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export { SizedLru };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export type RegionKind = "island" | "lake" | "hole";
|
|
2
|
+
export interface RegionSpan {
|
|
3
|
+
/** `island` = a hydrated region (its bytes are off-limits to any post-SSR reshaping); `lake` = a
|
|
4
|
+
* frozen (`wake="none"`) subtree, server HTML the browser never re-creates; `hole` = a deferred
|
|
5
|
+
* region whose current markup is the page's fallback, not a hydration tree. */
|
|
6
|
+
kind: RegionKind;
|
|
7
|
+
/** Index of the `<` that opens `<ogygia-region …>`. */
|
|
8
|
+
start: number;
|
|
9
|
+
/** Index one past the `>` that closes `</ogygia-region>`. `[start, end)` is the whole element. */
|
|
10
|
+
end: number;
|
|
11
|
+
/** Index one past the `>` of the OPENING tag — the first byte of the region's inner HTML. */
|
|
12
|
+
innerStart: number;
|
|
13
|
+
/** Index of the `<` of the CLOSING tag — one past the last byte of the inner HTML.
|
|
14
|
+
* `[innerStart, innerEnd)` is the inner HTML a reshaping pass may edit for a lake / hole. */
|
|
15
|
+
innerEnd: number;
|
|
16
|
+
/** The opening tag's attributes (unquoted values). Read `wake` / `endpoint` / `entry` here. */
|
|
17
|
+
attrs: Readonly<Record<string, string>>;
|
|
18
|
+
/** Nesting depth — `0` for a top-level region, `1` for one directly inside a lake / hole, and so
|
|
19
|
+
* on. Island subtrees are never entered, so a region deeper than `0` is always inside a lake or
|
|
20
|
+
* hole (never inside another island). */
|
|
21
|
+
depth: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parse a tag's attribute run (everything between the tag name and its `>`) into a lower-cased map
|
|
25
|
+
* with quotes stripped. Shared by the region opener and the `<og-lift>` placeholder on restore.
|
|
26
|
+
*
|
|
27
|
+
* Hand-written (measured faster, no match arrays) with the rules the pattern
|
|
28
|
+
* `([^\s/>=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s/>]+))?` had, quirks included: a value is a closed
|
|
29
|
+
* `"…"`, else a closed `'…'`, else an unquoted run (which may start with an unclosed quote — then
|
|
30
|
+
* the first and last characters are stripped, as before); `=` with no value leaves the name valueless.
|
|
31
|
+
* @internal Exported for test/regex-replacements.test.ts.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parse_attr_string(inner: string): Record<string, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Yield every `<ogygia-region>` in `html`, in document order, an island's subtree treated as atomic
|
|
36
|
+
* (its nested regions are not yielded). One linear pass, O(html length); allocates no copy of the
|
|
37
|
+
* document. See the module doc for why this exists and how to use it.
|
|
38
|
+
*/
|
|
39
|
+
export declare function scanRegions(html: string): Generator<RegionSpan, void, undefined>;
|
|
40
|
+
export interface LiftedRegion {
|
|
41
|
+
/** `island` bytes must be restored VERBATIM (reshaping them breaks hydration); a `lake` / `hole`
|
|
42
|
+
* MAY be reshaped first via {@link LiftedRegion.withInner}. */
|
|
43
|
+
readonly kind: RegionKind;
|
|
44
|
+
/** The opening tag's attributes (`wake` / `endpoint` / `entry` …), lower-cased. */
|
|
45
|
+
readonly attrs: Readonly<Record<string, string>>;
|
|
46
|
+
/** `<ogygia-region …>` — the opening tag, verbatim. */
|
|
47
|
+
readonly openTag: string;
|
|
48
|
+
/** The region's inner HTML (`''` for a self-closed or unterminated region). */
|
|
49
|
+
readonly innerHtml: string;
|
|
50
|
+
/** `</ogygia-region>` — the closing tag (`''` for a self-closed or unterminated region). */
|
|
51
|
+
readonly closeTag: string;
|
|
52
|
+
/** `openTag + innerHtml + closeTag`. */
|
|
53
|
+
readonly outerHtml: string;
|
|
54
|
+
/** Ties this region to its `<og-lift data-i="…">` placeholder in the shell. */
|
|
55
|
+
readonly index: number;
|
|
56
|
+
/** A copy with the inner HTML replaced — for a lake / hole whose inner a caller has rendered. The
|
|
57
|
+
* opening / closing tags and the index are preserved. Do NOT call this for an island. */
|
|
58
|
+
withInner(innerHtml: string): LiftedRegion;
|
|
59
|
+
}
|
|
60
|
+
export interface LiftResult {
|
|
61
|
+
/** The document with every TOP-LEVEL region replaced by an `<og-lift data-i="…"></og-lift>`
|
|
62
|
+
* placeholder — the only part a foreign renderer should be handed. */
|
|
63
|
+
shell: string;
|
|
64
|
+
/** The lifted regions, in document order, index-aligned to their placeholders. */
|
|
65
|
+
regions: LiftedRegion[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Lift every TOP-LEVEL `<ogygia-region>` out of `html`, leaving an `<og-lift>` placeholder where each
|
|
69
|
+
* was. Hand `shell` to the foreign renderer (and, to render a lake / hole, its `innerHtml` — recurse
|
|
70
|
+
* with `liftRegions` there so islands nested inside it stay protected), then {@link restoreRegions}.
|
|
71
|
+
* Islands come back verbatim. A region deeper than top level rides inside its parent's `outerHtml`.
|
|
72
|
+
*/
|
|
73
|
+
export declare function liftRegions(html: string): LiftResult;
|
|
74
|
+
/**
|
|
75
|
+
* Splice lifted regions back over their `<og-lift>` placeholders, transplanting any attributes the
|
|
76
|
+
* foreign renderer stamped on a placeholder (scoped slot marks — a `sc-*` class, `c-id`, `s-sn`)
|
|
77
|
+
* onto the region's opening tag. The placeholder is matched loosely because the renderer annotates
|
|
78
|
+
* it; only opening-tag attributes are merged, never the region's light DOM. An unknown placeholder
|
|
79
|
+
* is left in place rather than dropped.
|
|
80
|
+
*/
|
|
81
|
+
export declare function restoreRegions(shell: string, regions: readonly LiftedRegion[]): string;
|