@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,351 @@
|
|
|
1
|
+
import { mint, register_kind } from "./ref.js";
|
|
2
|
+
import { kit_render_context, kit_request_event } from "./server/kit-context.js";
|
|
3
|
+
import { islands_endpoint } from "./server/endpoint.js";
|
|
4
|
+
import { PORTABLE_FORM, with_portable_forms } from "./portable-form.js";
|
|
5
|
+
import { analyze } from "./seed-refs.js";
|
|
6
|
+
import { fnv1a, fnv1a32 } from "./runtime/hash.js";
|
|
7
|
+
import { import_entry } from "./runtime/entry-locations.js";
|
|
8
|
+
import { createRawSnippet, getAllContexts, hydrate, unmount } from "svelte";
|
|
9
|
+
import { render } from "svelte/server";
|
|
10
|
+
import { BROWSER, DEV } from "esm-env";
|
|
11
|
+
// src/region-snippet.ts
|
|
12
|
+
/**
|
|
13
|
+
* Region snippets — the snippet shape of a region. "Everything that crosses an island boundary is a
|
|
14
|
+
* region; components and snippets are its two shapes; static freezes, live wakes."
|
|
15
|
+
*
|
|
16
|
+
* A snippet handed to a component is a function, so it can't cross an island boundary directly (devalue
|
|
17
|
+
* can't stringify a function). A region snippet is a real Svelte snippet — same-graph `{@render}`
|
|
18
|
+
* renders it inline — that also carries a serializable DESCRIPTOR and knows how to REVIVE on the far
|
|
19
|
+
* side. One primitive, two modes:
|
|
20
|
+
*
|
|
21
|
+
* - **live** — the compiler, at a snippet's DEFINITION site, compiles its body into an island ENTRY
|
|
22
|
+
* and constructs a live region snippet (`{ m:'live', e, p }`). It renders the entry inline on the
|
|
23
|
+
* server and HYDRATES it on the client, so the markup comes alive. This is the former "portable
|
|
24
|
+
* snippet" path, unchanged in behavior, now expressed as the live mode of this one primitive.
|
|
25
|
+
* - **static** — a PLAIN snippet reaching a boundary is FROZEN to its server-rendered HTML
|
|
26
|
+
* (`{ m:'static', h }`). The client adopts that HTML byte-for-byte; nothing re-runs. No compiler
|
|
27
|
+
* involvement, so it survives wrappers, re-exports, and a consumer swapping in their own component.
|
|
28
|
+
* Correct for markdown content (prose, code): static, never reactive.
|
|
29
|
+
*
|
|
30
|
+
* The boundary law lives in ONE place — {@link reduce_region_snippet}: a branded region snippet crosses
|
|
31
|
+
* as its descriptor; a bare snippet is captured static; a parameterized snippet that can't be frozen
|
|
32
|
+
* throws, loudly. Revival is its single inverse, {@link revive_region_snippet}. `createRawSnippet` is
|
|
33
|
+
* isomorphic (server calls `render`, client calls `setup`), so one factory serves both legs of both
|
|
34
|
+
* modes with no manual environment branch.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* A hand-written SERVER component that renders a bare snippet: svelte has no public API to
|
|
38
|
+
* stringify a snippet, but a server component is just `($$renderer, $$props) => void` and a server
|
|
39
|
+
* snippet is `($$renderer) => void` — so the component simply invokes the snippet. Hand-written
|
|
40
|
+
* (not a `.svelte` file) so this module stays importable from plain node (endpoints, tests)
|
|
41
|
+
* without a svelte compiler in the loader.
|
|
42
|
+
*/
|
|
43
|
+
const RenderSnippet = (($$renderer, $$props) => {
|
|
44
|
+
$$props.s($$renderer);
|
|
45
|
+
});
|
|
46
|
+
/** Devalue custom-type name a region snippet crosses under (wire-stable; was `OgygiaS`). */
|
|
47
|
+
const REGION_SNIPPET_WIRE_KEY = "OgygiaS";
|
|
48
|
+
const WRAP_OPEN = "<ogygia-snippet style=\"display:contents\">";
|
|
49
|
+
const WRAP_CLOSE = "</ogygia-snippet>";
|
|
50
|
+
const STATIC_OPEN = "<ogygia-snippet data-og-static style=\"display:contents\">";
|
|
51
|
+
const host_context = () => {
|
|
52
|
+
try {
|
|
53
|
+
return getAllContexts();
|
|
54
|
+
} catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/** context.ts `isInLiveSnippet` reads it: a hole in the body stays deferred (Region.svelte). */
|
|
59
|
+
const LIVE_SNIPPET_KEY = Symbol.for("ogygia.live-snippet");
|
|
60
|
+
const with_host = (context, host) => {
|
|
61
|
+
if (host) for (const [k, v] of host) context.set(k, v);
|
|
62
|
+
context.set(LIVE_SNIPPET_KEY, true);
|
|
63
|
+
return context;
|
|
64
|
+
};
|
|
65
|
+
/** Where a live snippet's pending hydrate waits on its host region: a global key, as the runtime
|
|
66
|
+
* bundle and each island-entry bundle carry their own copy of this module (runtime/core.ts reads it). */
|
|
67
|
+
const SNIPPET_BOOTS = Symbol.for("ogygia.snippet-boots");
|
|
68
|
+
/** The host region is awake only once its snippets are: it signals `data-hydrated` after them. */
|
|
69
|
+
function hold_host(el, booted) {
|
|
70
|
+
const host = el.closest("ogygia-region");
|
|
71
|
+
if (host && !host.hasAttribute("data-hydrated")) (host[SNIPPET_BOOTS] ??= []).push(booted);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The ONE factory. Build a region snippet from its descriptor (+ the live entry when we're at its
|
|
75
|
+
* definition site and it's in the same bundle). Handles both modes and both legs.
|
|
76
|
+
*/
|
|
77
|
+
function make(desc, live_entry = null) {
|
|
78
|
+
if (desc.m === "slot") {
|
|
79
|
+
const el = BROWSER ? document.querySelector(`ogygia-slot[data-og-slot="${desc.id}"]`) : null;
|
|
80
|
+
const h = el ? el.outerHTML : slot_marker_open(desc.id) + SLOT_MARKER_CLOSE;
|
|
81
|
+
const slot_snip = createRawSnippet(() => ({
|
|
82
|
+
render: () => h,
|
|
83
|
+
setup: () => {}
|
|
84
|
+
}));
|
|
85
|
+
slot_snip.__ogRegion = desc;
|
|
86
|
+
return slot_snip;
|
|
87
|
+
}
|
|
88
|
+
if (!BROWSER && desc.m === "live") {
|
|
89
|
+
const thread_head = (r, head) => {
|
|
90
|
+
if (head && typeof r.head === "function") r.head((child) => child.push(head));
|
|
91
|
+
};
|
|
92
|
+
const dev_css_link = DEV ? `<link rel="modulepreload" href="${desc.e}" data-ogygia-region-css>` : "";
|
|
93
|
+
const server_snip = ((renderer, ...args) => {
|
|
94
|
+
const props = args.length ? {
|
|
95
|
+
...desc.p,
|
|
96
|
+
__ogArgs: args
|
|
97
|
+
} : desc.p;
|
|
98
|
+
const host = host_context();
|
|
99
|
+
if (!!live_entry && renderer?.global?.mode === "async" && typeof renderer.child === "function") renderer.child(async (r) => {
|
|
100
|
+
const out = await render(live_entry, {
|
|
101
|
+
props,
|
|
102
|
+
context: with_host(kit_render_context(), host)
|
|
103
|
+
});
|
|
104
|
+
thread_head(r, (out.head || "") + dev_css_link);
|
|
105
|
+
r.push(WRAP_OPEN + out.body + WRAP_CLOSE);
|
|
106
|
+
});
|
|
107
|
+
else {
|
|
108
|
+
const out = live_entry ? render(live_entry, {
|
|
109
|
+
props,
|
|
110
|
+
context: with_host(kit_render_context(), host)
|
|
111
|
+
}) : {
|
|
112
|
+
head: "",
|
|
113
|
+
body: ""
|
|
114
|
+
};
|
|
115
|
+
thread_head(renderer, (out.head || "") + dev_css_link);
|
|
116
|
+
renderer.push(WRAP_OPEN + out.body + WRAP_CLOSE);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
server_snip.__ogRegion = desc;
|
|
120
|
+
return server_snip;
|
|
121
|
+
}
|
|
122
|
+
const snip = createRawSnippet((...params) => {
|
|
123
|
+
const host = host_context();
|
|
124
|
+
const live_props = () => desc.m === "live" ? params.length ? {
|
|
125
|
+
...desc.p,
|
|
126
|
+
__ogArgs: params.map((g) => g())
|
|
127
|
+
} : desc.p : {};
|
|
128
|
+
return {
|
|
129
|
+
render: () => {
|
|
130
|
+
if (desc.m === "static") return STATIC_OPEN + desc.h + WRAP_CLOSE;
|
|
131
|
+
return WRAP_OPEN + (BROWSER || !live_entry ? "" : render(live_entry, {
|
|
132
|
+
props: live_props(),
|
|
133
|
+
context: with_host(kit_render_context(), host)
|
|
134
|
+
}).body) + WRAP_CLOSE;
|
|
135
|
+
},
|
|
136
|
+
setup: (el) => {
|
|
137
|
+
if (desc.m === "static") return;
|
|
138
|
+
let app;
|
|
139
|
+
let dead = false;
|
|
140
|
+
const boot = (Comp) => {
|
|
141
|
+
if (!dead) app = hydrate(Comp, {
|
|
142
|
+
target: el,
|
|
143
|
+
props: live_props(),
|
|
144
|
+
context: with_host(/* @__PURE__ */ new Map(), host)
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
if (live_entry) boot(live_entry);
|
|
148
|
+
else hold_host(el, import_entry(desc.e).then((m) => boot(m.default)));
|
|
149
|
+
return () => {
|
|
150
|
+
dead = true;
|
|
151
|
+
if (app) unmount(app);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
snip.__ogRegion = desc;
|
|
157
|
+
return snip;
|
|
158
|
+
}
|
|
159
|
+
/** Freeze a plain snippet to a static region snippet by SSR-rendering it once (SERVER only). A snippet
|
|
160
|
+
* that needs parameters can't be frozen — surface that as the actionable boundary error. `label` names
|
|
161
|
+
* the island prop when known, so a plain function passed by mistake points at the right prop. */
|
|
162
|
+
function capture_static(snippet, label) {
|
|
163
|
+
let body;
|
|
164
|
+
try {
|
|
165
|
+
body = render(RenderSnippet, {
|
|
166
|
+
props: { s: snippet },
|
|
167
|
+
context: kit_render_context()
|
|
168
|
+
}).body;
|
|
169
|
+
} catch (e) {
|
|
170
|
+
const where = label ? `prop \`${label}\`` : "a function prop";
|
|
171
|
+
throw new Error(`[ogygia] ${where} is a function that can't cross the island boundary — ${e instanceof Error ? e.message : String(e)}. Island props must be SERIALIZABLE; a function crosses only as a Svelte snippet that freezes to HTML, and this one didn't. Usually one of:\n • it's a PLAIN function (an event handler / callback) — those can't cross into an island; pass serializable data as props and keep the behavior inside the island component;\n • it's a snippet WITH PARAMETERS — declare it as a {#snippet} so it crosses LIVE, or pass its data as props;\n • it's children containing a NESTED island — keep those out of frozen children for now.`);
|
|
172
|
+
}
|
|
173
|
+
return make({
|
|
174
|
+
m: "static",
|
|
175
|
+
h: body
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Definition-site factory (compiler-emitted). Brands the snippet AS WRITTEN (`native`) — it keeps
|
|
180
|
+
* rendering in place, in the host's tree: the host's context, its scoped CSS, a nested island as a plain
|
|
181
|
+
* page island — with the descriptor (`__ogRegion`, what crosses the wire) and its PORTABLE form: the
|
|
182
|
+
* body compiled to `Entry`, rendered in isolation on the server and hydrated alone on the client. Only a
|
|
183
|
+
* boundary swaps the portable form in (portable-form.ts, via {@link prepare_region_props}), so the server
|
|
184
|
+
* markup and the client's revived snippet agree. `Entry` is `null` in a client bundle (the far side
|
|
185
|
+
* imports it by url). The native function is branded in place (not wrapped), so its identity — what a
|
|
186
|
+
* `{@render}` keys on — is stable across re-evaluations of the prop.
|
|
187
|
+
*/
|
|
188
|
+
function og_portable(native, Entry, props, url) {
|
|
189
|
+
const desc = {
|
|
190
|
+
m: "live",
|
|
191
|
+
e: url,
|
|
192
|
+
p: props
|
|
193
|
+
};
|
|
194
|
+
const snip = native;
|
|
195
|
+
snip.__ogRegion = desc;
|
|
196
|
+
let portable = null;
|
|
197
|
+
Object.defineProperty(snip, PORTABLE_FORM, {
|
|
198
|
+
configurable: true,
|
|
199
|
+
enumerable: false,
|
|
200
|
+
get: () => portable ??= make(desc, Entry)
|
|
201
|
+
});
|
|
202
|
+
return snip;
|
|
203
|
+
}
|
|
204
|
+
/** Lift a parameterless snippet, or a raw `{ render, setup?, captures? }`, into a region snippet. */
|
|
205
|
+
function region_snippet(input) {
|
|
206
|
+
if (typeof input === "function" && !BROWSER) return capture_static(input);
|
|
207
|
+
if (typeof input === "function") throw new Error("[ogygia] region_snippet(fn) freezes a snippet by server-rendering it — call it during SSR, not on the client. Pass a raw { render, setup } region snippet for client-constructed regions.");
|
|
208
|
+
const caps = input.captures ?? [];
|
|
209
|
+
const snip = createRawSnippet(() => ({
|
|
210
|
+
render: () => WRAP_OPEN + input.render(...caps) + WRAP_CLOSE,
|
|
211
|
+
setup: input.setup ? (el) => void input.setup(el, ...caps) : () => {}
|
|
212
|
+
}));
|
|
213
|
+
snip.__ogRegion = {
|
|
214
|
+
m: "static",
|
|
215
|
+
h: input.render(...caps)
|
|
216
|
+
};
|
|
217
|
+
return snip;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Prepare an island's props for crossing: freeze each BARE snippet prop to a single-rooted static
|
|
221
|
+
* region snippet, so the SAME value renders the island body AND serializes — the body HTML and the
|
|
222
|
+
* revived client snippet then agree byte-for-byte, and hydration adopts cleanly. Server-only (uses SSR
|
|
223
|
+
* capture). A branded (live) snippet, at any depth, is swapped for its PORTABLE form; non-snippet values
|
|
224
|
+
* pass through untouched. Returns the original object when nothing changed (no needless copy).
|
|
225
|
+
*/
|
|
226
|
+
function prepare_region_props(input) {
|
|
227
|
+
if (BROWSER) return input;
|
|
228
|
+
if (analyze(input).json) return input;
|
|
229
|
+
const props = with_portable_forms(input);
|
|
230
|
+
let out = null;
|
|
231
|
+
for (const k in props) {
|
|
232
|
+
const v = props[k];
|
|
233
|
+
if (typeof v === "function" && !v.__ogRegion && v[Symbol.for("ogygia.fn")] === void 0) (out ??= { ...props })[k] = capture_static(v, k);
|
|
234
|
+
}
|
|
235
|
+
return out ?? props;
|
|
236
|
+
}
|
|
237
|
+
/** The SSR marker that fences an island's in-place children so the client can adopt exactly that range.
|
|
238
|
+
* `display:contents` keeps it layout-neutral. */
|
|
239
|
+
function slot_marker_open(id) {
|
|
240
|
+
return `<ogygia-slot data-og-slot="${id}" style="display:contents">`;
|
|
241
|
+
}
|
|
242
|
+
const SLOT_MARKER_CLOSE = "</ogygia-slot>";
|
|
243
|
+
/**
|
|
244
|
+
* Slot marker ids: PER REQUEST, so two renders of the same page mint the same ids and the HTML is
|
|
245
|
+
* byte-identical across requests (a host's post-render cache, a freeze store, an ETag all key on
|
|
246
|
+
* the bytes; a process-wide counter made every page differ from its previous render). Page-unique
|
|
247
|
+
* within one SSR pass is all the id must be — it fences a marker to its payload pointer. A hole
|
|
248
|
+
* response is spliced INTO a page that has its own sequence, so an endpoint render prefixes its
|
|
249
|
+
* ids with its region id and can never collide with the page's. Off-request (a test, a tool, the
|
|
250
|
+
* client) the process counter stands in. The request comes through the kit-context reader the
|
|
251
|
+
* handle installs (no Vite virtual here — this module is imported by plain-Node consumers too).
|
|
252
|
+
*
|
|
253
|
+
* COUNTED PER `key` (the island's entry): with async SSR, regions start in the order their data
|
|
254
|
+
* arrives, so ONE counter for the page gave an island in an async branch a different number on each
|
|
255
|
+
* request (and every island after it). Per entry, an island's id moves only against another copy of
|
|
256
|
+
* the SAME island that started in a different order — rare, and still page-unique.
|
|
257
|
+
*/
|
|
258
|
+
const slot_seq_by_request = /* @__PURE__ */ new WeakMap();
|
|
259
|
+
let _slot_seq = 0;
|
|
260
|
+
function next_slot_id(key = "") {
|
|
261
|
+
const event = kit_request_event();
|
|
262
|
+
if (event && typeof event === "object") {
|
|
263
|
+
let seq = slot_seq_by_request.get(event);
|
|
264
|
+
if (!seq) {
|
|
265
|
+
const url = event.url;
|
|
266
|
+
const hole = url?.pathname.endsWith(islands_endpoint()) ? (url.searchParams.get("id") ?? "").slice(0, 6) : "";
|
|
267
|
+
slot_seq_by_request.set(event, seq = {
|
|
268
|
+
prefix: hole ? hole + "-" : "",
|
|
269
|
+
n: /* @__PURE__ */ new Map()
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
let c = seq.n.get(key);
|
|
273
|
+
if (!c) seq.n.set(key, c = {
|
|
274
|
+
n: 0,
|
|
275
|
+
tag: key ? fnv1a32(key).toString(36) + "-" : ""
|
|
276
|
+
});
|
|
277
|
+
return "og" + seq.prefix + c.tag + (++c.n).toString(36);
|
|
278
|
+
}
|
|
279
|
+
_slot_seq = _slot_seq + 1 & 2147483647;
|
|
280
|
+
return "og" + _slot_seq.toString(36);
|
|
281
|
+
}
|
|
282
|
+
/** The serialize-only stand-in for in-place children: a branded value the codec reduces to a `slot`
|
|
283
|
+
* descriptor. Never rendered (the server body renders the real children); on the client it revives to a
|
|
284
|
+
* snippet that ADOPTS the marked DOM range. */
|
|
285
|
+
function slot_pointer(id) {
|
|
286
|
+
const snip = (() => {});
|
|
287
|
+
snip.__ogRegion = {
|
|
288
|
+
m: "slot",
|
|
289
|
+
id
|
|
290
|
+
};
|
|
291
|
+
return snip;
|
|
292
|
+
}
|
|
293
|
+
/** The hub kind: a snippet is a renderable Ref ("a snippet is a region", now literal). A branded
|
|
294
|
+
* region snippet crosses as its descriptor; a bare snippet FREEZES at the boundary (server-only —
|
|
295
|
+
* the BROWSER guard also keeps `capture_static` → `svelte/server` DCE-able out of client bundles);
|
|
296
|
+
* a bare function on the CLIENT falls through (never claimed — it can't freeze there). */
|
|
297
|
+
/** Explicit registration — called at module scope AND from live-transport's install():
|
|
298
|
+
* a bare side-effect import gets tree-shaken (the package marks JS side-effect-free),
|
|
299
|
+
* which silently un-registers the kind in client bundles. A CALLED import cannot be dropped. */
|
|
300
|
+
function register_snippet_kind() {
|
|
301
|
+
register_kind({
|
|
302
|
+
k: "snippet",
|
|
303
|
+
match(value) {
|
|
304
|
+
if (typeof value !== "function") return false;
|
|
305
|
+
if (value.__ogRegion) return true;
|
|
306
|
+
if (value[Symbol.for("ogygia.fn")] !== void 0) return false;
|
|
307
|
+
return !BROWSER;
|
|
308
|
+
},
|
|
309
|
+
encode(value) {
|
|
310
|
+
const branded = value.__ogRegion;
|
|
311
|
+
if (branded) return { d: branded };
|
|
312
|
+
return { d: capture_static(value).__ogRegion };
|
|
313
|
+
},
|
|
314
|
+
decode(ref) {
|
|
315
|
+
return make(ref.d);
|
|
316
|
+
},
|
|
317
|
+
stable_id: snippet_stable_id
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* A snippet's ref id from its descriptor: decode reads only `d` and a revived snippet holds no state,
|
|
322
|
+
* so equal descriptors are the same snippet — and a render names it the same every time (a random id
|
|
323
|
+
* here changed the fingerprint and the bytes of every island with children, on every request).
|
|
324
|
+
* - `slot`: its slot id, already page-unique and stable (next_slot_id);
|
|
325
|
+
* - `static`: a hash of its frozen HTML;
|
|
326
|
+
* - `live`: a hash of its entry and props — only when the props are JSON-exact (seed-refs `analyze`,
|
|
327
|
+
* the JSON lane's own rule): `JSON.stringify` turns a Map, a Set, a Date or a class instance into
|
|
328
|
+
* something that two different values share, and those must not share a revived snippet.
|
|
329
|
+
* Anything else keeps a random id.
|
|
330
|
+
*/
|
|
331
|
+
function snippet_stable_id(d) {
|
|
332
|
+
const desc = d;
|
|
333
|
+
if (desc.m === "slot") return "slot:" + desc.id;
|
|
334
|
+
if (desc.m === "static") return "s" + fnv1a(desc.h);
|
|
335
|
+
if (desc.m === "live" && analyze(desc.p).json) return "l" + fnv1a(desc.e + "\0" + JSON.stringify(desc.p));
|
|
336
|
+
}
|
|
337
|
+
const SNIPPET_ONLY = /* @__PURE__ */ new Set(["snippet"]);
|
|
338
|
+
/** Codec encode (legacy `OgygiaS` wire shape: the bare descriptor). Branded region snippet → its
|
|
339
|
+
* descriptor; a bare snippet → frozen static; anything else falls through. */
|
|
340
|
+
function reduce_region_snippet(value) {
|
|
341
|
+
register_snippet_kind();
|
|
342
|
+
const ref = mint(value, SNIPPET_ONLY);
|
|
343
|
+
return ref === void 0 ? void 0 : ref.d;
|
|
344
|
+
}
|
|
345
|
+
/** Codec decode. Rebuild a live snippet from the descriptor (both modes). Snippets are functions,
|
|
346
|
+
* which the hub deliberately never memoizes — each consumer revives its own (stateless until
|
|
347
|
+
* rendered), exactly the pre-hub behavior. */
|
|
348
|
+
function revive_region_snippet(desc) {
|
|
349
|
+
return make(desc);
|
|
350
|
+
}
|
|
351
|
+
export { REGION_SNIPPET_WIRE_KEY, SLOT_MARKER_CLOSE, next_slot_id, og_portable, prepare_region_props, reduce_region_snippet, region_snippet, register_snippet_kind, revive_region_snippet, slot_marker_open, slot_pointer };
|
package/dist/region.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { region_snippet } from "./region-snippet.js";
|
|
2
|
+
import { REGION_BRAND } from "./region-brand.js";
|
|
3
|
+
import { Component } from "svelte";
|
|
4
|
+
/** Schedule options for a held region. `wake` = when its JS runs; `margin` = IntersectionObserver
|
|
5
|
+
* rootMargin for `wake: 'visible'`. Merged OVER the binding's baked schedule (from a `wake:` mark) —
|
|
6
|
+
* anything set here WINS; a `region: 'raw'` binding bakes nothing, so this is the whole schedule. */
|
|
7
|
+
export type RegionOptions = {
|
|
8
|
+
wake?: string;
|
|
9
|
+
margin?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The `region()` schedule argument: a function handed the component's own props (its "generated
|
|
13
|
+
* data") that returns the schedule. Always a function, never a bare object — the object case is the
|
|
14
|
+
* baked `wake:` mark on the import. The function is for a registry of `region: 'raw'` components that
|
|
15
|
+
* decides each one's timing from its data — e.g.
|
|
16
|
+
* `region(block, data, (d) => ({ wake: d.interactive ? 'load' : undefined }))`.
|
|
17
|
+
*/
|
|
18
|
+
export type RegionSchedule<P = Record<string, unknown>> = (data: P) => RegionOptions;
|
|
19
|
+
/**
|
|
20
|
+
* The region result types erase the component's prop type — `region()` type-checks props
|
|
21
|
+
* against the component at the call site, so the stored value doesn't need to stay generic. Erasing
|
|
22
|
+
* keeps every concrete region assignable to the bare {@link RegionValue} supertype (a `C` in both a
|
|
23
|
+
* covariant `props` and a contravariant `component` position has no non-`any` supertype otherwise).
|
|
24
|
+
*/
|
|
25
|
+
type AnyComponent = Component<Record<string, unknown>>;
|
|
26
|
+
/** A plain component. Renders in the current server pass; **awaiting** it bakes its SSR HTML so it
|
|
27
|
+
* can cross the wire as an HTML-only ticket (no chunk, no signer — nothing to fetch). */
|
|
28
|
+
export type InlineRegion = {
|
|
29
|
+
readonly [REGION_BRAND]: true;
|
|
30
|
+
readonly kind: "inline";
|
|
31
|
+
readonly component: AnyComponent;
|
|
32
|
+
readonly props: Record<string, unknown>;
|
|
33
|
+
/** Server-rendered HTML, present once the region has been awaited. What lets an inline region
|
|
34
|
+
* (a content `body`) travel: the transport ships the markup, the runtime swaps it in and wakes
|
|
35
|
+
* any islands inside it — the same machinery as body-swap navigation. */
|
|
36
|
+
readonly html?: string;
|
|
37
|
+
/** Content-body CSS key (`content_css_key`) for a `.svx`/`.md` body whose own scoped `<style>`
|
|
38
|
+
* lives on no page stylesheet — the leak-free corpus is server-only, so its CSS never joins the
|
|
39
|
+
* page's static import graph. Region.svelte resolves it through the handoff (`contentCss`) and
|
|
40
|
+
* links the client CSS asset the plugin emitted. Absent for a body with no scoped `<style>`. */
|
|
41
|
+
readonly content_id?: string;
|
|
42
|
+
};
|
|
43
|
+
/** A marked component: renders inline here, or becomes a signed ticket when it crosses the wire. */
|
|
44
|
+
export type DualRegion = {
|
|
45
|
+
readonly [REGION_BRAND]: true;
|
|
46
|
+
readonly kind: "dual";
|
|
47
|
+
readonly component: AnyComponent;
|
|
48
|
+
readonly props: Record<string, unknown>;
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly module: string;
|
|
51
|
+
readonly hydrate?: string;
|
|
52
|
+
readonly hydrateMargin?: string;
|
|
53
|
+
/** Server signer, invoked by the transport at serialization. Never crosses the wire. */
|
|
54
|
+
readonly sign: (id: string, props: Record<string, unknown>) => string;
|
|
55
|
+
/**
|
|
56
|
+
* Server-only renderer, invoked when the region is **awaited** (see {@link region}). Renders
|
|
57
|
+
* the component to HTML on the server so the ticket can travel with its markup — no client fetch.
|
|
58
|
+
* Provided by the SSR region-binding leg; never crosses the wire.
|
|
59
|
+
*/
|
|
60
|
+
readonly renderHtml?: (props: Record<string, unknown>) => string | Promise<string>;
|
|
61
|
+
/** Server-rendered HTML, present once the region has been awaited. Rides the wire in the ticket. */
|
|
62
|
+
readonly html?: string;
|
|
63
|
+
};
|
|
64
|
+
/** A held region that arrived over the wire: a signed capability, no component. */
|
|
65
|
+
export type DeferredRegion = {
|
|
66
|
+
readonly [REGION_BRAND]: true;
|
|
67
|
+
readonly kind: "deferred";
|
|
68
|
+
readonly id: string;
|
|
69
|
+
readonly props: Record<string, unknown>;
|
|
70
|
+
/** Signed `/__ogygia__?id&props&exp&sig` capability the runtime fetches. */
|
|
71
|
+
readonly url: string;
|
|
72
|
+
/** Client hydrate-module URL, imported after the HTML swaps in; `''` for a static region. */
|
|
73
|
+
readonly module: string;
|
|
74
|
+
/** Wake schedule ('load' | 'idle' | 'visible' | media); absent for a static region. */
|
|
75
|
+
readonly hydrate?: string;
|
|
76
|
+
/** IntersectionObserver rootMargin when `hydrate` is `'visible'`. */
|
|
77
|
+
readonly hydrateMargin?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Server-rendered HTML baked into the ticket (the region was awaited before it crossed). When
|
|
80
|
+
* present the runtime swaps it in immediately and morphs across updates — no fetch. Absent → the
|
|
81
|
+
* runtime fetches the signed `url` as usual.
|
|
82
|
+
*/
|
|
83
|
+
readonly html?: string;
|
|
84
|
+
};
|
|
85
|
+
export type RegionValue = InlineRegion | DualRegion | DeferredRegion;
|
|
86
|
+
/**
|
|
87
|
+
* What {@link region} returns: a {@link RegionValue} you can render right now with `<Region of={…} />`,
|
|
88
|
+
* AND a `PromiseLike<Region>` you can `await` to bake its server-rendered HTML into the ticket. In an
|
|
89
|
+
* async generator (`query.live`) or async remote, `yield` / `return` awaits it for you.
|
|
90
|
+
*/
|
|
91
|
+
export type AwaitableRegion = RegionValue & PromiseLike<RegionValue>;
|
|
92
|
+
/** True for any value produced by {@link region} (or decoded from the wire). */
|
|
93
|
+
export declare function isRegion(value: unknown): value is RegionValue;
|
|
94
|
+
/** `region()` itself; the export below adds `region.snippet`. */
|
|
95
|
+
declare function make_region<P extends Record<string, unknown>>(component: Component<P>, props: P, opts?: RegionSchedule<P>, content_id?: string): AwaitableRegion;
|
|
96
|
+
/**
|
|
97
|
+
* INTERNAL (content formats): an inline region whose SSR HTML is already known — a serialized-region
|
|
98
|
+
* content body, baked at markdown-compile time. Renders like any inline region (the component is the
|
|
99
|
+
* thin `{@html}` shell the emitter produced); awaiting it is a no-op because the HTML is present from
|
|
100
|
+
* birth, so the wire crossing never pays a svelte/server render.
|
|
101
|
+
*/
|
|
102
|
+
export declare function prebaked_region(component: Component<Record<string, never>>, html: string, content_id?: string): AwaitableRegion;
|
|
103
|
+
/**
|
|
104
|
+
* Make a held region with type-checked props.
|
|
105
|
+
*
|
|
106
|
+
* - A plain component import → an **inline** region (renders in this pass; can't cross the wire).
|
|
107
|
+
* - A component imported `with { region: 'raw' }` → a **dual** region: inline where it's made,
|
|
108
|
+
* a signed ticket where it travels. Minting the marked form is server-only (the signer lives on
|
|
109
|
+
* the SSR leg) — call it in a load / remote / render context.
|
|
110
|
+
*
|
|
111
|
+
* **A dual region is awaitable.** `await region(Card, props)` renders the component to HTML on
|
|
112
|
+
* the server and bakes it into the ticket, so the client swaps it in with no extra request. In an
|
|
113
|
+
* async generator (`query.live`) or an async remote, `yield region(…)` / `return region(…)` is
|
|
114
|
+
* awaited by the language, so the HTML travels automatically — LiveView over the channel you already
|
|
115
|
+
* have. A held region you *don't* await renders inline where it lands (first paint, same SSR pass).
|
|
116
|
+
*/
|
|
117
|
+
export declare const region: typeof make_region & {
|
|
118
|
+
snippet: typeof region_snippet;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* A pure-HTML region — what `import.meta.og.code()` / `.md()` inline. The html is baked at build
|
|
122
|
+
* (Shiki / markdown), so this is an INLINE region whose component ({@link RawHtml}) simply renders
|
|
123
|
+
* the html in the page's own SSR pass. Static by construction: it ships as HTML and no client JS of
|
|
124
|
+
* its own. Rendered like any region: `<Region of={…} />`.
|
|
125
|
+
*/
|
|
126
|
+
export declare function og_html_region(html: string): InlineRegion;
|
|
127
|
+
export { REGION_BRAND };
|
package/dist/region.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { region_snippet } from "./region-snippet.js";
|
|
2
|
+
import { with_portable_forms } from "./portable-form.js";
|
|
3
|
+
import { REGION_BRAND } from "./region-brand.js";
|
|
4
|
+
import { kit_page_facts_tail, kit_page_ready, kit_render_context } from "./server/kit-context.js";
|
|
5
|
+
import { region_css_tags } from "./server/html-scan.js";
|
|
6
|
+
import RawHtml from "./RawHtml.svelte";
|
|
7
|
+
// src/region.ts
|
|
8
|
+
/** Brand so the transport can recognize a region without false-matching plain objects. */
|
|
9
|
+
/** context.ts's LAKE key (`isInLake`), by its global name — context.ts reaches virtual modules. */
|
|
10
|
+
const LAKE_SUBTREE_KEY = Symbol.for("ogygia.lake-subtree");
|
|
11
|
+
/** True for any value produced by {@link region} (or decoded from the wire). */
|
|
12
|
+
function isRegion(value) {
|
|
13
|
+
return typeof value === "object" && value !== null && value[REGION_BRAND] === true;
|
|
14
|
+
}
|
|
15
|
+
function isBinding(value) {
|
|
16
|
+
return (typeof value === "object" || typeof value === "function") && value !== null && typeof value.__ogRegion === "string";
|
|
17
|
+
}
|
|
18
|
+
/** `region()` itself; the export below adds `region.snippet`. */
|
|
19
|
+
function make_region(component, props, opts, content_id) {
|
|
20
|
+
const p = props ?? {};
|
|
21
|
+
const o = opts ? opts(props) : void 0;
|
|
22
|
+
if (isBinding(component)) {
|
|
23
|
+
if (!component.__component || !component.__sign) {
|
|
24
|
+
if (typeof component === "function") return make_inline_awaitable({
|
|
25
|
+
[REGION_BRAND]: true,
|
|
26
|
+
kind: "inline",
|
|
27
|
+
component,
|
|
28
|
+
props: p,
|
|
29
|
+
...content_id ? { content_id } : {}
|
|
30
|
+
});
|
|
31
|
+
throw new Error("[ogygia] a `with { region: 'raw' }` component must be turned into a region on the server (the signer lives server-side). Call region() in a load / remote / render context, not in client code.");
|
|
32
|
+
}
|
|
33
|
+
const hydrate = o?.wake ?? component.__hydrate;
|
|
34
|
+
const hydrateMargin = o?.margin ?? component.__hydrateMargin;
|
|
35
|
+
return make_awaitable({
|
|
36
|
+
[REGION_BRAND]: true,
|
|
37
|
+
kind: "dual",
|
|
38
|
+
component: component.__component,
|
|
39
|
+
props: p,
|
|
40
|
+
id: component.__ogRegion,
|
|
41
|
+
module: component.__module,
|
|
42
|
+
...hydrate ? { hydrate } : {},
|
|
43
|
+
...hydrateMargin ? { hydrateMargin } : {},
|
|
44
|
+
sign: component.__sign,
|
|
45
|
+
...component.__renderHtml ? { renderHtml: component.__renderHtml } : {}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return make_inline_awaitable({
|
|
49
|
+
[REGION_BRAND]: true,
|
|
50
|
+
kind: "inline",
|
|
51
|
+
component,
|
|
52
|
+
props: p,
|
|
53
|
+
...content_id ? { content_id } : {}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Give an inline region a non-enumerable `then` so `await`-ing it (server-side) renders the
|
|
58
|
+
* component to HTML and resolves to a plain (non-thenable) inline region carrying that HTML — which
|
|
59
|
+
* is what lets it cross the wire as an HTML-only ticket (see the transport). Mirrors
|
|
60
|
+
* {@link make_awaitable} for duals; `svelte/server` is imported lazily and only on the server, so
|
|
61
|
+
* this module stays browser-safe. Awaiting on the client settles to an unchanged copy.
|
|
62
|
+
*/
|
|
63
|
+
function make_inline_awaitable(inline) {
|
|
64
|
+
Object.defineProperty(inline, "then", {
|
|
65
|
+
enumerable: false,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value(onFulfilled, onRejected) {
|
|
69
|
+
const run = async () => {
|
|
70
|
+
if (typeof document !== "undefined") return { ...inline };
|
|
71
|
+
if (inline.html != null) return { ...inline };
|
|
72
|
+
const { render } = await import("svelte/server");
|
|
73
|
+
await kit_page_ready();
|
|
74
|
+
const context = kit_render_context();
|
|
75
|
+
context.set(LAKE_SUBTREE_KEY, true);
|
|
76
|
+
const r = await render(inline.component, {
|
|
77
|
+
props: inline.props,
|
|
78
|
+
context
|
|
79
|
+
});
|
|
80
|
+
const nested = region_css_tags(r.head);
|
|
81
|
+
return {
|
|
82
|
+
...inline,
|
|
83
|
+
html: nested + r.body + kit_page_facts_tail()
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
return run().then(onFulfilled, onRejected);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return inline;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Give a dual region a non-enumerable `then` so `await`-ing it renders the component to HTML and
|
|
93
|
+
* resolves to a plain (non-thenable) dual region carrying that HTML. Non-enumerable so a spread or
|
|
94
|
+
* `devalue` walk never copies it (which would re-arm the thenable / try to serialize a function);
|
|
95
|
+
* the transport reads only the data fields. A held region with no `renderHtml` (SSR leg absent) is left
|
|
96
|
+
* un-awaitable — awaiting it would be a no-op and only masks a mis-wired build.
|
|
97
|
+
*/
|
|
98
|
+
function make_awaitable(dual) {
|
|
99
|
+
if (!dual.renderHtml) return dual;
|
|
100
|
+
Object.defineProperty(dual, "then", {
|
|
101
|
+
enumerable: false,
|
|
102
|
+
configurable: true,
|
|
103
|
+
writable: true,
|
|
104
|
+
value(onFulfilled, onRejected) {
|
|
105
|
+
const run = async () => {
|
|
106
|
+
const html = dual.renderHtml ? await dual.renderHtml(with_portable_forms(dual.props)) : void 0;
|
|
107
|
+
return {
|
|
108
|
+
...dual,
|
|
109
|
+
...html != null ? { html } : {}
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
return run().then(onFulfilled, onRejected);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return dual;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* INTERNAL (content formats): an inline region whose SSR HTML is already known — a serialized-region
|
|
119
|
+
* content body, baked at markdown-compile time. Renders like any inline region (the component is the
|
|
120
|
+
* thin `{@html}` shell the emitter produced); awaiting it is a no-op because the HTML is present from
|
|
121
|
+
* birth, so the wire crossing never pays a svelte/server render.
|
|
122
|
+
*/
|
|
123
|
+
function prebaked_region(component, html, content_id) {
|
|
124
|
+
return make_inline_awaitable({
|
|
125
|
+
[REGION_BRAND]: true,
|
|
126
|
+
kind: "inline",
|
|
127
|
+
component,
|
|
128
|
+
props: {},
|
|
129
|
+
html,
|
|
130
|
+
...content_id ? { content_id } : {}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Make a held region with type-checked props.
|
|
135
|
+
*
|
|
136
|
+
* - A plain component import → an **inline** region (renders in this pass; can't cross the wire).
|
|
137
|
+
* - A component imported `with { region: 'raw' }` → a **dual** region: inline where it's made,
|
|
138
|
+
* a signed ticket where it travels. Minting the marked form is server-only (the signer lives on
|
|
139
|
+
* the SSR leg) — call it in a load / remote / render context.
|
|
140
|
+
*
|
|
141
|
+
* **A dual region is awaitable.** `await region(Card, props)` renders the component to HTML on
|
|
142
|
+
* the server and bakes it into the ticket, so the client swaps it in with no extra request. In an
|
|
143
|
+
* async generator (`query.live`) or an async remote, `yield region(…)` / `return region(…)` is
|
|
144
|
+
* awaited by the language, so the HTML travels automatically — LiveView over the channel you already
|
|
145
|
+
* have. A held region you *don't* await renders inline where it lands (first paint, same SSR pass).
|
|
146
|
+
*/
|
|
147
|
+
const region = Object.assign(make_region, { snippet: region_snippet });
|
|
148
|
+
/**
|
|
149
|
+
* A pure-HTML region — what `import.meta.og.code()` / `.md()` inline. The html is baked at build
|
|
150
|
+
* (Shiki / markdown), so this is an INLINE region whose component ({@link RawHtml}) simply renders
|
|
151
|
+
* the html in the page's own SSR pass. Static by construction: it ships as HTML and no client JS of
|
|
152
|
+
* its own. Rendered like any region: `<Region of={…} />`.
|
|
153
|
+
*/
|
|
154
|
+
function og_html_region(html) {
|
|
155
|
+
return {
|
|
156
|
+
[REGION_BRAND]: true,
|
|
157
|
+
kind: "inline",
|
|
158
|
+
component: RawHtml,
|
|
159
|
+
props: { html }
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
export { REGION_BRAND, isRegion, og_html_region, prebaked_region, region };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function requestEvent<E = unknown>(): E | null;
|