@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,7 @@
|
|
|
1
|
+
export declare const WIRE_FORMAT_ATTR = "data-og-format";
|
|
2
|
+
export declare const WIRE_FORMAT_JSON = "json";
|
|
3
|
+
/** Is this side-channel element's text the JSON lane? */
|
|
4
|
+
export declare function wire_is_json(el: Element): boolean;
|
|
5
|
+
/** Parse a side-channel's text in its lane: `JSON.parse` for the JSON lane (nothing to revive by
|
|
6
|
+
* construction), devalue `parse` with the caller's revivers otherwise. */
|
|
7
|
+
export declare function parse_wire_text(text: string, json: boolean, revivers?: Record<string, (value: never) => unknown>): unknown;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { parse } from "devalue";
|
|
2
|
+
// src/runtime/wire-format.ts
|
|
3
|
+
/**
|
|
4
|
+
* THE WIRE FORMAT of a side-channel script, read back. The server emits two lanes
|
|
5
|
+
* (server/props-wire.ts): plain JSON under `data-og-format="json"` (a payload with nothing devalue
|
|
6
|
+
* exists for — the common CMS props and seed), and devalue otherwise. This is the ONE place the
|
|
7
|
+
* client tells them apart: every seed / props / remote read goes through `parse_wire_text`.
|
|
8
|
+
*
|
|
9
|
+
* Pure (no DOM types beyond an attribute read) so the runtime, the shims and the tests share it.
|
|
10
|
+
*/
|
|
11
|
+
const WIRE_FORMAT_ATTR = "data-og-format";
|
|
12
|
+
const WIRE_FORMAT_JSON = "json";
|
|
13
|
+
/** Is this side-channel element's text the JSON lane? */
|
|
14
|
+
function wire_is_json(el) {
|
|
15
|
+
return el.getAttribute(WIRE_FORMAT_ATTR) === WIRE_FORMAT_JSON;
|
|
16
|
+
}
|
|
17
|
+
/** Parse a side-channel's text in its lane: `JSON.parse` for the JSON lane (nothing to revive by
|
|
18
|
+
* construction), devalue `parse` with the caller's revivers otherwise. */
|
|
19
|
+
function parse_wire_text(text, json, revivers) {
|
|
20
|
+
return json ? JSON.parse(text) : parse(text, revivers);
|
|
21
|
+
}
|
|
22
|
+
export { WIRE_FORMAT_ATTR, WIRE_FORMAT_JSON, parse_wire_text, wire_is_json };
|
package/dist/script.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/** A JSON value (what `args` and the data payloads carry). */
|
|
2
|
+
export type ScriptJson = string | number | boolean | null | ScriptJson[] | {
|
|
3
|
+
[key: string]: ScriptJson | undefined;
|
|
4
|
+
};
|
|
5
|
+
/** The attributes every kind of inline script may carry. `true` renders a bare attribute;
|
|
6
|
+
* `false` / `null` / `undefined` leave it out. */
|
|
7
|
+
export interface ScriptAttrs {
|
|
8
|
+
/** The element id (to find or replace the tag later). */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** The page's CSP nonce, when its policy allows inline scripts by nonce. */
|
|
11
|
+
nonce?: string;
|
|
12
|
+
/** Any `data-*` attribute. */
|
|
13
|
+
[data: `data-${string}`]: string | number | boolean | null | undefined;
|
|
14
|
+
}
|
|
15
|
+
type NoPayload = {
|
|
16
|
+
json?: never;
|
|
17
|
+
ld?: never;
|
|
18
|
+
importmap?: never;
|
|
19
|
+
speculation?: never;
|
|
20
|
+
};
|
|
21
|
+
type NoRun = {
|
|
22
|
+
run?: never;
|
|
23
|
+
args?: never;
|
|
24
|
+
type?: never;
|
|
25
|
+
async?: never;
|
|
26
|
+
nomodule?: never;
|
|
27
|
+
imports?: never;
|
|
28
|
+
};
|
|
29
|
+
/** What survives the JSON trip unchanged. A `Date` would arrive as a string, a `Map` / `Set` as
|
|
30
|
+
* `{}`, a function or class method not at all — those are `never`, so TypeScript refuses them. */
|
|
31
|
+
export type JsonSafe<T> = T extends string | number | boolean | null | undefined ? T : T extends bigint | symbol | ((...a: never[]) => unknown) | Date | RegExp | Map<unknown, unknown> | Set<unknown> ? never : { [K in keyof T]: JsonSafe<T[K]>; };
|
|
32
|
+
/** `run`'s parameters as they may be passed: inferred from the call, each one JSON-safe. */
|
|
33
|
+
export type ScriptArgs<A extends unknown[]> = A & { [K in keyof A]: JsonSafe<A[K]>; };
|
|
34
|
+
/** `args` is required exactly when `run` takes parameters. */
|
|
35
|
+
type RunArgs<A extends unknown[]> = A extends [] ? {
|
|
36
|
+
args?: [];
|
|
37
|
+
} : {
|
|
38
|
+
args: ScriptArgs<A>;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* A CLASSIC inline script (the default): runs where it stands, before the parser goes on — so in
|
|
42
|
+
* `<head>` it runs before the first paint. (`async` / `defer` do nothing on an inline classic script,
|
|
43
|
+
* so they are not offered: use `type: 'module'`.)
|
|
44
|
+
*/
|
|
45
|
+
export type ClassicScript<A extends unknown[]> = ScriptAttrs & NoPayload & {
|
|
46
|
+
run: (...args: A) => unknown;
|
|
47
|
+
type?: "classic";
|
|
48
|
+
/** Skip it in browsers that run modules (a fallback for very old ones). */
|
|
49
|
+
nomodule?: boolean;
|
|
50
|
+
async?: never;
|
|
51
|
+
/** (static imports need a module: `type: 'module'`) */
|
|
52
|
+
imports?: never;
|
|
53
|
+
} & RunArgs<A>;
|
|
54
|
+
/**
|
|
55
|
+
* A MODULE inline script: its own scope, strict mode, `import()` available, and runs after the
|
|
56
|
+
* document is parsed (the first paint does not wait for it — code that must apply before paint is a
|
|
57
|
+
* classic script). An `async` `run` is awaited, so its rejection reports as the module's.
|
|
58
|
+
* (`blocking="render"` is not offered: measured, it does not hold the paint for an inline module.)
|
|
59
|
+
*/
|
|
60
|
+
export type ModuleScript<A extends unknown[]> = ScriptAttrs & NoPayload & {
|
|
61
|
+
run: (...args: A) => unknown;
|
|
62
|
+
type: "module";
|
|
63
|
+
/** Run as soon as it is ready, without waiting for the document to finish parsing. */
|
|
64
|
+
async?: boolean;
|
|
65
|
+
nomodule?: never;
|
|
66
|
+
imports?: never;
|
|
67
|
+
} & RunArgs<A>;
|
|
68
|
+
/** The module namespaces `imports` hands to `run`, by the names it declared. (Untyped: annotate the
|
|
69
|
+
* parameter — `({ carousel }: { carousel: typeof import('…') })` — when you have the module's types.) */
|
|
70
|
+
export type ScriptImports<I extends Record<string, string>> = { readonly [K in keyof I]: any; };
|
|
71
|
+
/**
|
|
72
|
+
* A MODULE inline script that needs modules: `imports` are written as static `import * as …` before
|
|
73
|
+
* the call — data, not code, so no bundler rewrites them (an `import()` inside `run` would be: Vite's
|
|
74
|
+
* SSR transform turns it into `__vite_ssr_dynamic_import__`, which the browser does not have). `run`
|
|
75
|
+
* gets the namespaces as ONE object first, then `args`.
|
|
76
|
+
*/
|
|
77
|
+
export type ModuleImportsScript<I extends Record<string, string>, A extends unknown[]> = ScriptAttrs & NoPayload & {
|
|
78
|
+
/** Name → URL of each module to import (an absolute or root-relative URL, or a specifier the
|
|
79
|
+
* page's import map resolves). */
|
|
80
|
+
imports: I;
|
|
81
|
+
run: (modules: ScriptImports<I>, ...args: A) => unknown;
|
|
82
|
+
type: "module";
|
|
83
|
+
async?: boolean;
|
|
84
|
+
nomodule?: never;
|
|
85
|
+
} & RunArgs<A>;
|
|
86
|
+
/** `<script type="application/json">` — data for code on the page to read (`JSON.parse(el.textContent)`). */
|
|
87
|
+
export type JsonScript = ScriptAttrs & NoRun & {
|
|
88
|
+
json: ScriptJson;
|
|
89
|
+
ld?: never;
|
|
90
|
+
importmap?: never;
|
|
91
|
+
speculation?: never;
|
|
92
|
+
};
|
|
93
|
+
/** `<script type="application/ld+json">` — structured data for search engines. */
|
|
94
|
+
export type LdScript = ScriptAttrs & NoRun & {
|
|
95
|
+
ld: ScriptJson;
|
|
96
|
+
json?: never;
|
|
97
|
+
importmap?: never;
|
|
98
|
+
speculation?: never;
|
|
99
|
+
};
|
|
100
|
+
/** `<script type="importmap">` — bare specifiers for the page's module scripts. */
|
|
101
|
+
export type ImportMapScript = ScriptAttrs & NoRun & {
|
|
102
|
+
importmap: {
|
|
103
|
+
imports?: Record<string, string>;
|
|
104
|
+
scopes?: Record<string, Record<string, string>>;
|
|
105
|
+
integrity?: Record<string, string>;
|
|
106
|
+
};
|
|
107
|
+
json?: never;
|
|
108
|
+
ld?: never;
|
|
109
|
+
speculation?: never;
|
|
110
|
+
};
|
|
111
|
+
/** `<script type="speculationrules">` — the pages the browser may prefetch or prerender. */
|
|
112
|
+
export type SpeculationScript = ScriptAttrs & NoRun & {
|
|
113
|
+
speculation: {
|
|
114
|
+
prefetch?: ScriptJson[];
|
|
115
|
+
prerender?: ScriptJson[];
|
|
116
|
+
} & {
|
|
117
|
+
[key: string]: ScriptJson | undefined;
|
|
118
|
+
};
|
|
119
|
+
json?: never;
|
|
120
|
+
ld?: never;
|
|
121
|
+
importmap?: never;
|
|
122
|
+
};
|
|
123
|
+
export type ScriptOptions<A extends unknown[] = unknown[]> = ClassicScript<A> | ModuleScript<A> | ModuleImportsScript<Record<string, string>, A> | JsonScript | LdScript | ImportMapScript | SpeculationScript;
|
|
124
|
+
/**
|
|
125
|
+
* An inline `<script>` tag. Pass a function and its args (shortcut for `{ run: fn, args }`) or one
|
|
126
|
+
* options object; see
|
|
127
|
+
* the module doc. Throws on an object with no payload or more than one, and on an attribute name
|
|
128
|
+
* that is not one.
|
|
129
|
+
*/
|
|
130
|
+
export declare function script<A extends unknown[]>(run: (...args: A) => unknown, ...args: ScriptArgs<A>): string;
|
|
131
|
+
export declare function script<A extends unknown[]>(options: ClassicScript<A> | ModuleScript<A>): string;
|
|
132
|
+
export declare function script<I extends Record<string, string>, A extends unknown[] = []>(options: ModuleImportsScript<I, A>): string;
|
|
133
|
+
export declare function script(options: JsonScript | LdScript | ImportMapScript | SpeculationScript): string;
|
|
134
|
+
export {};
|
package/dist/script.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { escape_attr, escape_script_text } from "./escape.js";
|
|
2
|
+
// src/script.ts
|
|
3
|
+
/**
|
|
4
|
+
* `script()` — an inline `<script>` tag as a string, for the work a csr=false page must do in the
|
|
5
|
+
* HTML itself: before the first paint (a no-flash theme), before any island wakes (an early flag),
|
|
6
|
+
* or as data the page carries (JSON config, JSON-LD, an import map, speculation rules).
|
|
7
|
+
*
|
|
8
|
+
* ONE call shape: a plain object holding exactly one payload key — `run` (a function), `json`, `ld`,
|
|
9
|
+
* `importmap` or `speculation` — beside the tag's attributes. It spreads, it builds from config, and
|
|
10
|
+
* TypeScript refuses the combinations a browser silently ignores. A bare function (with any trailing
|
|
11
|
+
* args) is the shortcut for a plain classic script: `script(fn, a, b)` = `{ run: fn, args: [a, b] }`.
|
|
12
|
+
* The result is a string: `{@html}` it where the tag should land (usually `<svelte:head>`).
|
|
13
|
+
*
|
|
14
|
+
* ```svelte
|
|
15
|
+
* <svelte:head>
|
|
16
|
+
* {@html script(() => { const t = localStorage.getItem('theme'); if (t) document.documentElement.dataset.theme = t; })}
|
|
17
|
+
* {@html script((k) => apply(localStorage.getItem(k)), 'theme')}
|
|
18
|
+
* {@html script({ run: (href) => loadFont(href), args: [fontUrl], type: 'module' })}
|
|
19
|
+
* {@html script({ ld: { '@context': 'https://schema.org', '@type': 'Article', headline } })}
|
|
20
|
+
* </svelte:head>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* A `run` function is inlined through `Function.prototype.toString`, so it must be SELF-CONTAINED:
|
|
24
|
+
* browser globals only — no imports, no closed-over variables (they do not exist in the browser).
|
|
25
|
+
* Pass what it needs as `args`; they are JSON-serialized and handed to it in order.
|
|
26
|
+
*/
|
|
27
|
+
/** The payload and option keys — everything else in the object is an attribute. */
|
|
28
|
+
const RESERVED = /* @__PURE__ */ new Set([
|
|
29
|
+
"run",
|
|
30
|
+
"args",
|
|
31
|
+
"imports",
|
|
32
|
+
"json",
|
|
33
|
+
"ld",
|
|
34
|
+
"importmap",
|
|
35
|
+
"speculation",
|
|
36
|
+
"type"
|
|
37
|
+
]);
|
|
38
|
+
function script(input, ...rest) {
|
|
39
|
+
const o = typeof input === "function" ? {
|
|
40
|
+
run: input,
|
|
41
|
+
args: rest
|
|
42
|
+
} : input;
|
|
43
|
+
let type = null;
|
|
44
|
+
let body;
|
|
45
|
+
let kinds = 0;
|
|
46
|
+
if (o.run !== void 0) {
|
|
47
|
+
kinds++;
|
|
48
|
+
if (typeof o.run !== "function") throw new TypeError("[ogygia] script(): `run` must be a function");
|
|
49
|
+
const module = o.type === "module";
|
|
50
|
+
if (module) type = "module";
|
|
51
|
+
const args = o.args ?? [];
|
|
52
|
+
let call = "";
|
|
53
|
+
for (let i = 0; i < args.length; i++) {
|
|
54
|
+
const json = JSON.stringify(args[i]);
|
|
55
|
+
call += (i ? "," : "") + (json === void 0 ? "undefined" : escape_script_text(json));
|
|
56
|
+
}
|
|
57
|
+
let lines = "";
|
|
58
|
+
if (o.imports !== void 0) {
|
|
59
|
+
if (!module) throw new TypeError("[ogygia] script(): `imports` needs `type: 'module'` (a static import only works in a module)");
|
|
60
|
+
let mods = "";
|
|
61
|
+
let n = 0;
|
|
62
|
+
const imports = o.imports;
|
|
63
|
+
for (const name in imports) {
|
|
64
|
+
const url = imports[name];
|
|
65
|
+
if (typeof url !== "string" || !url) throw new TypeError(`[ogygia] script(): \`imports.${name}\` must be a URL string`);
|
|
66
|
+
lines += `import * as __og_m${n} from ${escape_script_text(JSON.stringify(url))};`;
|
|
67
|
+
mods += (n ? "," : "") + `${escape_script_text(JSON.stringify(name))}:__og_m${n}`;
|
|
68
|
+
n++;
|
|
69
|
+
}
|
|
70
|
+
call = `{${mods}}` + (call ? "," + call : "");
|
|
71
|
+
}
|
|
72
|
+
const src = fn_source(o.run);
|
|
73
|
+
if (src.indexOf("__vite_ssr_") !== -1) throw new TypeError("[ogygia] script(): `run` was rewritten by the bundler (it holds `__vite_ssr_…`): an `import()` or an imported binding inside it cannot cross into the browser. Declare the module in `imports` (with `type: 'module'`) and read it from `run`'s first parameter.");
|
|
74
|
+
body = `${lines}${module ? "await " : ""}(${close_safe(src)})(${call});`;
|
|
75
|
+
} else body = "";
|
|
76
|
+
for (const [key, kind] of DATA_KINDS) {
|
|
77
|
+
if (o[key] === void 0) continue;
|
|
78
|
+
kinds++;
|
|
79
|
+
type = kind;
|
|
80
|
+
const json = JSON.stringify(o[key]);
|
|
81
|
+
if (json === void 0) throw new TypeError(`[ogygia] script(): \`${key}\` must be JSON-serializable`);
|
|
82
|
+
body = escape_script_text(json);
|
|
83
|
+
}
|
|
84
|
+
if (kinds !== 1) throw new TypeError(`[ogygia] script(): pass exactly one of \`run\`, \`json\`, \`ld\`, \`importmap\`, \`speculation\` (got ${kinds})`);
|
|
85
|
+
let attrs = type ? ` type="${type}"` : "";
|
|
86
|
+
for (const key in o) {
|
|
87
|
+
if (RESERVED.has(key)) continue;
|
|
88
|
+
const v = o[key];
|
|
89
|
+
if (v === void 0 || v === null || v === false) continue;
|
|
90
|
+
if (!is_attr_name(key)) throw new TypeError(`[ogygia] script(): \`${key}\` is not an attribute name`);
|
|
91
|
+
attrs += v === true ? " " + key : ` ${key}="${escape_attr(String(v))}"`;
|
|
92
|
+
}
|
|
93
|
+
return `<script${attrs}>${body}<\/script>`;
|
|
94
|
+
}
|
|
95
|
+
const DATA_KINDS = [
|
|
96
|
+
["json", "application/json"],
|
|
97
|
+
["ld", "application/ld+json"],
|
|
98
|
+
["importmap", "importmap"],
|
|
99
|
+
["speculation", "speculationrules"]
|
|
100
|
+
];
|
|
101
|
+
/**
|
|
102
|
+
* Code that cannot leave the tag it lives in. Two HTML tokenizer traps, both in strings, regexes or
|
|
103
|
+
* comments of the code (where they are legal JS):
|
|
104
|
+
* - `<\/script` (any case) closes the tag → `<\/script` (the same text in a string, a template or a
|
|
105
|
+
* regex, with or without the `u` flag);
|
|
106
|
+
* - `<!--` switches the tokenizer into the escaped state, where a later `<script` makes the REAL
|
|
107
|
+
* `<\/script>` no longer close the tag — the rest of the page becomes script text → `\x3C!--`
|
|
108
|
+
* (the same text in a string, a template or a regex, `u` flag included).
|
|
109
|
+
* (`a <!--b` as an expression — `a < !(--b)` — would no longer parse. Nobody writes it.)
|
|
110
|
+
*/
|
|
111
|
+
function close_safe(code) {
|
|
112
|
+
let out = "";
|
|
113
|
+
let last = 0;
|
|
114
|
+
for (let i = code.indexOf("<"); i !== -1; i = code.indexOf("<", i + 1)) if (code.startsWith("!--", i + 1)) {
|
|
115
|
+
out += code.slice(last, i) + "\\x3C";
|
|
116
|
+
last = i + 1;
|
|
117
|
+
} else if (code.charCodeAt(i + 1) === 47 && code.slice(i + 2, i + 8).toLowerCase() === "script") {
|
|
118
|
+
out += code.slice(last, i + 1) + "\\";
|
|
119
|
+
last = i + 1;
|
|
120
|
+
}
|
|
121
|
+
return last === 0 ? code : out + code.slice(last);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* A function's source as an EXPRESSION. `toString` of an arrow or a `function` already is one; a
|
|
125
|
+
* method written in the options object (`{ run() { … } }`, `async run()`, `*run()`) is not —
|
|
126
|
+
* `(run() {…})` is a syntax error — so a method is read back out of an object literal:
|
|
127
|
+
* `Object.values({ run() {…} })[0]`.
|
|
128
|
+
*/
|
|
129
|
+
function fn_source(fn) {
|
|
130
|
+
const src = fn.toString();
|
|
131
|
+
let i = 0;
|
|
132
|
+
if (src.startsWith("async")) {
|
|
133
|
+
let j = 5;
|
|
134
|
+
while (is_ws(src.charCodeAt(j))) j++;
|
|
135
|
+
if (src.startsWith("=>", j)) return src;
|
|
136
|
+
if (src.charCodeAt(j) === 40) return src.startsWith("=>", skip_ws(src, after_parens(src, j))) ? src : `Object.values({${src}})[0]`;
|
|
137
|
+
if (j === 5) return `Object.values({${src}})[0]`;
|
|
138
|
+
i = j;
|
|
139
|
+
}
|
|
140
|
+
if (src.startsWith("function", i) && !is_ident(src.charCodeAt(i + 8))) return src;
|
|
141
|
+
const c = src.charCodeAt(i);
|
|
142
|
+
if (c === 40) return src;
|
|
143
|
+
if (is_ident(c)) {
|
|
144
|
+
let j = i;
|
|
145
|
+
while (is_ident(src.charCodeAt(j))) j++;
|
|
146
|
+
if (src.startsWith("=>", skip_ws(src, j))) return src;
|
|
147
|
+
}
|
|
148
|
+
return `Object.values({${src}})[0]`;
|
|
149
|
+
}
|
|
150
|
+
function is_ws(c) {
|
|
151
|
+
return c === 32 || c === 9 || c === 10 || c === 13;
|
|
152
|
+
}
|
|
153
|
+
function is_ident(c) {
|
|
154
|
+
return c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 95 || c === 36 || c > 127;
|
|
155
|
+
}
|
|
156
|
+
function skip_ws(s, i) {
|
|
157
|
+
while (is_ws(s.charCodeAt(i))) i++;
|
|
158
|
+
return i;
|
|
159
|
+
}
|
|
160
|
+
/** The index after the `)` that closes the `(` at `open` — strings skipped, nesting counted. */
|
|
161
|
+
function after_parens(s, open) {
|
|
162
|
+
let depth = 0;
|
|
163
|
+
for (let i = open; i < s.length; i++) {
|
|
164
|
+
const c = s.charCodeAt(i);
|
|
165
|
+
if (c === 34 || c === 39 || c === 96) {
|
|
166
|
+
for (i++; i < s.length && s.charCodeAt(i) !== c; i++) if (s.charCodeAt(i) === 92) i++;
|
|
167
|
+
} else if (c === 40) depth++;
|
|
168
|
+
else if (c === 41 && --depth === 0) return i + 1;
|
|
169
|
+
}
|
|
170
|
+
return s.length;
|
|
171
|
+
}
|
|
172
|
+
/** An HTML attribute name we will write: letters, digits, `-`, `_`, `:`, `.`, starting with a letter. */
|
|
173
|
+
function is_attr_name(s) {
|
|
174
|
+
if (s.length === 0) return false;
|
|
175
|
+
for (let i = 0; i < s.length; i++) {
|
|
176
|
+
const c = s.charCodeAt(i);
|
|
177
|
+
if (c >= 97 && c <= 122 || c >= 65 && c <= 90) continue;
|
|
178
|
+
if (i === 0) return false;
|
|
179
|
+
if (c >= 48 && c <= 57 || c === 45 || c === 95 || c === 58 || c === 46) continue;
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
export { script };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/** The devalue type tag. */
|
|
2
|
+
export declare const SEED_REF_KEY = "OgygiaSeedRef";
|
|
3
|
+
export type SeedPath = (string | number)[];
|
|
4
|
+
export interface SeedIndex {
|
|
5
|
+
/** node → its path from `page.data` (identity matches: the app passed the seed's own object).
|
|
6
|
+
* The path is materialised on the first ask — an indexed node that no island references
|
|
7
|
+
* never allocates one. */
|
|
8
|
+
readonly by_identity: {
|
|
9
|
+
get(node: object): SeedPath | undefined;
|
|
10
|
+
has(node: object): boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The seed nodes with exactly this byte estimate — the only ones a props node of that size can
|
|
14
|
+
* be a clone of. Structure matching hashes just those few candidates (memoised per seed node)
|
|
15
|
+
* instead of the whole seed, so an app that passes the seed's own objects never hashes a seed
|
|
16
|
+
* node at all, and a cloning app hashes only what it has to. The buckets are built on the first
|
|
17
|
+
* ask — a page whose islands only pass seed objects by identity never builds them.
|
|
18
|
+
*/
|
|
19
|
+
candidates(bytes: number): readonly object[];
|
|
20
|
+
/** Structural hash of an indexed seed node, memoised for the request. */
|
|
21
|
+
hash_of(node: object): string | null;
|
|
22
|
+
/** nodes indexed (for tests / devtools). */
|
|
23
|
+
readonly size: number;
|
|
24
|
+
/**
|
|
25
|
+
* SEED SHAPING: the top-level `page.data` keys under which a props node was matched
|
|
26
|
+
* (`plan_seed_refs` records the first path segment of every reference it plans). The handle
|
|
27
|
+
* renders the tail against the FULL index, then ships every touched key — a key no island's
|
|
28
|
+
* code reads but whose node an island's props point into still ships, so a reference always
|
|
29
|
+
* has something to point at.
|
|
30
|
+
*/
|
|
31
|
+
readonly touched: Set<string>;
|
|
32
|
+
}
|
|
33
|
+
/** Exact structural equality for the shapes `hash_subtree` accepts — the check behind a hash hit. */
|
|
34
|
+
export declare function deep_equal_plain(a: unknown, b: unknown): boolean;
|
|
35
|
+
/** What one walk learns about a subtree. */
|
|
36
|
+
export interface Measure {
|
|
37
|
+
/** Byte estimate of the subtree's serialized form (a threshold input, not an exact count). */
|
|
38
|
+
readonly bytes: number;
|
|
39
|
+
/** Referenceable: plain objects / arrays / plain leaves only, no cycle — a seed ref may point
|
|
40
|
+
* at it and the client reads it back as the same plain data. */
|
|
41
|
+
readonly ref: boolean;
|
|
42
|
+
/** JSON-exact: `JSON.stringify` + `JSON.parse` reproduce it — no undefined, Date, bigint,
|
|
43
|
+
* non-finite number, -0, class instance, Map/Set, cycle. What picks the JSON lane. */
|
|
44
|
+
readonly json: boolean;
|
|
45
|
+
/** A thenable somewhere inside (a streamed load promise the handle must stage or settle). */
|
|
46
|
+
readonly thenable: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** Per-node measures: plain object / array → packed measure. Shared across every root measured in
|
|
49
|
+
* one request (the handle installs a reader); a fresh one per root outside a request. */
|
|
50
|
+
export type MeasureMemo = Map<object, number>;
|
|
51
|
+
type MemoReader = () => MeasureMemo | null;
|
|
52
|
+
/** Server (`hooks.ts`) installs a request-scoped reader: every root measured during one request
|
|
53
|
+
* shares one memo, so a subtree reached from two roots (the seed and an island's props) is walked
|
|
54
|
+
* once. `null` uninstalls; off-request (a hole endpoint, a test) each root gets its own memo. */
|
|
55
|
+
export declare function set_measure_memo_reader(fn: MemoReader | null): void;
|
|
56
|
+
/** What one walk says about a value (see {@link Measure}). */
|
|
57
|
+
export declare function analyze(value: unknown): Measure;
|
|
58
|
+
/**
|
|
59
|
+
* WHY a tree is not JSON-exact: the path of the first leaf that disqualifies it, with what it
|
|
60
|
+
* is — `config.updated (Date)`, `rows[3].price (NaN)`, `facets (Map)`, `meta (class Foo)`. A
|
|
61
|
+
* separate walk on purpose (the measuring walk carries no paths); the handle runs it only for a
|
|
62
|
+
* tree that left the JSON lane and only while the profiler records. `null` for a JSON tree.
|
|
63
|
+
*/
|
|
64
|
+
export declare function json_culprit(value: unknown, max_depth?: number): string | null;
|
|
65
|
+
/**
|
|
66
|
+
* Index the seed's `data` for referencing: every referenceable node at or above `min_bytes`, by
|
|
67
|
+
* identity now and by structural hash on demand (first occurrence wins — the shortest path is not
|
|
68
|
+
* guaranteed, the first in key order is, which is deterministic). Cached per `data` object: one
|
|
69
|
+
* index per request, however many islands ask. It reads the one measuring walk (`analyze`) and
|
|
70
|
+
* prunes: a node below `min_bytes` cannot hold a child at or above it (a child is never larger
|
|
71
|
+
* than its parent), so its subtree is skipped BEFORE anything is materialised — on a CMS tree that
|
|
72
|
+
* is most of the nodes.
|
|
73
|
+
*/
|
|
74
|
+
export declare function index_seed(data: unknown, min_bytes?: number): SeedIndex;
|
|
75
|
+
export interface SeedRefPlan {
|
|
76
|
+
/** The devalue reducer for the `OgygiaSeedRef` type: `(value) => path | undefined`. */
|
|
77
|
+
reducer: (value: unknown) => SeedPath | undefined;
|
|
78
|
+
/** How many props nodes will cross as references (0 = serialize the canonical text instead). */
|
|
79
|
+
count: number;
|
|
80
|
+
/** The top-level `page.data` keys the references point into (this island's share of `touched`). */
|
|
81
|
+
keys: Set<string>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Plan one island's references: walk the props once, top-down, largest matching ancestor first —
|
|
85
|
+
* identity first (a pointer lookup per node, no hashing), then structure (hash + exact comparison,
|
|
86
|
+
* only for a large plain node the seed does not own, and only against the seed nodes of exactly the
|
|
87
|
+
* same byte size — usually none, or one). Nodes under a matched ancestor are never visited (they
|
|
88
|
+
* ride inside the reference), and neither is anything under a node below `min_bytes` (no child
|
|
89
|
+
* of it can be referenced). The props' own measures come from the request memo, so the plan adds
|
|
90
|
+
* no walk of its own beyond the pointer lookups.
|
|
91
|
+
*/
|
|
92
|
+
export declare function plan_seed_refs(index: SeedIndex, props: unknown, min_bytes?: number): SeedRefPlan;
|
|
93
|
+
/** Client: the node a path points at, or `undefined` when the seed does not have it. */
|
|
94
|
+
export declare function resolve_seed_ref(data: unknown, path: SeedPath): unknown;
|
|
95
|
+
/**
|
|
96
|
+
* Client reviver for the devalue type: resolve BY REFERENCE. The island receives the seed's own
|
|
97
|
+
* node — the same object its `page.data` read would hand it, shared exactly the way `page.data`
|
|
98
|
+
* already is between islands. A deep copy per reference (129 of them on a measured page) bought
|
|
99
|
+
* nothing: island props are a snapshot either way, and the DEV mutation guard the runtime wraps
|
|
100
|
+
* every island's props in (`PropMutationGuard`) already warns on a write into them. `get_data` is
|
|
101
|
+
* called lazily, once per reviver — the first reference resolves the seed. A dangling path (no seed,
|
|
102
|
+
* or a seed that does not carry the node) revives to `undefined` and, in dev, says why.
|
|
103
|
+
*/
|
|
104
|
+
export declare function seed_ref_reviver(get_data: () => unknown): (path: SeedPath) => unknown;
|
|
105
|
+
export {};
|