@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,36 @@
|
|
|
1
|
+
// src/current-region.ts
|
|
2
|
+
/**
|
|
3
|
+
* The region the runtime is currently hydrating — the DOM anchor cross-island `context.get()` walks
|
|
4
|
+
* up from. It lives ALONE, with zero heavy imports, on purpose: `core` needs only to SET it while
|
|
5
|
+
* hydrating, and pulling it from `context-bridge` used to drag the whole codec + `svelte/server`
|
|
6
|
+
* graph into every client bundle. Kept on `globalThis` under a `Symbol.for` key so the runtime and
|
|
7
|
+
* the (separately-bundled) context feature agree on one slot. See INVARIANTS · CONTEXT-CURSOR.
|
|
8
|
+
*/
|
|
9
|
+
const CURRENT_REGION = Symbol.for("ogygia.context.current-region");
|
|
10
|
+
const g = globalThis;
|
|
11
|
+
/** Runtime sets the region it is about to hydrate so a nested `get()` knows where to start walking. */
|
|
12
|
+
function set_current_region(el) {
|
|
13
|
+
g[CURRENT_REGION] = el;
|
|
14
|
+
}
|
|
15
|
+
/** The region currently being hydrated (or null) — read by the context feature's client DOM walk. */
|
|
16
|
+
function current_region() {
|
|
17
|
+
return g[CURRENT_REGION] ?? null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Fragment federation: the FOREIGN island (another build's entry, delegated to its own
|
|
21
|
+
* `__og_hydrate`) the runtime is hydrating right now — or null. The `$app/state` / `$app/stores`
|
|
22
|
+
* shims read this (dev) to warn on a page read: inside a mounted MFE island the page store is the
|
|
23
|
+
* SHELL's document singleton, never the MFE's (its own seed stops at the fragment boundary), so
|
|
24
|
+
* `page.data` there is a repaint mismatch waiting to happen. Same slot discipline as the cursor
|
|
25
|
+
* above — the shell runtime SETS it, the foreign build's shim READS it, one `Symbol.for` slot.
|
|
26
|
+
*/
|
|
27
|
+
const FOREIGN_HYDRATE = Symbol.for("ogygia.context.foreign-hydrate");
|
|
28
|
+
/** Runtime marks the foreign island it is about to delegate-hydrate (null when done). */
|
|
29
|
+
function set_foreign_hydrate(info) {
|
|
30
|
+
g[FOREIGN_HYDRATE] = info;
|
|
31
|
+
}
|
|
32
|
+
/** The foreign island currently hydrating (or null) — read by the page shims' dev warning. */
|
|
33
|
+
function foreign_hydrate() {
|
|
34
|
+
return g[FOREIGN_HYDRATE] ?? null;
|
|
35
|
+
}
|
|
36
|
+
export { current_region, foreign_hydrate, set_current_region, set_foreign_hydrate };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { RegionValue } from "./region.js";
|
|
2
|
+
export interface DocumentOptions {
|
|
3
|
+
/** `<title>` — used only when no component set one via `<svelte:head>` (the component wins). */
|
|
4
|
+
title?: string;
|
|
5
|
+
/** Raw extra head HTML (meta tags, fonts, …), appended after the rendered head. */
|
|
6
|
+
head?: string;
|
|
7
|
+
/** HTTP status (default 200). */
|
|
8
|
+
status?: number;
|
|
9
|
+
/** Extra/override response headers. `content-type` and `cache-control: no-store` are the defaults
|
|
10
|
+
* (under an eligible FREEZE request the cache-control default is left to the verdict). */
|
|
11
|
+
headers?: HeadersInit;
|
|
12
|
+
/** `<html lang>` (default 'en'). */
|
|
13
|
+
lang?: string;
|
|
14
|
+
/** Seed for `$app/state` inside islands (`page.data`/`params`/`url`, `route.id`, `form`). The router
|
|
15
|
+
* passes it so islands on a rendered page read `$page` just like on a Kit-served page. Promises in
|
|
16
|
+
* `data`/`form` aren't streamed here — a non-serializable leaf drops that one field. */
|
|
17
|
+
pageState?: {
|
|
18
|
+
url?: {
|
|
19
|
+
href?: string;
|
|
20
|
+
};
|
|
21
|
+
params?: Record<string, string | undefined>;
|
|
22
|
+
route?: {
|
|
23
|
+
id: string | null;
|
|
24
|
+
};
|
|
25
|
+
status?: number;
|
|
26
|
+
data?: unknown;
|
|
27
|
+
form?: unknown;
|
|
28
|
+
error?: unknown;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Render a region into a complete ogygia document and return it as a `Response`.
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { document } from 'ogygia/server';
|
|
36
|
+
* import { region } from 'ogygia';
|
|
37
|
+
*
|
|
38
|
+
* return document(region(Dashboard, { stats }), { title: 'ogygia profiler' });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function document(of: RegionValue | PromiseLike<RegionValue>, options?: DocumentOptions): Promise<Response>;
|
package/dist/document.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { PageSeed } from "./server/page-seed.js";
|
|
2
|
+
import { page_seed_reducers } from "./server/page-stream.js";
|
|
3
|
+
import { analyze } from "./seed-refs.js";
|
|
4
|
+
import { WIRE_FORMAT_ATTR, WIRE_FORMAT_JSON } from "./server/props-wire.js";
|
|
5
|
+
import { runtime_bootstrap } from "./server/entry-location.js";
|
|
6
|
+
import { current_facts } from "./plugin/facts.js";
|
|
7
|
+
import { kit_render_context } from "./server/kit-context.js";
|
|
8
|
+
import { open_ask_scope, read_seed_ask, record_page } from "./page-seed-registry.js";
|
|
9
|
+
import { shape_page_data } from "./server/seed-shape.js";
|
|
10
|
+
import { escape_text } from "./escape.js";
|
|
11
|
+
import { page_declares_dev_hmr_script, page_declares_router_meta, page_declares_runtime_script, runtime_first } from "./server/head-presence.js";
|
|
12
|
+
import { render } from "svelte/server";
|
|
13
|
+
import { stringify } from "devalue";
|
|
14
|
+
import Region from "./Region.svelte";
|
|
15
|
+
import runtime_url from "virtual:ogygia/runtime-url";
|
|
16
|
+
import { try_get_request_store } from "@sveltejs/kit/internal/server";
|
|
17
|
+
import dev_hmr_url from "virtual:ogygia/dev-hmr-url";
|
|
18
|
+
import { enabled, viewTransitions } from "virtual:ogygia/router-config";
|
|
19
|
+
// src/document.ts
|
|
20
|
+
/**
|
|
21
|
+
* `document()` — the document a region stands in.
|
|
22
|
+
*
|
|
23
|
+
* ogygia's one primitive is the region: component + props with rendering and waking rules. Every
|
|
24
|
+
* region so far has lived inside a document that Kit happened to serve. `document()` is the other
|
|
25
|
+
* half: given a region value, mint the COMPLETE ogygia document around it — doctype, head
|
|
26
|
+
* (`<svelte:head>` content, scoped-CSS links, the runtime bootstrap), body (the region's HTML,
|
|
27
|
+
* `<ogygia-region>` shells, props sidecars) — returned as a `Response` you can serve from anywhere:
|
|
28
|
+
* a `handle` in hooks, a `+server.ts` endpoint, the profiler. No URL, no routing, no "page"
|
|
29
|
+
* semantics — where it's served is the caller's business.
|
|
30
|
+
*
|
|
31
|
+
* It renders through `<Region of={…}>` inside the live request (Kit's `getRequestEvent()` ALS), so
|
|
32
|
+
* ALL the per-request machinery regions already have simply applies: `claim_region_css` links each
|
|
33
|
+
* scoped stylesheet once, props sidecars ride next to their shells, islands inside wake on their own
|
|
34
|
+
* schedules, and the emitted markup is a standard ogygia page — the SPA router body-swaps into and
|
|
35
|
+
* out of it like any Kit-served page.
|
|
36
|
+
*
|
|
37
|
+
* Deliberately NOT the app's `app.html`: that template belongs to Kit's build and does not exist at
|
|
38
|
+
* runtime. The shell here is ogygia's own, minimal one — extra head content goes through
|
|
39
|
+
* `<svelte:head>` in the components or the `head` option.
|
|
40
|
+
*
|
|
41
|
+
* Server-only (it renders): call it from a handle / endpoint / server module.
|
|
42
|
+
*/
|
|
43
|
+
const TITLE_TAG_RE = /<title[\s>]/i;
|
|
44
|
+
/** The `page` object Kit's server `$app/state` answers from (Kit's `props.page` shape), built from
|
|
45
|
+
* the caller's seed when the router passed one, else from the live request (URL, status) with
|
|
46
|
+
* empty data — so `page.url`/`page.status` are always true and `page.data` never throws on any
|
|
47
|
+
* ogygia-rendered document. Also RECORDED into the request's page snapshot, so the nested island
|
|
48
|
+
* renders under this document rebuild the same context (see server/kit-context.ts). */
|
|
49
|
+
function kit_page_context(options) {
|
|
50
|
+
const s = options.pageState;
|
|
51
|
+
const store = try_get_request_store();
|
|
52
|
+
const href = s?.url?.href ?? store?.event?.url?.href;
|
|
53
|
+
const page = {
|
|
54
|
+
url: href ? new URL(href) : void 0,
|
|
55
|
+
params: s?.params ?? {},
|
|
56
|
+
route: s?.route ?? { id: null },
|
|
57
|
+
status: s?.status ?? options.status ?? 200,
|
|
58
|
+
data: s?.data ?? {},
|
|
59
|
+
form: s?.form ?? null,
|
|
60
|
+
error: s?.error ?? null,
|
|
61
|
+
state: {}
|
|
62
|
+
};
|
|
63
|
+
record_page({
|
|
64
|
+
url: href ? { href } : void 0,
|
|
65
|
+
params: page.params,
|
|
66
|
+
route: page.route,
|
|
67
|
+
status: page.status,
|
|
68
|
+
data: page.data,
|
|
69
|
+
form: page.form,
|
|
70
|
+
error: page.error
|
|
71
|
+
}, false, []);
|
|
72
|
+
return page;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Render a region into a complete ogygia document and return it as a `Response`.
|
|
76
|
+
*
|
|
77
|
+
* ```ts
|
|
78
|
+
* import { document } from 'ogygia/server';
|
|
79
|
+
* import { region } from 'ogygia';
|
|
80
|
+
*
|
|
81
|
+
* return document(region(Dashboard, { stats }), { title: 'ogygia profiler' });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
async function document(of, options = {}) {
|
|
85
|
+
open_ask_scope();
|
|
86
|
+
const r = await render(Region, {
|
|
87
|
+
props: { of: await of },
|
|
88
|
+
context: kit_render_context(kit_page_context(options))
|
|
89
|
+
});
|
|
90
|
+
const head = [];
|
|
91
|
+
head.push(r.head);
|
|
92
|
+
if (options.head) head.push(options.head);
|
|
93
|
+
const head_so_far = () => head.join("");
|
|
94
|
+
if (options.title && !TITLE_TAG_RE.test(head_so_far())) head.push(`<title>${escape_text(options.title)}</title>`);
|
|
95
|
+
if (enabled && !page_declares_router_meta(head_so_far())) head.push(`<meta name="ogygia-router" content="${viewTransitions ? "vt" : "plain"}">`);
|
|
96
|
+
if (runtime_url && !page_declares_runtime_script(head_so_far())) head.push(runtime_bootstrap());
|
|
97
|
+
if (dev_hmr_url && !page_declares_dev_hmr_script(head_so_far())) head.push(`<script type="module" data-ogygia-dev-hmr src="${dev_hmr_url}"><\/script>`);
|
|
98
|
+
const ask = options.pageState ? read_seed_ask() : void 0;
|
|
99
|
+
if (options.pageState && (!ask || ask.wanted)) {
|
|
100
|
+
const s = options.pageState;
|
|
101
|
+
const data = ask ? shape_page_data(s.data, ask.keys) : s.data;
|
|
102
|
+
const payload = PageSeed.serialize({
|
|
103
|
+
url: s.url,
|
|
104
|
+
params: s.params,
|
|
105
|
+
route: s.route,
|
|
106
|
+
status: s.status,
|
|
107
|
+
data,
|
|
108
|
+
form: s.form,
|
|
109
|
+
error: s.error
|
|
110
|
+
}, (v) => stringify(v, page_seed_reducers), analyze(data).json && analyze(s.form ?? null).json && analyze(s.error ?? null).json);
|
|
111
|
+
if (payload) {
|
|
112
|
+
const format = payload.json ? ` ${WIRE_FORMAT_ATTR}="${WIRE_FORMAT_JSON}"` : "";
|
|
113
|
+
head.push(`<script type="application/ogygia-page" data-ogygia-page${format}>${payload.text}<\/script>`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const html = `<!doctype html>\n<html lang="${escape_text(options.lang ?? "en")}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">` + runtime_first(head.join(""), null) + `</head><body>${r.body}</body></html>`;
|
|
117
|
+
const headers = new Headers({ "content-type": "text/html; charset=utf-8" });
|
|
118
|
+
if (!current_facts()?.storable) headers.set("cache-control", "no-store");
|
|
119
|
+
if (options.headers) for (const [k, v] of new Headers(options.headers)) headers.set(k, v);
|
|
120
|
+
return new Response(html, {
|
|
121
|
+
status: options.status ?? 200,
|
|
122
|
+
headers
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
export { document };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Component } from "svelte";
|
|
2
|
+
export declare function og_entry_hydrate(component: Component<Record<string, unknown>>, target: Element, props: Record<string, unknown>, options?: {
|
|
3
|
+
recover?: boolean;
|
|
4
|
+
}): unknown;
|
|
5
|
+
export declare function og_entry_unmount(app: Record<string, unknown>): unknown;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { hydrate, unmount } from "svelte";
|
|
2
|
+
import NestedProvider from "./NestedProvider.svelte";
|
|
3
|
+
// src/entry-hydrate.ts
|
|
4
|
+
/**
|
|
5
|
+
* THE FOREIGN-HYDRATE CONTRACT (fragment federation), in one place. A stitched fragment's island
|
|
6
|
+
* entry may be woken by ANOTHER app's runtime. Svelte's hydrate/unmount carry module-level state
|
|
7
|
+
* (hydration cursor, effect context), so the call must run against THIS build's svelte instance —
|
|
8
|
+
* the consuming runtime only schedules and delegates. The hydration ENVELOPE is prepared here too:
|
|
9
|
+
* anchor conventions belong to the svelte that compiled the entry, so the consumer never shapes them.
|
|
10
|
+
* Same-origin wakes never call these.
|
|
11
|
+
*
|
|
12
|
+
* Every island entry of an app that federates re-exports these through `__og_hydrate` /
|
|
13
|
+
* `__og_unmount` (compiler/region/emit.ts); an app that does not federate ships neither. This module
|
|
14
|
+
* sits in the producer's own build, so its `svelte` is the producer's.
|
|
15
|
+
*
|
|
16
|
+
* Hydrate through THIS build's NestedProvider, mirroring the local runtime's call shape: the SSR
|
|
17
|
+
* children were rendered through the provider's dynamic-component branch (the `<!--[0-->` marker), so
|
|
18
|
+
* a bare-component hydrate walks one marker layer short — svelte aborts mid-walk and client-re-renders.
|
|
19
|
+
* `options.recover === false`: the consumer's self-heal (hydrate-core.ts) asks THIS svelte to throw on
|
|
20
|
+
* a mismatch instead of re-rendering; the envelope is re-checked per call because a restore from the
|
|
21
|
+
* server markup drops it.
|
|
22
|
+
*/
|
|
23
|
+
function og_entry_hydrate(component, target, props, options) {
|
|
24
|
+
const first = target.firstChild;
|
|
25
|
+
if (!(first && first.nodeType === 8 && first.data === "[")) {
|
|
26
|
+
target.insertBefore(document.createComment("["), target.firstChild);
|
|
27
|
+
target.appendChild(document.createComment("]"));
|
|
28
|
+
}
|
|
29
|
+
const recovery = options && options.recover === false ? { recover: false } : {};
|
|
30
|
+
return hydrate(NestedProvider, {
|
|
31
|
+
target,
|
|
32
|
+
props: {
|
|
33
|
+
component,
|
|
34
|
+
props
|
|
35
|
+
},
|
|
36
|
+
...recovery
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function og_entry_unmount(app) {
|
|
40
|
+
return unmount(app);
|
|
41
|
+
}
|
|
42
|
+
export { og_entry_hydrate, og_entry_unmount };
|
package/dist/escape.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE canonical side-channel escape. A devalue/JSON payload emitted inside a `<script>` must not
|
|
3
|
+
* be able to break out of it — escaping `<` neutralizes `<\/script>`, `<script`, and `<!--`. Every seed
|
|
4
|
+
* / marker serializer (page seed, remote seed, context markers, streamed resolve scripts) routes its
|
|
5
|
+
* payload through here, so the escape lives in exactly one auditable place.
|
|
6
|
+
*/
|
|
7
|
+
export declare function escape_script_text(s: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* An attribute value for a double-quoted attribute: `&`, `"`, `<` escaped. One pass; a value with
|
|
10
|
+
* none of them (nearly every href) comes back as itself, no copy.
|
|
11
|
+
*/
|
|
12
|
+
export declare function escape_attr(s: string): string;
|
|
13
|
+
/** `&` only (a URL into an attribute: its query's separators). No copy without one. */
|
|
14
|
+
export declare function escape_amp(s: string): string;
|
|
15
|
+
/** `&` and `"` only (a value re-emitted into a double-quoted attribute exactly as it was, `<` kept). */
|
|
16
|
+
export declare function escape_amp_quot(s: string): string;
|
|
17
|
+
/** Text content: `&`, `<`, `>` escaped. Text with none of them comes back as itself, no copy. */
|
|
18
|
+
export declare function escape_text(s: string): string;
|
package/dist/escape.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/escape.ts
|
|
2
|
+
/**
|
|
3
|
+
* The ONE canonical side-channel escape. A devalue/JSON payload emitted inside a `<script>` must not
|
|
4
|
+
* be able to break out of it — escaping `<` neutralizes `<\/script>`, `<script`, and `<!--`. Every seed
|
|
5
|
+
* / marker serializer (page seed, remote seed, context markers, streamed resolve scripts) routes its
|
|
6
|
+
* payload through here, so the escape lives in exactly one auditable place.
|
|
7
|
+
*/
|
|
8
|
+
function escape_script_text(s) {
|
|
9
|
+
return s.replaceAll("<", "\\u003C");
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An attribute value for a double-quoted attribute: `&`, `"`, `<` escaped. One pass; a value with
|
|
13
|
+
* none of them (nearly every href) comes back as itself, no copy.
|
|
14
|
+
*/
|
|
15
|
+
function escape_attr(s) {
|
|
16
|
+
if (s.indexOf("&") === -1 && s.indexOf("\"") === -1 && s.indexOf("<") === -1) return s;
|
|
17
|
+
return s.replace(AMP_G, "&").replace(QUOT_G, """).replace(LT_G, "<");
|
|
18
|
+
}
|
|
19
|
+
/** `&` only (a URL into an attribute: its query's separators). No copy without one. */
|
|
20
|
+
function escape_amp(s) {
|
|
21
|
+
return s.indexOf("&") === -1 ? s : s.replaceAll("&", "&");
|
|
22
|
+
}
|
|
23
|
+
/** `&` and `"` only (a value re-emitted into a double-quoted attribute exactly as it was, `<` kept). */
|
|
24
|
+
function escape_amp_quot(s) {
|
|
25
|
+
if (s.indexOf("&") === -1 && s.indexOf("\"") === -1) return s;
|
|
26
|
+
return s.replace(AMP_G, "&").replace(QUOT_G, """);
|
|
27
|
+
}
|
|
28
|
+
/** Text content: `&`, `<`, `>` escaped. Text with none of them comes back as itself, no copy. */
|
|
29
|
+
function escape_text(s) {
|
|
30
|
+
if (s.indexOf("&") === -1 && s.indexOf("<") === -1 && s.indexOf(">") === -1) return s;
|
|
31
|
+
return s.replace(AMP_G, "&").replace(LT_G, "<").replace(GT_G, ">");
|
|
32
|
+
}
|
|
33
|
+
const AMP_G = /&/g;
|
|
34
|
+
const QUOT_G = /"/g;
|
|
35
|
+
const LT_G = /</g;
|
|
36
|
+
const GT_G = />/g;
|
|
37
|
+
export { escape_amp, escape_amp_quot, escape_attr, escape_script_text, escape_text };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DevtoolsEvent, DevtoolsEventInput } from "./schema.js";
|
|
2
|
+
/** Compile-time gate (Vite `define`). Exported for the public surface + tests; seam modules declare
|
|
3
|
+
* their OWN local `const DEVTOOLS` from the same token so DCE never depends on cross-module folding. */
|
|
4
|
+
export declare const DEVTOOLS: boolean;
|
|
5
|
+
/** A sink is any consumer of stamped events. Throwing is contained — one bad sink never starves the
|
|
6
|
+
* others, and never breaks the framework path that emitted the event. */
|
|
7
|
+
export type DevtoolsSink = (event: DevtoolsEvent) => void;
|
|
8
|
+
/**
|
|
9
|
+
* THE emit entry point. Stamps the envelope (v / seq / t / realm), rings the buffer, fans to sinks.
|
|
10
|
+
* A no-op when the bus is inactive. Guard the CALL with a module-local `if (DEVTOOLS)` so the event
|
|
11
|
+
* literal compiles out entirely when off — this internal guard only protects direct/dynamic callers.
|
|
12
|
+
*/
|
|
13
|
+
export declare function emit(input: DevtoolsEventInput): void;
|
|
14
|
+
/**
|
|
15
|
+
* Push ALREADY-STAMPED events into the buffer + sinks WITHOUT re-stamping — the ingest path for the
|
|
16
|
+
* server realm's events, which arrive from the `application/ogygia-devtools` side-channel carrying
|
|
17
|
+
* their own envelope (v / seq / t / realm:'server'). This is what unifies the server render stream
|
|
18
|
+
* and the client wake stream into ONE `window.__ogygia_devtools` timeline, correlated by fingerprint.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ingest(events: DevtoolsEvent[]): void;
|
|
21
|
+
/** Buffered events in emission order (oldest → newest). Copies out — safe to hold/serialize. */
|
|
22
|
+
export declare function snapshot(): DevtoolsEvent[];
|
|
23
|
+
/** Drop every buffered event (the sinks are left registered). Used between e2e scenarios + traces. */
|
|
24
|
+
export declare function clear(): void;
|
|
25
|
+
/** Register a sink; returns an unregister fn. A sink sees events from registration onward — to also
|
|
26
|
+
* replay what's buffered, iterate {@link snapshot} first. */
|
|
27
|
+
export declare function add_sink(sink: DevtoolsSink): () => void;
|
|
28
|
+
/** Runtime configuration — pause/resume, resize the ring, set per-name sampling. */
|
|
29
|
+
export declare function configure(opts: {
|
|
30
|
+
active?: boolean;
|
|
31
|
+
cap?: number;
|
|
32
|
+
sample?: Record<string, number>;
|
|
33
|
+
}): void;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import "./schema.js";
|
|
2
|
+
// src/events/bus.ts
|
|
3
|
+
/**
|
|
4
|
+
* The devtools EVENT BUS — the whole product's spine (internal/notes/devtools.md, Rung 0).
|
|
5
|
+
*
|
|
6
|
+
* `emit()` is the one entry point. Behind it: a capped RING BUFFER (so a long-lived tab / server
|
|
7
|
+
* can't grow it unbounded) plus a set of pluggable SINKS (postMessage for the REPL, a window hook
|
|
8
|
+
* for e2e, console for debugging, buffer→JSON for traces). Nothing here has a UI opinion — every
|
|
9
|
+
* product (our own e2e, the REPL, the future Vite plugin) is a listener over this.
|
|
10
|
+
*
|
|
11
|
+
* ZERO-COST WHEN OFF. `DEVTOOLS` is a compile-time constant from the `__OGYGIA_DEVTOOLS__` Vite
|
|
12
|
+
* `define` (typeof-guarded exactly like `__OGYGIA_SERVER_DELTA__`, so a plain `node` import of
|
|
13
|
+
* `dist/` without the define falls back to `false`). Call sites guard with a MODULE-LOCAL
|
|
14
|
+
* `const DEVTOOLS = …` (the proven DCE pattern — see runtime/form-continuity.ts): when off, the
|
|
15
|
+
* whole `if (DEVTOOLS) emit({…})` — object literal included — folds to `if (false)` and is dropped,
|
|
16
|
+
* and this module, now unreferenced, tree-shakes out of the app's runtime chunk entirely.
|
|
17
|
+
*
|
|
18
|
+
* STATE IS GLOBAL-PINNED. The island runtime chunk, each island entry, and the transport-hook graph
|
|
19
|
+
* are SEPARATE bundles that each carry their own copy of this module — but hub mints (ref.ts) and
|
|
20
|
+
* region wakes (core.ts) emit from whichever copy runs. Pinning the buffer to `globalThis` (like the
|
|
21
|
+
* hub registry and the frame store) keeps every copy writing into the ONE buffer a sink exposes.
|
|
22
|
+
* No top-level side effect: the global is created lazily on first `emit`/`configure`, so an unused
|
|
23
|
+
* import is fully shakeable.
|
|
24
|
+
*/
|
|
25
|
+
/** Compile-time gate (Vite `define`). Exported for the public surface + tests; seam modules declare
|
|
26
|
+
* their OWN local `const DEVTOOLS` from the same token so DCE never depends on cross-module folding. */
|
|
27
|
+
const DEVTOOLS = typeof __OGYGIA_DEVTOOLS__ !== "undefined" ? __OGYGIA_DEVTOOLS__ : false;
|
|
28
|
+
/** Which half of the framework this bundle is running in (a trace merges both streams). */
|
|
29
|
+
const REALM = typeof window !== "undefined" ? "client" : "server";
|
|
30
|
+
/** Default ring-buffer capacity (events). Small — instruments read live; a trace drains on demand. */
|
|
31
|
+
const DEFAULT_CAP = 4096;
|
|
32
|
+
const BUS_KEY = Symbol.for("ogygia.devtools.bus");
|
|
33
|
+
/** `cap` empty ring slots (`undefined` until written; the readers skip empty slots). */
|
|
34
|
+
function empty_ring(cap) {
|
|
35
|
+
return Array.from({ length: cap });
|
|
36
|
+
}
|
|
37
|
+
function bus() {
|
|
38
|
+
const g = globalThis;
|
|
39
|
+
return g[BUS_KEY] ??= {
|
|
40
|
+
active: DEVTOOLS,
|
|
41
|
+
seq: 0,
|
|
42
|
+
cap: DEFAULT_CAP,
|
|
43
|
+
ring: empty_ring(DEFAULT_CAP),
|
|
44
|
+
write: 0,
|
|
45
|
+
count: 0,
|
|
46
|
+
sinks: /* @__PURE__ */ new Set(),
|
|
47
|
+
sample: /* @__PURE__ */ new Map(),
|
|
48
|
+
sample_n: /* @__PURE__ */ new Map()
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** High-resolution monotonic clock where available; wall-clock otherwise. */
|
|
52
|
+
function now() {
|
|
53
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") return performance.now();
|
|
54
|
+
return Date.now();
|
|
55
|
+
}
|
|
56
|
+
/** Sampling gate: keep 1-in-N for a name that opted in, else keep all. */
|
|
57
|
+
function passes_sample(b, name) {
|
|
58
|
+
const n = b.sample.get(name);
|
|
59
|
+
if (n === void 0 || n <= 1) return true;
|
|
60
|
+
const c = (b.sample_n.get(name) ?? 0) + 1;
|
|
61
|
+
b.sample_n.set(name, c % n);
|
|
62
|
+
return c % n === 0;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* THE emit entry point. Stamps the envelope (v / seq / t / realm), rings the buffer, fans to sinks.
|
|
66
|
+
* A no-op when the bus is inactive. Guard the CALL with a module-local `if (DEVTOOLS)` so the event
|
|
67
|
+
* literal compiles out entirely when off — this internal guard only protects direct/dynamic callers.
|
|
68
|
+
*/
|
|
69
|
+
function emit(input) {
|
|
70
|
+
if (!DEVTOOLS) return;
|
|
71
|
+
const b = bus();
|
|
72
|
+
if (!b.active) return;
|
|
73
|
+
if (!passes_sample(b, input.name)) return;
|
|
74
|
+
const event = {
|
|
75
|
+
...input,
|
|
76
|
+
v: 1,
|
|
77
|
+
seq: b.seq++,
|
|
78
|
+
t: now(),
|
|
79
|
+
realm: REALM
|
|
80
|
+
};
|
|
81
|
+
b.ring[b.write] = event;
|
|
82
|
+
b.write = (b.write + 1) % b.cap;
|
|
83
|
+
if (b.count < b.cap) b.count++;
|
|
84
|
+
if (b.sinks.size) for (const sink of b.sinks) try {
|
|
85
|
+
sink(event);
|
|
86
|
+
} catch {}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Push ALREADY-STAMPED events into the buffer + sinks WITHOUT re-stamping — the ingest path for the
|
|
90
|
+
* server realm's events, which arrive from the `application/ogygia-devtools` side-channel carrying
|
|
91
|
+
* their own envelope (v / seq / t / realm:'server'). This is what unifies the server render stream
|
|
92
|
+
* and the client wake stream into ONE `window.__ogygia_devtools` timeline, correlated by fingerprint.
|
|
93
|
+
*/
|
|
94
|
+
function ingest(events) {
|
|
95
|
+
if (!DEVTOOLS) return;
|
|
96
|
+
const b = bus();
|
|
97
|
+
if (!b.active) return;
|
|
98
|
+
for (const event of events) {
|
|
99
|
+
b.ring[b.write] = event;
|
|
100
|
+
b.write = (b.write + 1) % b.cap;
|
|
101
|
+
if (b.count < b.cap) b.count++;
|
|
102
|
+
if (b.sinks.size) for (const sink of b.sinks) try {
|
|
103
|
+
sink(event);
|
|
104
|
+
} catch {}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/** Buffered events in emission order (oldest → newest). Copies out — safe to hold/serialize. */
|
|
108
|
+
function snapshot() {
|
|
109
|
+
const b = bus();
|
|
110
|
+
const out = [];
|
|
111
|
+
if (b.count === b.cap) for (let i = 0; i < b.cap; i++) {
|
|
112
|
+
const ev = b.ring[(b.write + i) % b.cap];
|
|
113
|
+
if (ev) out.push(ev);
|
|
114
|
+
}
|
|
115
|
+
else for (let i = 0; i < b.count; i++) {
|
|
116
|
+
const ev = b.ring[i];
|
|
117
|
+
if (ev) out.push(ev);
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
/** Drop every buffered event (the sinks are left registered). Used between e2e scenarios + traces. */
|
|
122
|
+
function clear() {
|
|
123
|
+
const b = bus();
|
|
124
|
+
b.ring = empty_ring(b.cap);
|
|
125
|
+
b.write = 0;
|
|
126
|
+
b.count = 0;
|
|
127
|
+
}
|
|
128
|
+
/** Register a sink; returns an unregister fn. A sink sees events from registration onward — to also
|
|
129
|
+
* replay what's buffered, iterate {@link snapshot} first. */
|
|
130
|
+
function add_sink(sink) {
|
|
131
|
+
const b = bus();
|
|
132
|
+
b.sinks.add(sink);
|
|
133
|
+
return () => b.sinks.delete(sink);
|
|
134
|
+
}
|
|
135
|
+
/** Runtime configuration — pause/resume, resize the ring, set per-name sampling. */
|
|
136
|
+
function configure(opts) {
|
|
137
|
+
const b = bus();
|
|
138
|
+
if (typeof opts.active === "boolean") b.active = opts.active;
|
|
139
|
+
if (typeof opts.cap === "number" && opts.cap > 0 && opts.cap !== b.cap) {
|
|
140
|
+
const kept = snapshot().slice(-opts.cap);
|
|
141
|
+
b.cap = opts.cap;
|
|
142
|
+
b.ring = empty_ring(opts.cap);
|
|
143
|
+
b.write = 0;
|
|
144
|
+
b.count = 0;
|
|
145
|
+
for (const ev of kept) {
|
|
146
|
+
b.ring[b.write] = ev;
|
|
147
|
+
b.write = (b.write + 1) % b.cap;
|
|
148
|
+
if (b.count < b.cap) b.count++;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (opts.sample) for (const [name, n] of Object.entries(opts.sample)) b.sample.set(name, n);
|
|
152
|
+
}
|
|
153
|
+
export { DEVTOOLS, add_sink, clear, configure, emit, ingest, snapshot };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DEVTOOLS, DevtoolsSink, add_sink, clear, configure, emit, ingest, snapshot } from "./bus.js";
|
|
2
|
+
import { DevtoolsTrace, DevtoolsWindowHook, ingest_server_events, install_console_sink, install_postmessage_sink, install_window_sink, to_trace } from "./sinks.js";
|
|
3
|
+
import { CompileEventInput, DEVTOOLS_SCHEMA_VERSION, DevtoolsDomain, DevtoolsEnvelope, DevtoolsEvent, DevtoolsEventInput, HubEventInput, NavEventInput, RuntimeEventInput, ServerEventInput, WireEventInput } from "./schema.js";
|
|
4
|
+
export { type CompileEventInput, DEVTOOLS, DEVTOOLS_SCHEMA_VERSION, type DevtoolsDomain, type DevtoolsEnvelope, type DevtoolsEvent, type DevtoolsEventInput, type DevtoolsSink, type DevtoolsTrace, type DevtoolsWindowHook, type HubEventInput, type NavEventInput, type RuntimeEventInput, type ServerEventInput, type WireEventInput, add_sink, clear, configure, emit, ingest, ingest_server_events, install_console_sink, install_postmessage_sink, install_window_sink, snapshot, to_trace };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DEVTOOLS, add_sink, clear, configure, emit, ingest, snapshot } from "./bus.js";
|
|
2
|
+
import { ingest_server_events, install_console_sink, install_postmessage_sink, install_window_sink, to_trace } from "./sinks.js";
|
|
3
|
+
import { DEVTOOLS_SCHEMA_VERSION } from "./schema.js";
|
|
4
|
+
export { DEVTOOLS, DEVTOOLS_SCHEMA_VERSION, add_sink, clear, configure, emit, ingest, ingest_server_events, install_console_sink, install_postmessage_sink, install_window_sink, snapshot, to_trace };
|