@ogygia/core 0.0.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +7 -1
- package/ambient.d.ts +194 -0
- package/dist/ClientBindingStub.svelte +6 -0
- package/dist/ClientBindingStub.svelte.d.ts +26 -0
- package/dist/KeepHost.svelte +19 -0
- package/dist/KeepHost.svelte.d.ts +10 -0
- package/dist/LakeBoundary.svelte +16 -0
- package/dist/LakeBoundary.svelte.d.ts +11 -0
- package/dist/LateIsland.svelte +22 -0
- package/dist/LateIsland.svelte.d.ts +15 -0
- package/dist/LateIslandAwait.svelte +17 -0
- package/dist/LateIslandAwait.svelte.d.ts +15 -0
- package/dist/LiveHost.svelte +19 -0
- package/dist/LiveHost.svelte.d.ts +10 -0
- package/dist/NestedProvider.svelte +13 -0
- package/dist/NestedProvider.svelte.d.ts +8 -0
- package/dist/OgygiaBoundary.svelte +5 -0
- package/dist/OgygiaBoundary.svelte.d.ts +17 -0
- package/dist/PromiseRegion.svelte +40 -0
- package/dist/PromiseRegion.svelte.d.ts +15 -0
- package/dist/PromiseRegionAwait.svelte +27 -0
- package/dist/PromiseRegionAwait.svelte.d.ts +15 -0
- package/dist/Provide.svelte +27 -0
- package/dist/Provide.svelte.d.ts +8 -0
- package/dist/RawHtml.svelte +9 -0
- package/dist/RawHtml.svelte.d.ts +6 -0
- package/dist/Region.svelte +1173 -0
- package/dist/Region.svelte.d.ts +68 -0
- package/dist/SlotBoundary.svelte +13 -0
- package/dist/SlotBoundary.svelte.d.ts +7 -0
- package/dist/app.d.ts +4 -0
- package/dist/app.js +3 -0
- package/dist/boundary.d.ts +35 -0
- package/dist/boundary.js +127 -0
- package/dist/build-cache.d.ts +13 -0
- package/dist/build-cache.js +77 -0
- package/dist/compiler/blank-styles.d.ts +1 -0
- package/dist/compiler/blank-styles.js +63 -0
- package/dist/compiler/bom.d.ts +2 -0
- package/dist/compiler/bom.js +15 -0
- package/dist/compiler/browser-full.d.ts +8 -0
- package/dist/compiler/browser-full.js +8 -0
- package/dist/compiler/browser.d.ts +11 -0
- package/dist/compiler/browser.js +11 -0
- package/dist/compiler/content/transportables.d.ts +26 -0
- package/dist/compiler/content/transportables.js +219 -0
- package/dist/compiler/ctx.d.ts +180 -0
- package/dist/compiler/ctx.js +183 -0
- package/dist/compiler/debarrel/barrel.d.ts +55 -0
- package/dist/compiler/debarrel/barrel.js +248 -0
- package/dist/compiler/debarrel/options.d.ts +67 -0
- package/dist/compiler/debarrel/options.js +31 -0
- package/dist/compiler/debarrel/parse.d.ts +65 -0
- package/dist/compiler/debarrel/parse.js +256 -0
- package/dist/compiler/debarrel/plugin.d.ts +31 -0
- package/dist/compiler/debarrel/plugin.js +190 -0
- package/dist/compiler/debarrel/rewrite.d.ts +27 -0
- package/dist/compiler/debarrel/rewrite.js +118 -0
- package/dist/compiler/debarrel/svelte.d.ts +13 -0
- package/dist/compiler/debarrel/svelte.js +56 -0
- package/dist/compiler/dev/css-scope.d.ts +16 -0
- package/dist/compiler/dev/css-scope.js +38 -0
- package/dist/compiler/dev/dev-hmr.d.ts +25 -0
- package/dist/compiler/dev/dev-hmr.js +29 -0
- package/dist/compiler/dev/hmr.d.ts +34 -0
- package/dist/compiler/dev/hmr.js +57 -0
- package/dist/compiler/dev/region-bytes.d.ts +34 -0
- package/dist/compiler/dev/region-bytes.js +126 -0
- package/dist/compiler/driver.d.ts +280 -0
- package/dist/compiler/driver.js +1352 -0
- package/dist/compiler/flags.d.ts +16 -0
- package/dist/compiler/flags.js +101 -0
- package/dist/compiler/fouc-css.d.ts +97 -0
- package/dist/compiler/fouc-css.js +335 -0
- package/dist/compiler/free-vars.d.ts +20 -0
- package/dist/compiler/free-vars.js +327 -0
- package/dist/compiler/host.d.ts +65 -0
- package/dist/compiler/host.js +51 -0
- package/dist/compiler/ids.d.ts +84 -0
- package/dist/compiler/ids.js +86 -0
- package/dist/compiler/index.d.ts +11 -0
- package/dist/compiler/index.js +11 -0
- package/dist/compiler/kit.d.ts +129 -0
- package/dist/compiler/kit.js +563 -0
- package/dist/compiler/link/build-output.d.ts +44 -0
- package/dist/compiler/link/build-output.js +147 -0
- package/dist/compiler/link/caps.d.ts +48 -0
- package/dist/compiler/link/caps.js +64 -0
- package/dist/compiler/link/context-detect.d.ts +23 -0
- package/dist/compiler/link/context-detect.js +137 -0
- package/dist/compiler/link/emit-gate.d.ts +11 -0
- package/dist/compiler/link/emit-gate.js +40 -0
- package/dist/compiler/link/entry-shim.d.ts +4 -0
- package/dist/compiler/link/entry-shim.js +29 -0
- package/dist/compiler/link/island-deps.d.ts +142 -0
- package/dist/compiler/link/island-deps.js +525 -0
- package/dist/compiler/link/manifest.d.ts +5 -0
- package/dist/compiler/link/manifest.js +9 -0
- package/dist/compiler/link/page-keys.d.ts +64 -0
- package/dist/compiler/link/page-keys.js +683 -0
- package/dist/compiler/link/registry-stub.d.ts +41 -0
- package/dist/compiler/link/registry-stub.js +212 -0
- package/dist/compiler/link/router-config.d.ts +11 -0
- package/dist/compiler/link/router-config.js +15 -0
- package/dist/compiler/link/router-css.d.ts +22 -0
- package/dist/compiler/link/router-css.js +142 -0
- package/dist/compiler/link/runtime-entry.d.ts +71 -0
- package/dist/compiler/link/runtime-entry.js +132 -0
- package/dist/compiler/link/server-manifest.d.ts +12 -0
- package/dist/compiler/link/server-manifest.js +45 -0
- package/dist/compiler/link/speculation.d.ts +17 -0
- package/dist/compiler/link/speculation.js +36 -0
- package/dist/compiler/link/transport.d.ts +31 -0
- package/dist/compiler/link/transport.js +67 -0
- package/dist/compiler/macros/bake.d.ts +20 -0
- package/dist/compiler/macros/bake.js +317 -0
- package/dist/compiler/macros/browser.d.ts +11 -0
- package/dist/compiler/macros/browser.js +69 -0
- package/dist/compiler/macros/dedent.d.ts +12 -0
- package/dist/compiler/macros/dedent.js +36 -0
- package/dist/compiler/macros/dollar.d.ts +15 -0
- package/dist/compiler/macros/dollar.js +387 -0
- package/dist/compiler/macros/pipeline.d.ts +31 -0
- package/dist/compiler/macros/pipeline.js +106 -0
- package/dist/compiler/macros/source.d.ts +6 -0
- package/dist/compiler/macros/source.js +127 -0
- package/dist/compiler/macros/store.d.ts +17 -0
- package/dist/compiler/macros/store.js +244 -0
- package/dist/compiler/macros/wire.d.ts +14 -0
- package/dist/compiler/macros/wire.js +160 -0
- package/dist/compiler/ownership-stamps.d.ts +6 -0
- package/dist/compiler/ownership-stamps.js +144 -0
- package/dist/compiler/parse/oxc.d.ts +34 -0
- package/dist/compiler/parse/oxc.js +59 -0
- package/dist/compiler/parse/scan.d.ts +43 -0
- package/dist/compiler/parse/scan.js +232 -0
- package/dist/compiler/program.d.ts +140 -0
- package/dist/compiler/program.js +242 -0
- package/dist/compiler/region/emit.d.ts +169 -0
- package/dist/compiler/region/emit.js +286 -0
- package/dist/compiler/region/identity.d.ts +28 -0
- package/dist/compiler/region/identity.js +75 -0
- package/dist/compiler/region/ir.d.ts +65 -0
- package/dist/compiler/region/ir.js +0 -0
- package/dist/compiler/region/transform.d.ts +178 -0
- package/dist/compiler/region/transform.js +1933 -0
- package/dist/compiler/script-request.d.ts +1 -0
- package/dist/compiler/script-request.js +43 -0
- package/dist/context-bridge.d.ts +65 -0
- package/dist/context-bridge.js +217 -0
- package/dist/context-registry.d.ts +40 -0
- package/dist/context-registry.js +15 -0
- package/dist/context.d.ts +72 -0
- package/dist/context.js +158 -0
- package/dist/current-region.d.ts +14 -0
- package/dist/current-region.js +36 -0
- package/dist/document.d.ts +41 -0
- package/dist/document.js +125 -0
- package/dist/entry-hydrate.d.ts +5 -0
- package/dist/entry-hydrate.js +42 -0
- package/dist/escape.d.ts +18 -0
- package/dist/escape.js +37 -0
- package/dist/events/bus.d.ts +33 -0
- package/dist/events/bus.js +153 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.js +4 -0
- package/dist/events/schema.d.ts +389 -0
- package/dist/events/schema.js +23 -0
- package/dist/events/server-registry.d.ts +7 -0
- package/dist/events/server-registry.js +13 -0
- package/dist/events/sinks.d.ts +64 -0
- package/dist/events/sinks.js +85 -0
- package/dist/fn-transport.d.ts +33 -0
- package/dist/fn-transport.js +140 -0
- package/dist/frame.d.ts +20 -0
- package/dist/frame.js +19 -0
- package/dist/holes-record.d.ts +6 -0
- package/dist/holes-record.js +8 -0
- package/dist/hooks.d.ts +43 -0
- package/dist/hooks.js +1191 -0
- package/dist/hydration-info.d.ts +1 -0
- package/dist/hydration-info.js +31 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/insights/attr-rules.d.ts +15 -0
- package/dist/insights/attr-rules.js +27 -0
- package/dist/insights/cpu.d.ts +82 -0
- package/dist/insights/cpu.js +177 -0
- package/dist/insights/fp-drift.d.ts +28 -0
- package/dist/insights/fp-drift.js +148 -0
- package/dist/insights/hole-segments.d.ts +26 -0
- package/dist/insights/hole-segments.js +50 -0
- package/dist/insights/html-diff.d.ts +25 -0
- package/dist/insights/html-diff.js +157 -0
- package/dist/insights/hydration-hazards.d.ts +36 -0
- package/dist/insights/hydration-hazards.js +136 -0
- package/dist/insights/hydration-status.d.ts +2 -0
- package/dist/insights/hydration-status.js +0 -0
- package/dist/insights/index.d.ts +14 -0
- package/dist/insights/index.js +12 -0
- package/dist/insights/page-assets.d.ts +211 -0
- package/dist/insights/page-assets.js +608 -0
- package/dist/insights/page-insights.d.ts +749 -0
- package/dist/insights/page-insights.js +2157 -0
- package/dist/insights/session-data.d.ts +108 -0
- package/dist/insights/session-data.js +0 -0
- package/dist/insights/session-insights.d.ts +121 -0
- package/dist/insights/session-insights.js +548 -0
- package/dist/insights/switch.d.ts +53 -0
- package/dist/insights/switch.js +91 -0
- package/dist/insights/testing-version.d.ts +19 -0
- package/dist/insights/testing-version.js +21 -0
- package/dist/insights/third-party.d.ts +75 -0
- package/dist/insights/third-party.js +160 -0
- package/dist/internal-instruments.d.ts +13 -0
- package/dist/internal-instruments.js +12 -0
- package/dist/internal-reconcile.d.ts +3 -0
- package/dist/internal-reconcile.js +3 -0
- package/dist/internal-register.d.ts +7 -0
- package/dist/internal-register.js +7 -0
- package/dist/internal-server.d.ts +7 -0
- package/dist/internal-server.js +7 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.js +13 -0
- package/dist/island-graph.d.ts +36 -0
- package/dist/island-graph.js +89 -0
- package/dist/keep-fallback-marker.d.ts +7 -0
- package/dist/keep-fallback-marker.js +9 -0
- package/dist/keep-fallback.d.ts +13 -0
- package/dist/keep-fallback.js +39 -0
- package/dist/kit-paths.d.ts +2 -0
- package/dist/kit-paths.js +39 -0
- package/dist/late-region-registry.d.ts +40 -0
- package/dist/late-region-registry.js +36 -0
- package/dist/live-transport.d.ts +57 -0
- package/dist/live-transport.js +145 -0
- package/dist/markup.d.ts +4 -0
- package/dist/markup.js +4 -0
- package/dist/own-package.d.ts +15 -0
- package/dist/own-package.js +20 -0
- package/dist/page-defer.d.ts +33 -0
- package/dist/page-defer.js +35 -0
- package/dist/page-facts-script.d.ts +7 -0
- package/dist/page-facts-script.js +9 -0
- package/dist/page-seed-registry.d.ts +72 -0
- package/dist/page-seed-registry.js +31 -0
- package/dist/plugin/capability.d.ts +14 -0
- package/dist/plugin/capability.js +44 -0
- package/dist/plugin/client.d.ts +39 -0
- package/dist/plugin/client.js +6 -0
- package/dist/plugin/css.d.ts +3 -0
- package/dist/plugin/css.js +54 -0
- package/dist/plugin/facts.d.ts +42 -0
- package/dist/plugin/facts.js +37 -0
- package/dist/plugin/hooks.d.ts +33 -0
- package/dist/plugin/hooks.js +38 -0
- package/dist/plugin/index.d.ts +127 -0
- package/dist/plugin/index.js +26 -0
- package/dist/plugin/routes.d.ts +32 -0
- package/dist/plugin/routes.js +35 -0
- package/dist/plugin/server.d.ts +27 -0
- package/dist/plugin/server.js +92 -0
- package/dist/plugin/standard-schema.d.ts +27 -0
- package/dist/plugin/standard-schema.js +0 -0
- package/dist/plugin/testing.d.ts +13 -0
- package/dist/plugin/testing.js +54 -0
- package/dist/plugin/utils.d.ts +13 -0
- package/dist/plugin/utils.js +19 -0
- package/dist/portable-form.d.ts +22 -0
- package/dist/portable-form.js +52 -0
- package/dist/preference.d.ts +35 -0
- package/dist/preference.js +84 -0
- package/dist/preload.d.ts +1 -0
- package/dist/preload.js +21 -0
- package/dist/ref-watch.d.ts +31 -0
- package/dist/ref-watch.js +66 -0
- package/dist/ref.d.ts +124 -0
- package/dist/ref.js +272 -0
- package/dist/region-brand.d.ts +8 -0
- package/dist/region-brand.js +10 -0
- package/dist/region-core.d.ts +2 -0
- package/dist/region-core.js +1 -0
- package/dist/region-snippet.d.ts +73 -0
- package/dist/region-snippet.js +351 -0
- package/dist/region.d.ts +127 -0
- package/dist/region.js +162 -0
- package/dist/request-event.d.ts +1 -0
- package/dist/request-event.js +37 -0
- package/dist/router-css.d.ts +39 -0
- package/dist/router-css.js +66 -0
- package/dist/runtime/app-transport.d.ts +2 -0
- package/dist/runtime/app-transport.js +13 -0
- package/dist/runtime/beacon.d.ts +271 -0
- package/dist/runtime/beacon.js +2190 -0
- package/dist/runtime/boot-link.d.ts +1 -0
- package/dist/runtime/boot-link.js +44 -0
- package/dist/runtime/client-hooks.d.ts +5 -0
- package/dist/runtime/client-hooks.js +22 -0
- package/dist/runtime/client-plugins.d.ts +8 -0
- package/dist/runtime/client-plugins.js +34 -0
- package/dist/runtime/concurrency.d.ts +12 -0
- package/dist/runtime/concurrency.js +29 -0
- package/dist/runtime/connected.d.ts +12 -0
- package/dist/runtime/connected.js +16 -0
- package/dist/runtime/context.d.ts +1 -0
- package/dist/runtime/context.js +19 -0
- package/dist/runtime/core.d.ts +15 -0
- package/dist/runtime/core.js +1173 -0
- package/dist/runtime/drift-watch.d.ts +9 -0
- package/dist/runtime/drift-watch.js +60 -0
- package/dist/runtime/entry-locations.d.ts +33 -0
- package/dist/runtime/entry-locations.js +119 -0
- package/dist/runtime/foreign-props.d.ts +8 -0
- package/dist/runtime/foreign-props.js +14 -0
- package/dist/runtime/form-continuity.d.ts +10 -0
- package/dist/runtime/form-continuity.js +107 -0
- package/dist/runtime/frame-nav.d.ts +36 -0
- package/dist/runtime/frame-nav.js +225 -0
- package/dist/runtime/frame-store.d.ts +62 -0
- package/dist/runtime/frame-store.js +214 -0
- package/dist/runtime/frames.d.ts +1 -0
- package/dist/runtime/frames.js +25 -0
- package/dist/runtime/full.d.ts +4 -0
- package/dist/runtime/full.js +32 -0
- package/dist/runtime/hash.d.ts +41 -0
- package/dist/runtime/hash.js +79 -0
- package/dist/runtime/hole-facts.d.ts +8 -0
- package/dist/runtime/hole-facts.js +57 -0
- package/dist/runtime/host-classes.d.ts +24 -0
- package/dist/runtime/host-classes.js +43 -0
- package/dist/runtime/hydrate-core.d.ts +101 -0
- package/dist/runtime/hydrate-core.js +605 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/interaction-replay.d.ts +11 -0
- package/dist/runtime/interaction-replay.js +70 -0
- package/dist/runtime/interaction.d.ts +33 -0
- package/dist/runtime/interaction.js +217 -0
- package/dist/runtime/island-graph-preload.d.ts +13 -0
- package/dist/runtime/island-graph-preload.js +99 -0
- package/dist/runtime/kit-boot.d.ts +29 -0
- package/dist/runtime/kit-boot.js +60 -0
- package/dist/runtime/kit-page-thread.svelte.d.ts +1 -0
- package/dist/runtime/kit-page-thread.svelte.js +116 -0
- package/dist/runtime/lake-anchors.d.ts +13 -0
- package/dist/runtime/lake-anchors.js +19 -0
- package/dist/runtime/lakes.d.ts +15 -0
- package/dist/runtime/lakes.js +212 -0
- package/dist/runtime/live.d.ts +3 -0
- package/dist/runtime/live.js +17 -0
- package/dist/runtime/load-scheduler.d.ts +53 -0
- package/dist/runtime/load-scheduler.js +317 -0
- package/dist/runtime/morph.d.ts +42 -0
- package/dist/runtime/morph.js +671 -0
- package/dist/runtime/nav-handle.d.ts +25 -0
- package/dist/runtime/nav-handle.js +71 -0
- package/dist/runtime/nav-hooks.d.ts +2 -0
- package/dist/runtime/nav-hooks.js +23 -0
- package/dist/runtime/nearest-attr.d.ts +4 -0
- package/dist/runtime/nearest-attr.js +16 -0
- package/dist/runtime/observe.d.ts +27 -0
- package/dist/runtime/observe.js +63 -0
- package/dist/runtime/own-cost.d.ts +9 -0
- package/dist/runtime/own-cost.js +35 -0
- package/dist/runtime/ownership.d.ts +101 -0
- package/dist/runtime/ownership.js +115 -0
- package/dist/runtime/page-cache.d.ts +23 -0
- package/dist/runtime/page-cache.js +74 -0
- package/dist/runtime/page-defer.d.ts +14 -0
- package/dist/runtime/page-defer.js +103 -0
- package/dist/runtime/parse-html.d.ts +40 -0
- package/dist/runtime/parse-html.js +81 -0
- package/dist/runtime/reconcile.d.ts +41 -0
- package/dist/runtime/reconcile.js +194 -0
- package/dist/runtime/region-attrs.d.ts +95 -0
- package/dist/runtime/region-attrs.js +153 -0
- package/dist/runtime/region-endpoint-url.d.ts +76 -0
- package/dist/runtime/region-endpoint-url.js +169 -0
- package/dist/runtime/region-ids.d.ts +8 -0
- package/dist/runtime/region-ids.js +33 -0
- package/dist/runtime/remote-seeds.d.ts +2 -0
- package/dist/runtime/remote-seeds.js +21 -0
- package/dist/runtime/render-blocking.d.ts +2 -0
- package/dist/runtime/render-blocking.js +30 -0
- package/dist/runtime/restore.d.ts +34 -0
- package/dist/runtime/restore.js +390 -0
- package/dist/runtime/router-nav.d.ts +63 -0
- package/dist/runtime/router-nav.js +740 -0
- package/dist/runtime/router.d.ts +201 -0
- package/dist/runtime/router.js +593 -0
- package/dist/runtime/schedule.d.ts +49 -0
- package/dist/runtime/schedule.js +256 -0
- package/dist/runtime/seeds.d.ts +50 -0
- package/dist/runtime/seeds.js +208 -0
- package/dist/runtime/session.d.ts +52 -0
- package/dist/runtime/session.js +130 -0
- package/dist/runtime/sidecar.d.ts +3 -0
- package/dist/runtime/sidecar.js +56 -0
- package/dist/runtime/slots.d.ts +183 -0
- package/dist/runtime/slots.js +44 -0
- package/dist/runtime/spa-cacheable.d.ts +7 -0
- package/dist/runtime/spa-cacheable.js +18 -0
- package/dist/runtime/speculate-hint.d.ts +1 -0
- package/dist/runtime/speculate-hint.js +35 -0
- package/dist/runtime/svelte-warnings.d.ts +28 -0
- package/dist/runtime/svelte-warnings.js +71 -0
- package/dist/runtime/wire-classes.d.ts +3 -0
- package/dist/runtime/wire-classes.js +69 -0
- package/dist/runtime/wire-format.d.ts +7 -0
- package/dist/runtime/wire-format.js +22 -0
- package/dist/script.d.ts +134 -0
- package/dist/script.js +184 -0
- package/dist/seed-refs.d.ts +105 -0
- package/dist/seed-refs.js +487 -0
- package/dist/server/capability-lifetime.d.ts +28 -0
- package/dist/server/capability-lifetime.js +31 -0
- package/dist/server/dead-kit-resolves.d.ts +1 -0
- package/dist/server/dead-kit-resolves.js +39 -0
- package/dist/server/document-assembly.d.ts +30 -0
- package/dist/server/document-assembly.js +26 -0
- package/dist/server/document-tail.d.ts +113 -0
- package/dist/server/document-tail.js +208 -0
- package/dist/server/endpoint.d.ts +51 -0
- package/dist/server/endpoint.js +90 -0
- package/dist/server/entry-location.d.ts +8 -0
- package/dist/server/entry-location.js +29 -0
- package/dist/server/fingerprint.d.ts +1 -0
- package/dist/server/fingerprint.js +25 -0
- package/dist/server/head-presence.d.ts +45 -0
- package/dist/server/head-presence.js +156 -0
- package/dist/server/hmac.d.ts +38 -0
- package/dist/server/hmac.js +89 -0
- package/dist/server/hole-graph.d.ts +7 -0
- package/dist/server/hole-graph.js +71 -0
- package/dist/server/hole-urls.d.ts +3 -0
- package/dist/server/hole-urls.js +76 -0
- package/dist/server/html-scan.d.ts +19 -0
- package/dist/server/html-scan.js +60 -0
- package/dist/server/kit-context.d.ts +78 -0
- package/dist/server/kit-context.js +110 -0
- package/dist/server/late-wire.d.ts +22 -0
- package/dist/server/late-wire.js +28 -0
- package/dist/server/page-facts.d.ts +25 -0
- package/dist/server/page-facts.js +138 -0
- package/dist/server/page-seed.d.ts +33 -0
- package/dist/server/page-seed.js +60 -0
- package/dist/server/page-stream.d.ts +55 -0
- package/dist/server/page-stream.js +121 -0
- package/dist/server/payload.d.ts +6 -0
- package/dist/server/payload.js +22 -0
- package/dist/server/personal-response.d.ts +6 -0
- package/dist/server/personal-response.js +13 -0
- package/dist/server/props-wire.d.ts +56 -0
- package/dist/server/props-wire.js +178 -0
- package/dist/server/rate-limit.d.ts +22 -0
- package/dist/server/rate-limit.js +63 -0
- package/dist/server/region-css.d.ts +5 -0
- package/dist/server/region-css.js +30 -0
- package/dist/server/region-endpoint.d.ts +35 -0
- package/dist/server/region-endpoint.js +142 -0
- package/dist/server/region-props.d.ts +6 -0
- package/dist/server/region-props.js +44 -0
- package/dist/server/remote-seed-gate.d.ts +50 -0
- package/dist/server/remote-seed-gate.js +66 -0
- package/dist/server/render-cache.d.ts +26 -0
- package/dist/server/render-cache.js +51 -0
- package/dist/server/render-page.d.ts +51 -0
- package/dist/server/render-page.js +176 -0
- package/dist/server/render-region-html.d.ts +2 -0
- package/dist/server/render-region-html.js +19 -0
- package/dist/server/request-stats.d.ts +174 -0
- package/dist/server/request-stats.js +54 -0
- package/dist/server/reversible.d.ts +83 -0
- package/dist/server/reversible.js +994 -0
- package/dist/server/seed-shape.d.ts +22 -0
- package/dist/server/seed-shape.js +24 -0
- package/dist/server/shared-cache.d.ts +35 -0
- package/dist/server/shared-cache.js +104 -0
- package/dist/server/signing-key.d.ts +11 -0
- package/dist/server/signing-key.js +47 -0
- package/dist/server/sized-lru.d.ts +20 -0
- package/dist/server/sized-lru.js +68 -0
- package/dist/server/split-regions.d.ts +81 -0
- package/dist/server/split-regions.js +368 -0
- package/dist/server/stream-regions.d.ts +5 -0
- package/dist/server/stream-regions.js +36 -0
- package/dist/shared-state.d.ts +7 -0
- package/dist/shared-state.js +152 -0
- package/dist/shims/app-environment.d.ts +4 -0
- package/dist/shims/app-environment.js +6 -0
- package/dist/shims/app-navigation.d.ts +33 -0
- package/dist/shims/app-navigation.js +119 -0
- package/dist/shims/app-paths.d.ts +6 -0
- package/dist/shims/app-paths.js +18 -0
- package/dist/shims/app-state.svelte.d.ts +23 -0
- package/dist/shims/app-state.svelte.js +50 -0
- package/dist/shims/app-stores.d.ts +21 -0
- package/dist/shims/app-stores.js +54 -0
- package/dist/shims/kit-bridge.d.ts +29 -0
- package/dist/shims/kit-bridge.js +7 -0
- package/dist/shims/kit-remote/client-stub.d.ts +27 -0
- package/dist/shims/kit-remote/client-stub.js +43 -0
- package/dist/shims/kit-remote/paths-internal-stub.d.ts +3 -0
- package/dist/shims/kit-remote/paths-internal-stub.js +5 -0
- package/dist/shims/kit-remote/remote-cache.d.ts +49 -0
- package/dist/shims/kit-remote/remote-cache.js +73 -0
- package/dist/shims/kit-remote/state-stub.d.ts +8 -0
- package/dist/shims/kit-remote/state-stub.js +8 -0
- package/dist/shims/page-store.svelte.d.ts +39 -0
- package/dist/shims/page-store.svelte.js +77 -0
- package/dist/source.d.ts +29 -0
- package/dist/source.js +87 -0
- package/dist/store-transport.d.ts +86 -0
- package/dist/store-transport.js +229 -0
- package/dist/tool-fetches.d.ts +5 -0
- package/dist/tool-fetches.js +41 -0
- package/dist/transport.d.ts +48 -0
- package/dist/transport.js +181 -0
- package/dist/unscoped-css.d.ts +26 -0
- package/dist/unscoped-css.js +53 -0
- package/dist/vite/dev-maps.d.ts +33 -0
- package/dist/vite/dev-maps.js +140 -0
- package/dist/vite/index.d.ts +19 -0
- package/dist/vite/index.js +820 -0
- package/dist/vite/kit-dirs.d.ts +7 -0
- package/dist/vite/kit-dirs.js +67 -0
- package/dist/vite/late-island.d.ts +25 -0
- package/dist/vite/late-island.js +33 -0
- package/dist/vite/module-map.d.ts +8 -0
- package/dist/vite/module-map.js +144 -0
- package/dist/vite/options.d.ts +208 -0
- package/dist/vite/options.js +74 -0
- package/dist/vite/package-files.d.ts +3 -0
- package/dist/vite/package-files.js +84 -0
- package/dist/vite/paths.d.ts +45 -0
- package/dist/vite/paths.js +112 -0
- package/dist/vite/plugin-api.d.ts +166 -0
- package/dist/vite/plugin-api.js +212 -0
- package/dist/vite/profiler-maps.d.ts +23 -0
- package/dist/vite/profiler-maps.js +178 -0
- package/dist/vite/server-sourcemaps.d.ts +8 -0
- package/dist/vite/server-sourcemaps.js +80 -0
- package/dist/vite/sourcemaps.d.ts +18 -0
- package/dist/vite/sourcemaps.js +80 -0
- package/dist/vite/style-preprocess.d.ts +2 -0
- package/dist/vite/style-preprocess.js +96 -0
- package/package.json +180 -6
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const REGISTRY_STUB_PREFIX = "virtual:ogygia/registry-stub/";
|
|
2
|
+
/** The query that names a registry's client-leg variant (its marks blanked, everything else kept). */
|
|
3
|
+
export declare const REGISTRY_CLIENT_QUERY = "?og-registry-client";
|
|
4
|
+
/** The client-leg variant id of a registry: its real absolute path (relative imports resolve from
|
|
5
|
+
* the registry's own directory) plus {@link REGISTRY_CLIENT_QUERY}. */
|
|
6
|
+
export declare function registry_client_id(abs_path: string): string;
|
|
7
|
+
/** The registry path a client-leg variant id names, or `null` for any other id. */
|
|
8
|
+
export declare function registry_client_path(id: string): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* The static VALUE import specifiers of a script module — `import … from`, side-effect `import '…'`,
|
|
11
|
+
* `export … from`, `export * from` (type-only forms skipped; dynamic `import()` skipped: Kit links
|
|
12
|
+
* no CSS for a node's dynamic chunks). `null` when the module does not parse.
|
|
13
|
+
*/
|
|
14
|
+
export declare function static_script_specs(source: string, file: string): string[] | null;
|
|
15
|
+
/**
|
|
16
|
+
* The registry's source with its MARKS blanked and everything else kept, or `null` when it does not
|
|
17
|
+
* parse (the caller falls back to the names-only stub). A mark is an import whose `with { … }`
|
|
18
|
+
* carries a region key (`region_keys`: the app's wake / render / region / preset names), or a
|
|
19
|
+
* component handed to `import.meta.og.asRegion(…)`. Each blanked binding becomes
|
|
20
|
+
* `const X = undefined` so the module still links; the client leg never runs it anyway.
|
|
21
|
+
*/
|
|
22
|
+
export declare function registry_client_source(source: string, file: string, region_keys: ReadonlySet<string>): string | null;
|
|
23
|
+
/** Root-relative posix path → the stub id. `names` are the exports the stub must declare. */
|
|
24
|
+
export declare function registry_stub_id(rel_posix: string, names: Iterable<string>): string;
|
|
25
|
+
/** True for a (resolved or bare) stub id. */
|
|
26
|
+
export declare function is_registry_stub_id(id: string): boolean;
|
|
27
|
+
/** The export names a stub id carries (`default` included when the registry has one). */
|
|
28
|
+
export declare function registry_stub_names(id: string): string[];
|
|
29
|
+
/** The stub module's source: every name as `undefined`, so the host links and nothing is shipped. */
|
|
30
|
+
export declare function registry_stub_source(names: readonly string[]): string;
|
|
31
|
+
/**
|
|
32
|
+
* The names a module exports, scanned from its source (declarations, `export { a, b as c }`,
|
|
33
|
+
* `export default`). A textual scan — registries are plain TypeScript lists, and a name the scan
|
|
34
|
+
* misses is covered by {@link imported_names} (what the host actually asks for).
|
|
35
|
+
*/
|
|
36
|
+
export declare function export_names(source: string): Set<string>;
|
|
37
|
+
/**
|
|
38
|
+
* The names `importer_source` imports from `spec` (default → `default`, named → their exported
|
|
39
|
+
* names, `* as ns` → nothing extra: a namespace import links against whatever the stub declares).
|
|
40
|
+
*/
|
|
41
|
+
export declare function imported_names(importer_source: string, spec: string): Set<string>;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { parse_module } from "../parse/oxc.js";
|
|
2
|
+
import { walk } from "estree-walker";
|
|
3
|
+
// src/compiler/link/registry-stub.ts
|
|
4
|
+
/**
|
|
5
|
+
* `virtual:ogygia/registry-stub/…` — keep a REGION REGISTRY out of a csr=false page's client graph.
|
|
6
|
+
*
|
|
7
|
+
* THE LEAK: a `.ts` registry (`import Card from './Card.svelte' with { wake: 'visible' }` × N, the
|
|
8
|
+
* Builder / CMS block-factory shape) is a plain module to Kit. A csr=false route host that imports
|
|
9
|
+
* it pulls every marked component's WRAPPER — and through it the real component, its scoped CSS and
|
|
10
|
+
* its chunk closure — into that page node's client graph. Kit then links `node.stylesheets` for the
|
|
11
|
+
* whole registry on every page the host serves: one large landing page linked 163 stylesheets
|
|
12
|
+
* (337 registry marks) for 21 rendered islands, all render-blocking. The client never runs any of it
|
|
13
|
+
* — a csr=false document ships no Kit client at all; the node's JS exists only so Kit can link CSS.
|
|
14
|
+
*
|
|
15
|
+
* THE RULE: what a page needs is decided at SSR, by the render pass — Region.svelte links the CSS of
|
|
16
|
+
* every region that actually renders (`island_css_html` / `region_css_html`, claimed per request) and
|
|
17
|
+
* preloads its chunk. So on the csr=false CLIENT leg of a BUILD a route host's import of a registry
|
|
18
|
+
* resolves to this stub: a module exporting the same NAMES (as `undefined`) so the bundle links, and
|
|
19
|
+
* nothing else. The registry module itself is untouched — a csr=true page (Kit hydrates it, so it
|
|
20
|
+
* needs the real wrappers) and the island world keep importing the real thing. Dev keeps the graph
|
|
21
|
+
* (Vite serves CSS as modules there; a stub would unstyle the page).
|
|
22
|
+
*
|
|
23
|
+
* PLAIN IMPORTS STAY. A registry also holds PLAIN imports (a heading, a banner wrapper: no `with`).
|
|
24
|
+
* Those render on the server and never pass through Region, so the page node's client graph is the
|
|
25
|
+
* only thing that links their CSS — a names-only stub left them unstyled on every deploy (dev keeps
|
|
26
|
+
* the graph, so it never showed there). The client-leg registry is therefore the registry ITSELF
|
|
27
|
+
* with only its marks blanked ({@link registry_client_source}): every plain import, re-export,
|
|
28
|
+
* barrel and style import keeps its edge, resolved from the registry's own directory (the module id
|
|
29
|
+
* is the real path plus {@link REGISTRY_CLIENT_QUERY}), so Kit links their CSS exactly as before the
|
|
30
|
+
* stub. Their CSS is linked whether they render or not — the price of the graph deciding; marked
|
|
31
|
+
* imports stay out, which is the leak this module exists for.
|
|
32
|
+
*/
|
|
33
|
+
const REGISTRY_STUB_PREFIX = "virtual:ogygia/registry-stub/";
|
|
34
|
+
/** The query that names a registry's client-leg variant (its marks blanked, everything else kept). */
|
|
35
|
+
const REGISTRY_CLIENT_QUERY = "?og-registry-client";
|
|
36
|
+
/** The client-leg variant id of a registry: its real absolute path (relative imports resolve from
|
|
37
|
+
* the registry's own directory) plus {@link REGISTRY_CLIENT_QUERY}. */
|
|
38
|
+
function registry_client_id(abs_path) {
|
|
39
|
+
return abs_path + REGISTRY_CLIENT_QUERY;
|
|
40
|
+
}
|
|
41
|
+
/** The registry path a client-leg variant id names, or `null` for any other id. */
|
|
42
|
+
function registry_client_path(id) {
|
|
43
|
+
return id.endsWith("?og-registry-client") ? id.slice(0, -19) : null;
|
|
44
|
+
}
|
|
45
|
+
/** True when `node` is `import.meta.og.<prop>`. */
|
|
46
|
+
function is_og_macro(node, prop) {
|
|
47
|
+
return node?.type === "MemberExpression" && node.property?.name === prop && node.object?.type === "MemberExpression" && node.object.property?.name === "og" && node.object.object?.type === "MetaProperty" && node.object.object.meta?.name === "import" && node.object.object.property?.name === "meta";
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The static VALUE import specifiers of a script module — `import … from`, side-effect `import '…'`,
|
|
51
|
+
* `export … from`, `export * from` (type-only forms skipped; dynamic `import()` skipped: Kit links
|
|
52
|
+
* no CSS for a node's dynamic chunks). `null` when the module does not parse.
|
|
53
|
+
*/
|
|
54
|
+
function static_script_specs(source, file) {
|
|
55
|
+
const parsed = parse_module(source, file);
|
|
56
|
+
if (!parsed.ok || !parsed.program) return null;
|
|
57
|
+
const specs = [];
|
|
58
|
+
for (const node of parsed.program.body) {
|
|
59
|
+
if (!(node.type === "ImportDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportNamedDeclaration" && node.source) || node.importKind === "type" || node.exportKind === "type") continue;
|
|
60
|
+
const value = node.source?.value;
|
|
61
|
+
if (typeof value === "string") specs.push(value);
|
|
62
|
+
}
|
|
63
|
+
return specs;
|
|
64
|
+
}
|
|
65
|
+
/** `const a = undefined, b = undefined;` for the given locals (empty string for none). */
|
|
66
|
+
function undefined_consts(locals) {
|
|
67
|
+
return locals.length ? `const ${locals.map((l) => `${l} = undefined`).join(", ")};` : "";
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The registry's source with its MARKS blanked and everything else kept, or `null` when it does not
|
|
71
|
+
* parse (the caller falls back to the names-only stub). A mark is an import whose `with { … }`
|
|
72
|
+
* carries a region key (`region_keys`: the app's wake / render / region / preset names), or a
|
|
73
|
+
* component handed to `import.meta.og.asRegion(…)`. Each blanked binding becomes
|
|
74
|
+
* `const X = undefined` so the module still links; the client leg never runs it anyway.
|
|
75
|
+
*/
|
|
76
|
+
function registry_client_source(source, file, region_keys) {
|
|
77
|
+
const parsed = parse_module(source, file);
|
|
78
|
+
if (!parsed.ok || !parsed.program) return null;
|
|
79
|
+
const body = parsed.program.body;
|
|
80
|
+
const edits = [];
|
|
81
|
+
const as_region_args = /* @__PURE__ */ new Set();
|
|
82
|
+
walk(parsed.program, { enter(n) {
|
|
83
|
+
const node = n;
|
|
84
|
+
if (node.type !== "CallExpression") return;
|
|
85
|
+
if (is_og_macro(node.callee, "regions")) {
|
|
86
|
+
edits.push({
|
|
87
|
+
start: node.start,
|
|
88
|
+
end: node.end,
|
|
89
|
+
text: "({})"
|
|
90
|
+
});
|
|
91
|
+
this.skip();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!is_og_macro(node.callee, "asRegion")) return;
|
|
95
|
+
const arg = node.arguments?.[0];
|
|
96
|
+
if (arg?.type === "Identifier") as_region_args.add(arg.name);
|
|
97
|
+
edits.push({
|
|
98
|
+
start: node.start,
|
|
99
|
+
end: node.end,
|
|
100
|
+
text: "undefined"
|
|
101
|
+
});
|
|
102
|
+
this.skip();
|
|
103
|
+
} });
|
|
104
|
+
for (const node of body) {
|
|
105
|
+
if (node.type !== "ImportDeclaration" || node.importKind === "type") continue;
|
|
106
|
+
const specifiers = node.specifiers ?? [];
|
|
107
|
+
const marked = (node.attributes ?? []).some((a) => region_keys.has(a.key?.name ?? a.key?.value));
|
|
108
|
+
const dropped = specifiers.filter((s) => marked || s.importKind !== "type" && as_region_args.has(s.local.name));
|
|
109
|
+
if (!dropped.length) continue;
|
|
110
|
+
const kept = specifiers.filter((s) => !dropped.includes(s));
|
|
111
|
+
const consts = undefined_consts(dropped.map((s) => s.local.name));
|
|
112
|
+
if (!kept.length) {
|
|
113
|
+
edits.push({
|
|
114
|
+
start: node.start,
|
|
115
|
+
end: node.end,
|
|
116
|
+
text: consts
|
|
117
|
+
});
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const head = kept.filter((s) => s.type !== "ImportSpecifier").map((s) => source.slice(s.start, s.end));
|
|
121
|
+
const named = kept.filter((s) => s.type === "ImportSpecifier").map((s) => source.slice(s.start, s.end));
|
|
122
|
+
if (named.length) head.push(`{ ${named.join(", ")} }`);
|
|
123
|
+
const spec = source.slice(node.source.start, node.source.end);
|
|
124
|
+
edits.push({
|
|
125
|
+
start: node.start,
|
|
126
|
+
end: node.end,
|
|
127
|
+
text: `import ${head.join(", ")} from ${spec}; ${consts}`
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (!edits.length) return source;
|
|
131
|
+
edits.sort((a, b) => b.start - a.start);
|
|
132
|
+
let out = source;
|
|
133
|
+
for (const e of edits) out = out.slice(0, e.start) + e.text + out.slice(e.end);
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
const NAMES_PARAM = "?names=";
|
|
137
|
+
const EXPORT_DECL_G = /^\s*export\s+(?:async\s+)?(?:const|let|var|function\*?|class|enum|abstract\s+class)\s+([A-Za-z_$][\w$]*)/gm;
|
|
138
|
+
const EXPORT_LIST_G = /^\s*export\s*\{([^}]*)\}/gm;
|
|
139
|
+
const EXPORT_DEFAULT_RE = /^\s*export\s+default\b/m;
|
|
140
|
+
const IMPORT_FROM_G = /import\s+(?:type\s+)?([^'";]*?)\s*from\s*(['"])([^'"]+)\2/g;
|
|
141
|
+
const IMPORT_SIDE_EFFECT_RE = /^\s*$/;
|
|
142
|
+
const AS_RE = /\s+as\s+/;
|
|
143
|
+
const WS_G = /\s+/g;
|
|
144
|
+
/** Root-relative posix path → the stub id. `names` are the exports the stub must declare. */
|
|
145
|
+
function registry_stub_id(rel_posix, names) {
|
|
146
|
+
const sorted = [...new Set(names)].sort();
|
|
147
|
+
return `${REGISTRY_STUB_PREFIX}${encodeURIComponent(rel_posix)}.js${NAMES_PARAM}${sorted.map(encodeURIComponent).join(",")}`;
|
|
148
|
+
}
|
|
149
|
+
/** True for a (resolved or bare) stub id. */
|
|
150
|
+
function is_registry_stub_id(id) {
|
|
151
|
+
return (id.startsWith("\0") ? id.slice(1) : id).startsWith(REGISTRY_STUB_PREFIX);
|
|
152
|
+
}
|
|
153
|
+
/** The export names a stub id carries (`default` included when the registry has one). */
|
|
154
|
+
function registry_stub_names(id) {
|
|
155
|
+
const at = id.indexOf(NAMES_PARAM);
|
|
156
|
+
if (at < 0) return [];
|
|
157
|
+
return id.slice(at + 7).split(",").filter(Boolean).map(decodeURIComponent);
|
|
158
|
+
}
|
|
159
|
+
/** The stub module's source: every name as `undefined`, so the host links and nothing is shipped. */
|
|
160
|
+
function registry_stub_source(names) {
|
|
161
|
+
let out = "";
|
|
162
|
+
for (const n of names) if (n === "default") out += "export default undefined;\n";
|
|
163
|
+
else if (/^[A-Za-z_$][\w$]*$/.test(n)) out += `export const ${n} = undefined;\n`;
|
|
164
|
+
return out || "export {};\n";
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The names a module exports, scanned from its source (declarations, `export { a, b as c }`,
|
|
168
|
+
* `export default`). A textual scan — registries are plain TypeScript lists, and a name the scan
|
|
169
|
+
* misses is covered by {@link imported_names} (what the host actually asks for).
|
|
170
|
+
*/
|
|
171
|
+
function export_names(source) {
|
|
172
|
+
const names = /* @__PURE__ */ new Set();
|
|
173
|
+
EXPORT_DECL_G.lastIndex = 0;
|
|
174
|
+
let m;
|
|
175
|
+
while (m = EXPORT_DECL_G.exec(source)) names.add(m[1]);
|
|
176
|
+
EXPORT_LIST_G.lastIndex = 0;
|
|
177
|
+
while (m = EXPORT_LIST_G.exec(source)) for (const part of m[1].split(",")) {
|
|
178
|
+
const p = part.trim();
|
|
179
|
+
if (!p) continue;
|
|
180
|
+
const [, alias] = p.split(AS_RE);
|
|
181
|
+
const name = (alias ?? p).trim();
|
|
182
|
+
if (name === "default" || /^[A-Za-z_$][\w$]*$/.test(name)) names.add(name);
|
|
183
|
+
}
|
|
184
|
+
if (EXPORT_DEFAULT_RE.test(source)) names.add("default");
|
|
185
|
+
return names;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The names `importer_source` imports from `spec` (default → `default`, named → their exported
|
|
189
|
+
* names, `* as ns` → nothing extra: a namespace import links against whatever the stub declares).
|
|
190
|
+
*/
|
|
191
|
+
function imported_names(importer_source, spec) {
|
|
192
|
+
const names = /* @__PURE__ */ new Set();
|
|
193
|
+
IMPORT_FROM_G.lastIndex = 0;
|
|
194
|
+
let m;
|
|
195
|
+
while (m = IMPORT_FROM_G.exec(importer_source)) {
|
|
196
|
+
if (m[3] !== spec) continue;
|
|
197
|
+
const clause = m[1].replace(WS_G, " ").trim();
|
|
198
|
+
if (IMPORT_SIDE_EFFECT_RE.test(clause)) continue;
|
|
199
|
+
const brace = clause.indexOf("{");
|
|
200
|
+
const head = (brace >= 0 ? clause.slice(0, brace) : clause).replace(",", "").trim();
|
|
201
|
+
if (head && !head.startsWith("*")) names.add("default");
|
|
202
|
+
if (brace >= 0) for (const part of clause.slice(brace + 1, clause.indexOf("}")).split(",")) {
|
|
203
|
+
const p = part.trim().replace(/^type\s+/, "");
|
|
204
|
+
if (!p) continue;
|
|
205
|
+
const [exported] = p.split(AS_RE);
|
|
206
|
+
const name = exported.trim();
|
|
207
|
+
if (name) names.add(name);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return names;
|
|
211
|
+
}
|
|
212
|
+
export { REGISTRY_CLIENT_QUERY, REGISTRY_STUB_PREFIX, export_names, imported_names, is_registry_stub_id, registry_client_id, registry_client_path, registry_client_source, registry_stub_id, registry_stub_names, registry_stub_source, static_script_specs };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `virtual:ogygia/router-config` emitter.
|
|
3
|
+
*
|
|
4
|
+
* The handle reads this to inject the runtime + `ogygia-router` meta into every page head (app-wide
|
|
5
|
+
* SPA router). With the router OFF (MPA mode) the handle injects static Speculation Rules instead
|
|
6
|
+
* (`mpaSpeculationRules`, built by the handle: they leave out its islands endpoint, which the handle
|
|
7
|
+
* knows and the build does not).
|
|
8
|
+
*
|
|
9
|
+
* Pure over the two resolved router flags.
|
|
10
|
+
*/
|
|
11
|
+
export declare function router_config_module(router_enabled: boolean, router_view_transitions: boolean): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/compiler/link/router-config.ts
|
|
2
|
+
/**
|
|
3
|
+
* `virtual:ogygia/router-config` emitter.
|
|
4
|
+
*
|
|
5
|
+
* The handle reads this to inject the runtime + `ogygia-router` meta into every page head (app-wide
|
|
6
|
+
* SPA router). With the router OFF (MPA mode) the handle injects static Speculation Rules instead
|
|
7
|
+
* (`mpaSpeculationRules`, built by the handle: they leave out its islands endpoint, which the handle
|
|
8
|
+
* knows and the build does not).
|
|
9
|
+
*
|
|
10
|
+
* Pure over the two resolved router flags.
|
|
11
|
+
*/
|
|
12
|
+
function router_config_module(router_enabled, router_view_transitions) {
|
|
13
|
+
return `export const enabled = ${router_enabled};\nexport const viewTransitions = ${router_view_transitions};`;
|
|
14
|
+
}
|
|
15
|
+
export { router_config_module };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const ROUTER_CSS_KEY_PREFIX = "rcss:";
|
|
2
|
+
/** The handoff css-map key for one root component (posix-rel to the app root). */
|
|
3
|
+
export declare function router_css_key(root: string, abs: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* The `.svelte` ROOTS of the app's router modules: BFS from every page module (`b.pageModules()`),
|
|
6
|
+
* through relative/`$lib` `.ts`/`.js` re-exports (barrels — resolved as build
|
|
7
|
+
* DATA, imports untouched), collecting `.svelte` leaves. `module_specs` is the prescan's import-spec
|
|
8
|
+
* record (module abs path → its import/export-from specifiers). Sorted for determinism across legs.
|
|
9
|
+
*/
|
|
10
|
+
export declare function router_css_roots(router_modules: ReadonlySet<string>, module_specs: ReadonlyMap<string, readonly string[]>, lib_dir: string, exists?: (p: string) => boolean): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Emit the `virtual:ogygia/router-css` source. Empty (`export {}`) when the app has no router
|
|
13
|
+
* modules — the router's dynamic import of this virtual then registers nothing, zero cost.
|
|
14
|
+
*/
|
|
15
|
+
export declare function router_css_module(roots: readonly string[], opts: {
|
|
16
|
+
root: string;
|
|
17
|
+
lib_dir: string;
|
|
18
|
+
is_dev: boolean;
|
|
19
|
+
read_file: (p: string) => string | null;
|
|
20
|
+
/** the bundler's resolver, for the dev tree-CSS walk (compiler/fouc-css.ts) */
|
|
21
|
+
resolve?: (spec: string, importer: string) => Promise<string | null>;
|
|
22
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { fs, path } from "../host.js";
|
|
2
|
+
import { collectFoucCssReachable, compileFoucScopedCss, resolveFoucImportSpec } from "../fouc-css.js";
|
|
3
|
+
// src/compiler/link/router-css.ts
|
|
4
|
+
/**
|
|
5
|
+
* `virtual:ogygia/router-css` — how a SERVER-ROUTER page's `<style>` reaches the document.
|
|
6
|
+
*
|
|
7
|
+
* THE GAP: Kit links a route's stylesheets from its file-derived route manifest. `@ogygia/router`
|
|
8
|
+
* routes are VALUES (`r.page(Home)`) rendered through `document()` — no route, so nothing ever
|
|
9
|
+
* emitted or linked their CSS: a router page's scoped `<style>` (and its plain `.css` imports)
|
|
10
|
+
* silently never loaded. (The router fixture app's own rtr components are style-less for exactly this reason.)
|
|
11
|
+
*
|
|
12
|
+
* THE FIX, from existing primitives — no user file is modified, no `r.*` call-site analysis:
|
|
13
|
+
* 1. CLOSURE (build data): a router MODULE is a PAGE MODULE a plugin named (`b.pageModules()`): any
|
|
14
|
+
* module importing one of its specifiers (`'@ogygia/router'`), or a file it names — wherever it
|
|
15
|
+
* lives, however many routers it defines, whatever function wraps them. Its transitive `.svelte`
|
|
16
|
+
* imports (followed through relative/$lib `.ts`/`.js` barrels — build-data resolution, not import
|
|
17
|
+
* rewriting) are the components any of its routers could render: the ROOTS.
|
|
18
|
+
* 2. EMISSION (client leg, vite/index.ts): each root's whole transitive CSS (its own scoped styles +
|
|
19
|
+
* every child component's + plain `.css` imports, in cascade order) is compiled and emitted as ONE
|
|
20
|
+
* dedicated asset — resolved to a handoff `rcss:<rel>` href in writeBundle. A dedicated asset (not
|
|
21
|
+
* a chunk's `importedCss`) is immune to rolldown's shared-chunk CSS hoisting, which otherwise
|
|
22
|
+
* scatters a shared child's scoped CSS onto whatever chunk rolldown parks it on — an island's, off
|
|
23
|
+
* the router's static graph entirely (every profiler page shares Shell → this bites in practice).
|
|
24
|
+
* 3. REGISTRATION (this virtual, SSR): imports each root by absolute path — the same module instance
|
|
25
|
+
* the router module holds, so identity survives barrels — and registers it in the runtime WeakMap
|
|
26
|
+
* with a thunk resolving its stylesheet entries (prod: handoff hrefs + `$app/paths` base; dev:
|
|
27
|
+
* inline CSS compiled here, Kit-style).
|
|
28
|
+
* 4. LINKING (render): the router hands the components it actually renders to `componentCssHead()`
|
|
29
|
+
* (`ogygia/plugin/css`), which claims through
|
|
30
|
+
* `claim_region_css` (deduped with held-region links), and hands `document()` the head tags.
|
|
31
|
+
*/
|
|
32
|
+
const PATH_SEP = /[/\\]/;
|
|
33
|
+
const SVELTE_RE = /\.svelte$/;
|
|
34
|
+
const BARREL_RE = /\.(?:ts|js|mjs)$/;
|
|
35
|
+
const CSS_EXT_RE = /\.css$/;
|
|
36
|
+
/** Candidate suffixes for an extensionless spec, Vite resolution order-ish. */
|
|
37
|
+
const RESOLVE_SUFFIXES = [
|
|
38
|
+
"",
|
|
39
|
+
".ts",
|
|
40
|
+
".js",
|
|
41
|
+
".mjs",
|
|
42
|
+
".svelte",
|
|
43
|
+
"/index.ts",
|
|
44
|
+
"/index.js"
|
|
45
|
+
];
|
|
46
|
+
const ROUTER_CSS_KEY_PREFIX = "rcss:";
|
|
47
|
+
const posix = (p) => p.split(PATH_SEP).join("/");
|
|
48
|
+
/** The handoff css-map key for one root component (posix-rel to the app root). */
|
|
49
|
+
function router_css_key(root, abs) {
|
|
50
|
+
return ROUTER_CSS_KEY_PREFIX + posix(path.relative(root, abs));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The `.svelte` ROOTS of the app's router modules: BFS from every page module (`b.pageModules()`),
|
|
54
|
+
* through relative/`$lib` `.ts`/`.js` re-exports (barrels — resolved as build
|
|
55
|
+
* DATA, imports untouched), collecting `.svelte` leaves. `module_specs` is the prescan's import-spec
|
|
56
|
+
* record (module abs path → its import/export-from specifiers). Sorted for determinism across legs.
|
|
57
|
+
*/
|
|
58
|
+
function router_css_roots(router_modules, module_specs, lib_dir, exists = (p) => {
|
|
59
|
+
try {
|
|
60
|
+
return fs.statSync(p).isFile();
|
|
61
|
+
} catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}) {
|
|
65
|
+
const roots = /* @__PURE__ */ new Set();
|
|
66
|
+
const visited = /* @__PURE__ */ new Set();
|
|
67
|
+
const resolve_spec = (spec, importer) => {
|
|
68
|
+
const base = resolveFoucImportSpec(spec.split("?")[0], importer, lib_dir);
|
|
69
|
+
if (!base) return null;
|
|
70
|
+
for (const suffix of RESOLVE_SUFFIXES) {
|
|
71
|
+
const candidate = path.normalize(base + suffix);
|
|
72
|
+
if (exists(candidate)) return candidate;
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
};
|
|
76
|
+
const visit = (mod) => {
|
|
77
|
+
if (visited.has(mod)) return;
|
|
78
|
+
visited.add(mod);
|
|
79
|
+
for (const spec of module_specs.get(mod) ?? []) {
|
|
80
|
+
const resolved = resolve_spec(spec, mod);
|
|
81
|
+
if (!resolved) continue;
|
|
82
|
+
if (SVELTE_RE.test(resolved)) roots.add(resolved);
|
|
83
|
+
else if (BARREL_RE.test(resolved)) visit(resolved);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
for (const mod of router_modules) visit(mod);
|
|
87
|
+
return [...roots].sort();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Emit the `virtual:ogygia/router-css` source. Empty (`export {}`) when the app has no router
|
|
91
|
+
* modules — the router's dynamic import of this virtual then registers nothing, zero cost.
|
|
92
|
+
*/
|
|
93
|
+
async function router_css_module(roots, opts) {
|
|
94
|
+
if (roots.length === 0) return "export {};\n";
|
|
95
|
+
const lines = [`import { register_router_css } from 'ogygia/internal/register';`];
|
|
96
|
+
if (opts.is_dev) {
|
|
97
|
+
const assignments = [];
|
|
98
|
+
for (const abs of roots) {
|
|
99
|
+
const entries = [];
|
|
100
|
+
for (const e of await collectFoucCssReachable(abs, {
|
|
101
|
+
resolve: opts.resolve,
|
|
102
|
+
root: opts.root,
|
|
103
|
+
libDir: opts.lib_dir,
|
|
104
|
+
readFile: opts.read_file
|
|
105
|
+
})) {
|
|
106
|
+
const e_rel = posix(path.relative(opts.root, e.abs));
|
|
107
|
+
if (e.kind === "scoped") {
|
|
108
|
+
const source = opts.read_file(e.abs);
|
|
109
|
+
if (source == null) continue;
|
|
110
|
+
const css = compileFoucScopedCss(e.abs, source);
|
|
111
|
+
if (css) entries.push({
|
|
112
|
+
key: `rcss-dev:${e_rel}`,
|
|
113
|
+
css
|
|
114
|
+
});
|
|
115
|
+
} else {
|
|
116
|
+
if (!CSS_EXT_RE.test(e.abs)) continue;
|
|
117
|
+
const css = opts.read_file(e.abs);
|
|
118
|
+
if (css) entries.push({
|
|
119
|
+
key: `rcss-dev:${e_rel}`,
|
|
120
|
+
css
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (!entries.length) continue;
|
|
125
|
+
const abs_key = JSON.stringify(posix(abs));
|
|
126
|
+
const rel = posix(path.relative(opts.root, abs));
|
|
127
|
+
const keys = rel.startsWith("..") || path.isAbsolute(rel) ? [abs_key] : [abs_key, JSON.stringify(rel)];
|
|
128
|
+
assignments.push(`m[${keys.join("] = m[")}] = ${JSON.stringify(entries)};`);
|
|
129
|
+
}
|
|
130
|
+
return `import { register_router_css_paths } from 'ogygia/internal/register';\nconst m = {};\n${assignments.join("\n")}\nregister_router_css_paths(m);\n`;
|
|
131
|
+
}
|
|
132
|
+
lines.push(`import { islandCss } from 'virtual:ogygia/island-deps';`);
|
|
133
|
+
lines.push(`const base = typeof __SVELTEKIT_PATHS_BASE__ !== 'undefined' ? __SVELTEKIT_PATHS_BASE__ : '';`);
|
|
134
|
+
for (let i = 0; i < roots.length; i++) {
|
|
135
|
+
const abs = roots[i];
|
|
136
|
+
const key = router_css_key(opts.root, abs);
|
|
137
|
+
lines.push(`import __OgRcss${i} from ${JSON.stringify(abs)};`);
|
|
138
|
+
lines.push(`register_router_css(__OgRcss${i}, () => islandCss(${JSON.stringify(key)}).map((h) => ({ key: h, href: base + h })));`);
|
|
139
|
+
}
|
|
140
|
+
return lines.join("\n") + "\n";
|
|
141
|
+
}
|
|
142
|
+
export { ROUTER_CSS_KEY_PREFIX, router_css_key, router_css_module, router_css_roots };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime feature catalog — maps build-time marks → installable plugins.
|
|
3
|
+
* Module paths are absolute file URLs resolved by the Vite plugin against dist/src.
|
|
4
|
+
*/
|
|
5
|
+
export type RuntimeMarks = {
|
|
6
|
+
/** When false/undefined, emit kitchen-sink (safe default). */
|
|
7
|
+
complete?: boolean;
|
|
8
|
+
hydrate?: string[];
|
|
9
|
+
defer?: string[];
|
|
10
|
+
persist?: boolean;
|
|
11
|
+
persistKeys?: string[];
|
|
12
|
+
router?: boolean;
|
|
13
|
+
live?: boolean;
|
|
14
|
+
morph?: boolean;
|
|
15
|
+
lakes?: boolean;
|
|
16
|
+
forms?: boolean;
|
|
17
|
+
wire?: boolean;
|
|
18
|
+
remoteSeeds?: boolean;
|
|
19
|
+
/** App imports an ogygia context provider (`Provide` / `setContext` / `createContext`). Set by the
|
|
20
|
+
* driver's import scan; gates the cross-island context bridge (~4.7 kB) out of apps that never
|
|
21
|
+
* provide context. Read-only providers (`getContext`) don't set it — there's nothing to bridge. */
|
|
22
|
+
context?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type FeatureId = "remote-seeds" | "wire" | "frames" | "lakes" | "morph" | "live" | "interaction" | "forms" | "router" | "context";
|
|
25
|
+
/**
|
|
26
|
+
* WHICH CHUNK a feature lives in. The runtime ships as two static, feature-sized phases:
|
|
27
|
+
*
|
|
28
|
+
* - `boot` — the runtime entry (`og-runtime.*.js`), loaded by the `<script>` in `<head>`. Defines
|
|
29
|
+
* `<ogygia-region>`, schedules wakes, fetches holes, morphs, routes. It must never reach Svelte:
|
|
30
|
+
* in a real app Svelte's client runtime is ONE shared chunk (~200 KB), and anything in the boot's
|
|
31
|
+
* static graph downloads first, ahead of the page's own LCP image, before any island needs it.
|
|
32
|
+
* - `hydrate` — the hydrate core (`runtime/hydrate-core.js`), loaded by the runtime's single existing
|
|
33
|
+
* `import()` when the first island wakes, together with Svelte (which `hydrate()` needs anyway). A
|
|
34
|
+
* feature whose slot only the hydrate core reads belongs here, installed as the chunk evaluates.
|
|
35
|
+
*
|
|
36
|
+
* Both phases are generated from the same marks, so each is exactly as big as the app needs; no
|
|
37
|
+
* feature adds a dynamic import of its own. `test/runtime-boot-svelte-free.test.ts` pins the boot.
|
|
38
|
+
*/
|
|
39
|
+
export type FeaturePhase = "boot" | "hydrate";
|
|
40
|
+
export type FeatureDef = {
|
|
41
|
+
/** Path relative to `runtime/` (no leading ./). */
|
|
42
|
+
module: string;
|
|
43
|
+
deps: FeatureId[];
|
|
44
|
+
detect: (m: RuntimeMarks) => boolean;
|
|
45
|
+
/** Default `boot`. See {@link FeaturePhase}. */
|
|
46
|
+
phase?: FeaturePhase;
|
|
47
|
+
};
|
|
48
|
+
export declare const FEATURES: Record<FeatureId, FeatureDef>;
|
|
49
|
+
export declare const FEATURE_ORDER: FeatureId[];
|
|
50
|
+
/** Resolve the closed feature set for a marks manifest. */
|
|
51
|
+
export declare function resolveFeatures(marks: RuntimeMarks): FeatureId[];
|
|
52
|
+
/** The selected features of one {@link FeaturePhase}, in FEATURE_ORDER. */
|
|
53
|
+
export declare function phaseFeatures(marks: RuntimeMarks, phase: FeaturePhase): FeatureId[];
|
|
54
|
+
/**
|
|
55
|
+
* Emit the BOOT entry: core + the selected boot-phase features (see {@link FeaturePhase}).
|
|
56
|
+
* @param runtimeDir Absolute directory containing `core.js` + the feature modules.
|
|
57
|
+
*/
|
|
58
|
+
export declare function generateRuntimeEntrySource(marks: RuntimeMarks, runtimeDir: string, clientPlugins?: readonly string[]): {
|
|
59
|
+
code: string;
|
|
60
|
+
features: FeatureId[];
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Emit the HYDRATE-phase feature module (`virtual:ogygia/hydrate-features`), which the hydrate core
|
|
64
|
+
* imports statically and installs as its chunk evaluates — so these features ride the hydrate core's
|
|
65
|
+
* one existing `import()`, sized by the same marks as the boot. `all` (dev / no marks): every one.
|
|
66
|
+
* @param runtimeDir Absolute directory containing the feature modules.
|
|
67
|
+
*/
|
|
68
|
+
export declare function generateHydrateFeaturesSource(marks: RuntimeMarks, runtimeDir: string, all?: boolean): {
|
|
69
|
+
code: string;
|
|
70
|
+
features: FeatureId[];
|
|
71
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// src/compiler/link/runtime-entry.ts
|
|
2
|
+
const HYPHEN = /-/g;
|
|
3
|
+
const BACKSLASH = /\\/g;
|
|
4
|
+
const FEATURES = {
|
|
5
|
+
interaction: {
|
|
6
|
+
module: "interaction.js",
|
|
7
|
+
deps: [],
|
|
8
|
+
detect: (m) => (m.hydrate || []).some((w) => w !== "none")
|
|
9
|
+
},
|
|
10
|
+
forms: {
|
|
11
|
+
module: "form-continuity.js",
|
|
12
|
+
deps: [],
|
|
13
|
+
detect: (m) => m.forms === true || m.forms !== false && m.router === true
|
|
14
|
+
},
|
|
15
|
+
router: {
|
|
16
|
+
module: "router.js",
|
|
17
|
+
deps: [],
|
|
18
|
+
detect: (m) => m.router === true
|
|
19
|
+
},
|
|
20
|
+
lakes: {
|
|
21
|
+
module: "lakes.js",
|
|
22
|
+
deps: [],
|
|
23
|
+
detect: (m) => m.lakes === true || (m.hydrate || []).includes("none")
|
|
24
|
+
},
|
|
25
|
+
morph: {
|
|
26
|
+
module: "morph.js",
|
|
27
|
+
deps: [],
|
|
28
|
+
detect: (m) => m.live === true || m.morph === true || m.router === true || (m.defer || []).length > 0
|
|
29
|
+
},
|
|
30
|
+
live: {
|
|
31
|
+
module: "live.js",
|
|
32
|
+
deps: [],
|
|
33
|
+
phase: "hydrate",
|
|
34
|
+
detect: (m) => m.live === true || m.persist === true || (m.persistKeys || []).length > 0
|
|
35
|
+
},
|
|
36
|
+
wire: {
|
|
37
|
+
module: "../live-transport.js",
|
|
38
|
+
deps: [],
|
|
39
|
+
phase: "hydrate",
|
|
40
|
+
detect: (m) => m.wire === true
|
|
41
|
+
},
|
|
42
|
+
"remote-seeds": {
|
|
43
|
+
module: "remote-seeds.js",
|
|
44
|
+
deps: [],
|
|
45
|
+
phase: "hydrate",
|
|
46
|
+
detect: (m) => m.remoteSeeds !== false
|
|
47
|
+
},
|
|
48
|
+
frames: {
|
|
49
|
+
module: "frames.js",
|
|
50
|
+
deps: [],
|
|
51
|
+
detect: (m) => (m.defer || []).length > 0 || m.live === true || m.morph === true || m.lakes === true
|
|
52
|
+
},
|
|
53
|
+
context: {
|
|
54
|
+
module: "context.js",
|
|
55
|
+
deps: [],
|
|
56
|
+
phase: "hydrate",
|
|
57
|
+
detect: (m) => m.context === true
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const FEATURE_ORDER = [
|
|
61
|
+
"remote-seeds",
|
|
62
|
+
"wire",
|
|
63
|
+
"frames",
|
|
64
|
+
"lakes",
|
|
65
|
+
"morph",
|
|
66
|
+
"live",
|
|
67
|
+
"interaction",
|
|
68
|
+
"forms",
|
|
69
|
+
"router",
|
|
70
|
+
"context"
|
|
71
|
+
];
|
|
72
|
+
/** Resolve the closed feature set for a marks manifest. */
|
|
73
|
+
function resolveFeatures(marks) {
|
|
74
|
+
if (!marks.complete) return [...FEATURE_ORDER];
|
|
75
|
+
const selected = /* @__PURE__ */ new Set();
|
|
76
|
+
for (const id of FEATURE_ORDER) if (FEATURES[id].detect(marks)) selected.add(id);
|
|
77
|
+
let changed = true;
|
|
78
|
+
while (changed) {
|
|
79
|
+
changed = false;
|
|
80
|
+
for (const id of Array.from(selected)) for (const d of FEATURES[id].deps) if (!selected.has(d)) {
|
|
81
|
+
selected.add(d);
|
|
82
|
+
changed = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return FEATURE_ORDER.filter((id) => selected.has(id));
|
|
86
|
+
}
|
|
87
|
+
const to_alias = (id) => id.replace(HYPHEN, "_");
|
|
88
|
+
const runtime_path = (runtimeDir, mod) => `${runtimeDir}/${mod}`.replace(BACKSLASH, "/");
|
|
89
|
+
/** The selected features of one {@link FeaturePhase}, in FEATURE_ORDER. */
|
|
90
|
+
function phaseFeatures(marks, phase) {
|
|
91
|
+
return resolveFeatures(marks).filter((id) => (FEATURES[id].phase ?? "boot") === phase);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Emit the BOOT entry: core + the selected boot-phase features (see {@link FeaturePhase}).
|
|
95
|
+
* @param runtimeDir Absolute directory containing `core.js` + the feature modules.
|
|
96
|
+
*/
|
|
97
|
+
function generateRuntimeEntrySource(marks, runtimeDir, clientPlugins = []) {
|
|
98
|
+
const features = phaseFeatures(marks, "boot");
|
|
99
|
+
const lines = [];
|
|
100
|
+
lines.push(`/** generated ogygia runtime — features: ${features.join(", ") || "(core only)"} */`);
|
|
101
|
+
lines.push(`import { boot } from ${JSON.stringify(runtime_path(runtimeDir, "core.js"))};`);
|
|
102
|
+
for (const id of features) lines.push(`import * as ${to_alias(id)} from ${JSON.stringify(runtime_path(runtimeDir, FEATURES[id].module))};`);
|
|
103
|
+
clientPlugins.forEach((spec, i) => lines.push(`import __og_client_${i} from ${JSON.stringify(spec)};`));
|
|
104
|
+
lines.push("");
|
|
105
|
+
lines.push("boot([");
|
|
106
|
+
for (const id of features) lines.push(` ${to_alias(id)}.install,`);
|
|
107
|
+
lines.push(clientPlugins.length ? `], [${clientPlugins.map((_, i) => `__og_client_${i}`).join(", ")}]);` : "]);");
|
|
108
|
+
return {
|
|
109
|
+
code: lines.join("\n") + "\n",
|
|
110
|
+
features
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Emit the HYDRATE-phase feature module (`virtual:ogygia/hydrate-features`), which the hydrate core
|
|
115
|
+
* imports statically and installs as its chunk evaluates — so these features ride the hydrate core's
|
|
116
|
+
* one existing `import()`, sized by the same marks as the boot. `all` (dev / no marks): every one.
|
|
117
|
+
* @param runtimeDir Absolute directory containing the feature modules.
|
|
118
|
+
*/
|
|
119
|
+
function generateHydrateFeaturesSource(marks, runtimeDir, all = false) {
|
|
120
|
+
const features = all ? FEATURE_ORDER.filter((id) => FEATURES[id].phase === "hydrate") : phaseFeatures(marks, "hydrate");
|
|
121
|
+
const lines = [];
|
|
122
|
+
lines.push(`/** generated ogygia hydrate-phase features: ${features.join(", ") || "(none)"} */`);
|
|
123
|
+
for (const id of features) lines.push(`import * as ${to_alias(id)} from ${JSON.stringify(runtime_path(runtimeDir, FEATURES[id].module))};`);
|
|
124
|
+
lines.push("export function install() {");
|
|
125
|
+
for (const id of features) lines.push(` ${to_alias(id)}.install();`);
|
|
126
|
+
lines.push("}");
|
|
127
|
+
return {
|
|
128
|
+
code: lines.join("\n") + "\n",
|
|
129
|
+
features
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export { FEATURES, FEATURE_ORDER, generateHydrateFeaturesSource, generateRuntimeEntrySource, phaseFeatures, resolveFeatures };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Program } from "../program.js";
|
|
2
|
+
/** The SERVER-island ids the manifest carries right now (deferred / server-picked regions). */
|
|
3
|
+
export declare function server_island_ids(program: Program): string[];
|
|
4
|
+
export declare function server_manifest_module(ssr: boolean, program: Program, is_dev: boolean, devUrlFor: (virtualPath: string) => string, publicUrlFor: (iid: string) => string): string;
|
|
5
|
+
/** `virtual:ogygia/server-islands`: each SERVER island's loader, `id → () => import(entry)` (empty on
|
|
6
|
+
* the client). Imported only by the manifest's `load_islands()` — never statically. */
|
|
7
|
+
export declare function server_islands_module(ssr: boolean, program: Program): string;
|
|
8
|
+
/** The token the build replaces with its answer (driver `patch_page_data_reads`), inside a string
|
|
9
|
+
* literal the bundler cannot fold: a plain `null` placeholder was inlined into every reader as the
|
|
10
|
+
* constant it was (every hole then looked its page up). Unpatched it parses to nothing → `null`. */
|
|
11
|
+
export declare const PAGE_DATA_READS_TOKEN = "__OGYGIA_PAGE_DATA_READS__";
|
|
12
|
+
export declare const PAGE_DATA_READS_PLACEHOLDER: `(() => { try { return JSON.parse("${typeof PAGE_DATA_READS_TOKEN}"); } catch { return null; } })()`;
|