@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,820 @@
|
|
|
1
|
+
import { configure_build_cache } from "../build-cache.js";
|
|
2
|
+
import { contentCssKey as content_css_key } from "../plugin/utils.js";
|
|
3
|
+
import { island_sourcemaps_plugin } from "./sourcemaps.js";
|
|
4
|
+
import { server_sourcemaps_plugin } from "./server-sourcemaps.js";
|
|
5
|
+
import { install_dev_client_maps, install_dev_maps, install_dev_page_keys } from "./dev-maps.js";
|
|
6
|
+
import { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, asRegionLocals, import_keys_hint, is_island_path, islandChunkFileName, islandId, islandPublicUrl, normalize_import_keys, wrapperVirtualId } from "../compiler/region/transform.js";
|
|
7
|
+
import { regionId, regionIdentity, strategyKey } from "../compiler/region/identity.js";
|
|
8
|
+
import { rewrite_lake_import_to_placeholder } from "../compiler/region/emit.js";
|
|
9
|
+
import { debarrel } from "../compiler/debarrel/plugin.js";
|
|
10
|
+
import { definePlugin, find_plugins, resolve_plugins } from "./plugin-api.js";
|
|
11
|
+
import { assert_no_legacy_options, resolve_options, validate_region_presets } from "./options.js";
|
|
12
|
+
import { clear_route_csr_cache, clientBuildWillSkip, hasAnyCsrFalseRoute, inject_keep_client_route, keep_client_dir, kit_dirs, kit_inline_style_threshold, kit_major, resolve_kit_paths } from "../compiler/kit.js";
|
|
13
|
+
import { load_kit_dirs } from "./kit-dirs.js";
|
|
14
|
+
import { write_module_map } from "./module-map.js";
|
|
15
|
+
import { fill_profiler_maps } from "./profiler-maps.js";
|
|
16
|
+
import { DEFAULT_REGION_TTL_SEC } from "../server/endpoint.js";
|
|
17
|
+
import { RENEW_WINDOW_SEC } from "../server/shared-cache.js";
|
|
18
|
+
import { derive_id_salt, secret_has_min_entropy } from "../server/hmac.js";
|
|
19
|
+
import { buildFoucCssModuleSource, collectFoucCssReachable, compileFoucScopedCss, foucRelFromId, isFoucCssId, isFoucScopedId } from "../compiler/fouc-css.js";
|
|
20
|
+
import { preprocess_component_for_css } from "./style-preprocess.js";
|
|
21
|
+
import { needs_csr_false_full_reload, needs_island_entry_full_reload } from "../compiler/dev/hmr.js";
|
|
22
|
+
import { derive_css_scope_owners } from "../compiler/dev/css-scope.js";
|
|
23
|
+
import { island_subgraph_bytes } from "../compiler/dev/region-bytes.js";
|
|
24
|
+
import { collectIslandDepModulepreloads, collect_inline_css, remote_hash_of, summarize_chunk_contents } from "../compiler/link/island-deps.js";
|
|
25
|
+
import { emit_island_deps_handoff, report_seed_shaping, warn_content_leaks } from "../compiler/link/build-output.js";
|
|
26
|
+
import { follow_pending_page_calls } from "../compiler/link/page-keys.js";
|
|
27
|
+
import { parse_ssr_hosts, ssr_hosts_handoff_path } from "../compiler/link/emit-gate.js";
|
|
28
|
+
import { router_css_key } from "../compiler/link/router-css.js";
|
|
29
|
+
import { Program, strip_id } from "../compiler/program.js";
|
|
30
|
+
import { Compiler } from "../compiler/driver.js";
|
|
31
|
+
import { CompileCtx } from "../compiler/ctx.js";
|
|
32
|
+
import { discover_package_files } from "./package-files.js";
|
|
33
|
+
import { async_twin_redirect, svelte_async_enabled } from "./late-island.js";
|
|
34
|
+
import { flags_manifest } from "../compiler/flags.js";
|
|
35
|
+
import { RESOLVED, V_ROUTER_CSS, V_ROUTE_CONFIG, V_ROUTE_CSR, V_SERVER_ISLANDS, V_SERVER_MANIFEST } from "../compiler/ids.js";
|
|
36
|
+
import { OWN_PACKAGE_NAMES, is_own_specifier } from "../own-package.js";
|
|
37
|
+
import { APP_SHIMS, CLIENT_BINDING_STUB_FILE, HMAC_MODULE, KIT_REMOTE_CLIENT, KIT_REMOTE_STATE, OGYGIA_INJECTED_FILES, OGYGIA_INJECTED_IMPORTS, OGYGIA_REGION_MODULES, PKG_ROOT, PKG_ROOT_ID, REGION_ENDPOINT_MODULE, RUNTIME_DIR, RUNTIME_HASH, STUB_CLIENT, STUB_PATHS, STUB_STATE, real_posix, scan_entry_pattern } from "./paths.js";
|
|
38
|
+
import crypto from "node:crypto";
|
|
39
|
+
import fs from "node:fs";
|
|
40
|
+
import path from "node:path";
|
|
41
|
+
import { isMainThread } from "node:worker_threads";
|
|
42
|
+
import { loadEnv } from "vite";
|
|
43
|
+
// src/vite/index.ts
|
|
44
|
+
const KIT_CLIENT_APP_RE = /\/generated\/(?:build\/|dev\/)?client(-optimized)?\/app\.js$/;
|
|
45
|
+
const ROUTE_HOST_OR_OPTION_RE = /[\\/]\+(page|layout)(\.server)?\.(svelte|js|ts)$/;
|
|
46
|
+
const KIT_PAGE_THREAD = "\nimport { page as __og_kit_page, navigating as __og_kit_nav } from '$app/state';\nimport * as __og_kit_navigation from '$app/navigation';\nglobalThis[Symbol.for('ogygia.kit-page')] = { page: __og_kit_page, navigating: __og_kit_nav, navigation: __og_kit_navigation };\n";
|
|
47
|
+
/** css-ish file the dev bridge manages (mirrors the bridge's glob). */
|
|
48
|
+
const DEV_CSS_FILE_RE = /\.(css|scss|sass|less|styl)$/;
|
|
49
|
+
const CSS_EXT_RE = /\.css$/;
|
|
50
|
+
const STYLE_BEARING_FILE_RE = /\.(svelte|css|scss|sass|less|styl)$/;
|
|
51
|
+
/** The bundler's resolver as the CSS walk's (compiler/fouc-css.ts `collectFoucCssReachable`): what
|
|
52
|
+
* the build resolves, the walk reaches — a package's `exports`, a workspace link, an alias. */
|
|
53
|
+
function bundler_resolve(ctx) {
|
|
54
|
+
return async (spec, importer) => {
|
|
55
|
+
try {
|
|
56
|
+
const r = await ctx.resolve(spec, importer, { skipSelf: true });
|
|
57
|
+
return r && !r.external ? r.id : null;
|
|
58
|
+
} catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Vite plugin: transforms `with { hydrate | defer | preset }` imports into islands,
|
|
65
|
+
* serves virtual island modules, and wires signed region endpoints for deferred HTML.
|
|
66
|
+
*
|
|
67
|
+
* Place **before** `sveltekit()` in `vite.config`.
|
|
68
|
+
*
|
|
69
|
+
* @param options - Plugin configuration. See {@link OgygiaOptions}.
|
|
70
|
+
* @returns Vite plugins (`ogygia` pre + island sourcemap fix post). Vite flattens the array.
|
|
71
|
+
*/
|
|
72
|
+
function ogygia(options = {}) {
|
|
73
|
+
const standalone = options.standalone === true;
|
|
74
|
+
assert_no_legacy_options(options);
|
|
75
|
+
const visibleMargin = options.visible?.margin;
|
|
76
|
+
const presets = options.presets || {};
|
|
77
|
+
validate_region_presets(presets);
|
|
78
|
+
let app_plugins = [];
|
|
79
|
+
let server_plugins = [];
|
|
80
|
+
let client_plugins = [];
|
|
81
|
+
let route_config = [];
|
|
82
|
+
let foreign_hydrate = false;
|
|
83
|
+
let macros = [];
|
|
84
|
+
let markup = [];
|
|
85
|
+
const import_keys = normalize_import_keys(options.importKeys);
|
|
86
|
+
let measure = false;
|
|
87
|
+
const pkg_scan = [];
|
|
88
|
+
/** the roots of plugins' own pages (`b.files()`), as module-id prefixes */
|
|
89
|
+
const plugin_file_roots = [];
|
|
90
|
+
let declared_scanned = false;
|
|
91
|
+
let page_importers = [];
|
|
92
|
+
let page_files = [];
|
|
93
|
+
const { rate_limit, session_cookie, region_ttl, renew_window, router_enabled, router_view_transitions, continuity_forms, server_delta } = resolve_options(options, DEFAULT_REGION_TTL_SEC, RENEW_WINDOW_SEC);
|
|
94
|
+
let devtools_effective = false;
|
|
95
|
+
let devtools_lazy = false;
|
|
96
|
+
const program = new Program({
|
|
97
|
+
forms: continuity_forms,
|
|
98
|
+
router: router_enabled
|
|
99
|
+
});
|
|
100
|
+
const { registry } = program;
|
|
101
|
+
const build_secret = crypto.randomBytes(32).toString("hex");
|
|
102
|
+
/** Salt for region ids — HKDF from stable env only (never per-build random, or SSR/client
|
|
103
|
+
* builds would disagree). Empty when unset (dev + default per-build signing). */
|
|
104
|
+
let id_salt = "";
|
|
105
|
+
/** content_css_key → emitted CSS asset referenceId (client leg). Resolved to hrefs in writeBundle. */
|
|
106
|
+
const content_css_refs = /* @__PURE__ */ new Map();
|
|
107
|
+
/** router-css `rcss:<rel>` key → emitted CSS asset referenceId (client leg). A server router page
|
|
108
|
+
* component's whole-tree scoped CSS, compiled + emitted as a dedicated asset (link/router-css.ts). */
|
|
109
|
+
const router_css_refs = /* @__PURE__ */ new Map();
|
|
110
|
+
/** server-island id → emitted tree-CSS asset referenceId (client leg). Resolved in writeBundle. */
|
|
111
|
+
const hole_css_refs = /* @__PURE__ */ new Map();
|
|
112
|
+
let root;
|
|
113
|
+
let base = "";
|
|
114
|
+
/** SvelteKit `config.kit.appDir` (default `_app`) — read from Kit's `__SVELTEKIT_APP_DIR__` define. */
|
|
115
|
+
let app_dir = "_app";
|
|
116
|
+
let libDir;
|
|
117
|
+
let is_dev = false;
|
|
118
|
+
/** the app compiles with Svelte's async mode (vite-plugin-svelte's resolved options): Region
|
|
119
|
+
* imports the awaiting LateIsland (late-island.ts) */
|
|
120
|
+
let svelte_async = false;
|
|
121
|
+
/** Resolved `resolve.alias` entries — passed to bake()'s rolldown eval so `$lib` etc. resolve. */
|
|
122
|
+
let resolve_alias = [];
|
|
123
|
+
let is_build = false;
|
|
124
|
+
let is_ssr = false;
|
|
125
|
+
/** The leg a build hook runs in: the hook's ENVIRONMENT — Vite's environment API builds `ssr` and
|
|
126
|
+
* `client` in one app build (Kit 3), where `config.build.ssr` is false for both, so the client's
|
|
127
|
+
* work (the runtime chunk, the islands, their names) ran in the server leg too and landed in the
|
|
128
|
+
* server output — every island 404'd. Else the build's own flag (one build per leg). The last
|
|
129
|
+
* environment `buildStart` saw stands in for a hook the bundler calls without one. */
|
|
130
|
+
let last_leg_server = null;
|
|
131
|
+
const server_leg_of = (ctx) => {
|
|
132
|
+
const env = ctx?.environment;
|
|
133
|
+
if (env) return env.name === "ssr" || env.config?.consumer === "server";
|
|
134
|
+
return last_leg_server ?? is_ssr;
|
|
135
|
+
};
|
|
136
|
+
let content_scanned = false;
|
|
137
|
+
/** the server build's output, waiting for closeBundle to fill the profiler's maps module */
|
|
138
|
+
let maps_pending = null;
|
|
139
|
+
let vite_server = null;
|
|
140
|
+
/** absolute path to Kit's internal wire-protocol module (deep import) */
|
|
141
|
+
let kit_wire_path = null;
|
|
142
|
+
/** absolute path to Kit's client remote-functions entry (Plan A reuse) */
|
|
143
|
+
let kit_remote_index = null;
|
|
144
|
+
/** absolute path to the app's universal hooks (for `transport`), if present */
|
|
145
|
+
let universal_hooks = null;
|
|
146
|
+
/** absolute path to the app's client hooks (src/hooks.client.*), if present — its `init` runs on
|
|
147
|
+
* boot for csr=false pages (Kit never runs it there). */
|
|
148
|
+
let client_hooks = null;
|
|
149
|
+
/** absolute path to Kit 3's client codec module (`#app/internal/transport`); null on Kit 2 */
|
|
150
|
+
let kit_transport_init = null;
|
|
151
|
+
/** true once the process-exit cleanup for the injected keep-client route is registered */
|
|
152
|
+
let keep_client_cleanup_armed = false;
|
|
153
|
+
const readFile = (abs) => {
|
|
154
|
+
try {
|
|
155
|
+
return fs.readFileSync(abs, "utf-8");
|
|
156
|
+
} catch {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const __prof = {
|
|
161
|
+
transformMs: 0,
|
|
162
|
+
transformN: 0,
|
|
163
|
+
transformHit: 0,
|
|
164
|
+
prescanMs: 0,
|
|
165
|
+
bakeMs: 0,
|
|
166
|
+
bakeN: 0,
|
|
167
|
+
resolveMs: 0,
|
|
168
|
+
loadMs: 0
|
|
169
|
+
};
|
|
170
|
+
const __P = !!process.env.OGYGIA_PROFILE;
|
|
171
|
+
const __outHash = /* @__PURE__ */ new Map();
|
|
172
|
+
const compiler = new Compiler(program, {
|
|
173
|
+
prof: __prof,
|
|
174
|
+
P: __P,
|
|
175
|
+
outHash: __outHash
|
|
176
|
+
});
|
|
177
|
+
/** Register the one-time process-exit cleanup (main thread only). */
|
|
178
|
+
const arm_keep_client_cleanup = (r) => {
|
|
179
|
+
if (keep_client_cleanup_armed) return;
|
|
180
|
+
keep_client_cleanup_armed = true;
|
|
181
|
+
process.on("exit", () => {
|
|
182
|
+
try {
|
|
183
|
+
fs.rmSync(keep_client_dir(r), {
|
|
184
|
+
recursive: true,
|
|
185
|
+
force: true
|
|
186
|
+
});
|
|
187
|
+
} catch {}
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
const invalidate_module_id = (server, id) => {
|
|
191
|
+
const mod = server.moduleGraph.getModuleById(id);
|
|
192
|
+
if (mod) server.moduleGraph.invalidateModule(mod);
|
|
193
|
+
};
|
|
194
|
+
const invalidate_islands_for_file = (file, { deleted = false, server = vite_server } = {}) => {
|
|
195
|
+
if (!server) return false;
|
|
196
|
+
return compiler.invalidate_for_file(file, {
|
|
197
|
+
deleted,
|
|
198
|
+
invalidate: (id) => invalidate_module_id(server, id)
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
return [
|
|
202
|
+
...options.barrels ? [debarrel(options.barrels, {
|
|
203
|
+
skip_attribute_keys: Object.values(import_keys),
|
|
204
|
+
skip_locals: asRegionLocals
|
|
205
|
+
})] : [],
|
|
206
|
+
{
|
|
207
|
+
name: "ogygia",
|
|
208
|
+
enforce: "pre",
|
|
209
|
+
config: {
|
|
210
|
+
order: "pre",
|
|
211
|
+
async handler(userConfig, env) {
|
|
212
|
+
await load_kit_dirs(path.resolve(userConfig.root ?? "."), userConfig.plugins);
|
|
213
|
+
app_plugins = standalone ? [] : await find_plugins(userConfig.plugins);
|
|
214
|
+
const resolved = resolve_plugins(app_plugins, path.resolve(userConfig.root ?? "."), env.command === "serve", (source, filename) => compiler.transform_content_island(source, filename));
|
|
215
|
+
({servers: server_plugins, clients: client_plugins, route_config, foreign_hydrate, macros, markup} = resolved);
|
|
216
|
+
measure = resolved.measure;
|
|
217
|
+
devtools_effective = resolved.events !== false;
|
|
218
|
+
devtools_lazy = resolved.events !== false && resolved.events.lazy;
|
|
219
|
+
page_importers = resolved.page_modules.importers;
|
|
220
|
+
page_files = resolved.page_modules.files.map(real_posix);
|
|
221
|
+
for (const p of resolved.files) if (!pkg_scan.some((s) => s.name === p.name)) {
|
|
222
|
+
plugin_file_roots.push(real_posix(p.root) + "/");
|
|
223
|
+
pkg_scan.push({
|
|
224
|
+
name: p.name,
|
|
225
|
+
root: real_posix(p.root),
|
|
226
|
+
dirs: p.dirs.map(real_posix),
|
|
227
|
+
files: p.files.map(real_posix)
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
if (env.command === "build" && !standalone && isMainThread) {
|
|
231
|
+
const r = path.resolve(userConfig.root ?? ".");
|
|
232
|
+
const routes = kit_dirs(r).routes_dir;
|
|
233
|
+
if (clientBuildWillSkip(routes)) {
|
|
234
|
+
inject_keep_client_route(r);
|
|
235
|
+
arm_keep_client_cleanup(r);
|
|
236
|
+
} else fs.rmSync(keep_client_dir(r), {
|
|
237
|
+
recursive: true,
|
|
238
|
+
force: true
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
if (!standalone && !declared_scanned) {
|
|
242
|
+
declared_scanned = true;
|
|
243
|
+
for (const p of discover_package_files(path.resolve(userConfig.root ?? "."))) if (!pkg_scan.some((s) => s.name === p.name)) pkg_scan.push(p);
|
|
244
|
+
}
|
|
245
|
+
const declared_pkg_names = [.../* @__PURE__ */ new Set([...pkg_scan.map((p) => p.name), ...app_plugins.map((p) => p.name)])];
|
|
246
|
+
const dev_island_deps = env.command === "serve" ? [
|
|
247
|
+
"svelte",
|
|
248
|
+
"svelte/internal/client",
|
|
249
|
+
"svelte/server",
|
|
250
|
+
"ogygia > @ogygia/core > devalue"
|
|
251
|
+
] : [];
|
|
252
|
+
return {
|
|
253
|
+
resolve: { dedupe: ["@sveltejs/kit"] },
|
|
254
|
+
ssr: { noExternal: [
|
|
255
|
+
"esm-env",
|
|
256
|
+
...OWN_PACKAGE_NAMES,
|
|
257
|
+
...declared_pkg_names
|
|
258
|
+
] },
|
|
259
|
+
optimizeDeps: {
|
|
260
|
+
exclude: [...OWN_PACKAGE_NAMES, ...declared_pkg_names],
|
|
261
|
+
include: dev_island_deps
|
|
262
|
+
},
|
|
263
|
+
define: {
|
|
264
|
+
__OGYGIA_CONTINUITY_FORMS__: JSON.stringify(continuity_forms),
|
|
265
|
+
__OGYGIA_SERVER_DELTA__: JSON.stringify(server_delta),
|
|
266
|
+
__OGYGIA_DEVTOOLS__: JSON.stringify(devtools_effective),
|
|
267
|
+
__OGYGIA_DEVTOOLS_LAZY__: JSON.stringify(devtools_lazy),
|
|
268
|
+
__OGYGIA_BEACON__: JSON.stringify(measure || devtools_effective),
|
|
269
|
+
__OGYGIA_CLIENT_PLUGINS__: JSON.stringify(client_plugins.length > 0),
|
|
270
|
+
__OGYGIA_KIT_MAJOR__: JSON.stringify(kit_major(path.resolve(userConfig.root ?? ".")))
|
|
271
|
+
},
|
|
272
|
+
server: { fs: { allow: [PKG_ROOT] } },
|
|
273
|
+
build: { rolldownOptions: { preserveEntrySignatures: "exports-only" } }
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
configResolved(config) {
|
|
278
|
+
root = config.root;
|
|
279
|
+
base = config.base || "";
|
|
280
|
+
svelte_async = svelte_async_enabled(config.plugins);
|
|
281
|
+
if (config.command === "serve") {
|
|
282
|
+
const own = (config.optimizeDeps?.include ?? []).filter((d) => is_own_specifier(d));
|
|
283
|
+
if (own.length) config.logger.warn(`[ogygia] optimizeDeps.include lists ${own.join(", ")}: ogygia must not be pre-bundled in dev (the page would run two copies of its runtime, and islands with snippet props fail to hydrate). Remove ${own.length === 1 ? "it" : "them"}.`);
|
|
284
|
+
}
|
|
285
|
+
const app_dir_define = config.define?.["__SVELTEKIT_APP_DIR__"];
|
|
286
|
+
if (typeof app_dir_define === "string") try {
|
|
287
|
+
const v = JSON.parse(app_dir_define);
|
|
288
|
+
if (typeof v === "string" && v) app_dir = v;
|
|
289
|
+
} catch {}
|
|
290
|
+
const ra = config.resolve?.alias ?? [];
|
|
291
|
+
resolve_alias = Array.isArray(ra) ? ra.map((a) => ({
|
|
292
|
+
find: a.find,
|
|
293
|
+
replacement: a.replacement
|
|
294
|
+
})) : Object.entries(ra).map(([find, replacement]) => ({
|
|
295
|
+
find,
|
|
296
|
+
replacement
|
|
297
|
+
}));
|
|
298
|
+
configure_build_cache(root);
|
|
299
|
+
libDir = path.join(root, "src", "lib");
|
|
300
|
+
is_dev = config.command === "serve";
|
|
301
|
+
is_build = config.command === "build";
|
|
302
|
+
is_ssr = !!config.build?.ssr;
|
|
303
|
+
if (is_dev) fs.rmSync(keep_client_dir(root), {
|
|
304
|
+
recursive: true,
|
|
305
|
+
force: true
|
|
306
|
+
});
|
|
307
|
+
if (!process.env.OGYGIA_SECRET?.trim()) {
|
|
308
|
+
const env_dir = config.envDir === false ? false : config.envDir ? path.resolve(root, config.envDir) : root;
|
|
309
|
+
if (env_dir !== false) {
|
|
310
|
+
const from_file = loadEnv(config.mode, env_dir, "").OGYGIA_SECRET?.trim();
|
|
311
|
+
if (from_file) process.env.OGYGIA_SECRET = from_file;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const env_secret = process.env.OGYGIA_SECRET?.trim() || "";
|
|
315
|
+
if (env_secret) {
|
|
316
|
+
if (is_build && !secret_has_min_entropy(env_secret)) throw new Error(`[ogygia] OGYGIA_SECRET is too short for production builds (need ≥16 UTF-8 bytes).`);
|
|
317
|
+
id_salt = derive_id_salt(env_secret);
|
|
318
|
+
} else id_salt = "";
|
|
319
|
+
({kit_wire_path, kit_remote_index, universal_hooks, client_hooks, kit_transport_init} = resolve_kit_paths(root));
|
|
320
|
+
compiler.configure(new CompileCtx({
|
|
321
|
+
root,
|
|
322
|
+
base,
|
|
323
|
+
app_dir,
|
|
324
|
+
libDir,
|
|
325
|
+
pkg_scan,
|
|
326
|
+
page_importers,
|
|
327
|
+
page_files,
|
|
328
|
+
measure,
|
|
329
|
+
server_plugins,
|
|
330
|
+
client_plugins,
|
|
331
|
+
route_config,
|
|
332
|
+
foreign_hydrate,
|
|
333
|
+
is_dev,
|
|
334
|
+
id_salt,
|
|
335
|
+
visibleMargin,
|
|
336
|
+
presets,
|
|
337
|
+
import_keys,
|
|
338
|
+
resolve_alias,
|
|
339
|
+
macros,
|
|
340
|
+
pkg_root: PKG_ROOT_ID,
|
|
341
|
+
build_secret,
|
|
342
|
+
rate_limit,
|
|
343
|
+
session_cookie,
|
|
344
|
+
region_ttl,
|
|
345
|
+
renew_window,
|
|
346
|
+
router_enabled,
|
|
347
|
+
router_view_transitions,
|
|
348
|
+
client_hooks,
|
|
349
|
+
runtime_dir: RUNTIME_DIR,
|
|
350
|
+
runtime_hash: RUNTIME_HASH,
|
|
351
|
+
hmac_module: HMAC_MODULE,
|
|
352
|
+
region_endpoint_module: REGION_ENDPOINT_MODULE,
|
|
353
|
+
client_binding_stub_file: CLIENT_BINDING_STUB_FILE,
|
|
354
|
+
app_shims: APP_SHIMS,
|
|
355
|
+
is_build,
|
|
356
|
+
devtools: devtools_effective
|
|
357
|
+
}));
|
|
358
|
+
if (is_dev) {
|
|
359
|
+
compiler.prescan();
|
|
360
|
+
const opt = config.optimizeDeps ??= {};
|
|
361
|
+
const entries = Array.isArray(opt.entries) ? opt.entries : opt.entries ? [opt.entries] : [];
|
|
362
|
+
opt.entries = entries;
|
|
363
|
+
const have = new Set(entries);
|
|
364
|
+
for (const abs of compiler.island_scan_entries()) {
|
|
365
|
+
const posix = real_posix(abs);
|
|
366
|
+
const pattern = plugin_file_roots.some((r) => posix.startsWith(r)) ? null : scan_entry_pattern(abs);
|
|
367
|
+
if (pattern !== null && !have.has(pattern)) {
|
|
368
|
+
have.add(pattern);
|
|
369
|
+
entries.push(pattern);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
async buildStart() {
|
|
375
|
+
const server_leg = server_leg_of(this);
|
|
376
|
+
last_leg_server = server_leg;
|
|
377
|
+
if (is_build && server_leg) fs.rmSync(ssr_hosts_handoff_path(kit_dirs(root).out_dir), { force: true });
|
|
378
|
+
if (!content_scanned) {
|
|
379
|
+
content_scanned = true;
|
|
380
|
+
compiler.prescan();
|
|
381
|
+
for (const source of markup) await source.scan?.({
|
|
382
|
+
root,
|
|
383
|
+
readFile
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
if (is_build && !server_leg) {
|
|
387
|
+
const emit_runtime = !standalone && (hasAnyCsrFalseRoute(kit_dirs(root).routes_dir) || compiler.has_hydrate_regions());
|
|
388
|
+
let loaded = null;
|
|
389
|
+
try {
|
|
390
|
+
loaded = parse_ssr_hosts(fs.readFileSync(ssr_hosts_handoff_path(kit_dirs(root).out_dir), "utf8"));
|
|
391
|
+
} catch {}
|
|
392
|
+
const skipped = compiler.emit_build_chunks((chunk) => this.emitFile(chunk), {
|
|
393
|
+
emitRuntime: emit_runtime,
|
|
394
|
+
loaded
|
|
395
|
+
});
|
|
396
|
+
if (skipped && isMainThread) console.log(`[ogygia] ${skipped} island chunk(s) not emitted: their host modules are not in the server bundle (unreachable from this build's routes).`);
|
|
397
|
+
router_css_refs.clear();
|
|
398
|
+
const walk_resolve = bundler_resolve(this);
|
|
399
|
+
for (const abs of compiler.router_css_roots()) {
|
|
400
|
+
const parts = [];
|
|
401
|
+
for (const e of await collectFoucCssReachable(abs, {
|
|
402
|
+
root,
|
|
403
|
+
libDir,
|
|
404
|
+
readFile,
|
|
405
|
+
alias: resolve_alias,
|
|
406
|
+
resolve: walk_resolve
|
|
407
|
+
})) if (e.kind === "scoped") {
|
|
408
|
+
const src = readFile(e.abs);
|
|
409
|
+
if (src == null) continue;
|
|
410
|
+
const css = compileFoucScopedCss(e.abs, await preprocess_component_for_css(src, e.abs, root), { keepScript: true });
|
|
411
|
+
if (css) parts.push(css);
|
|
412
|
+
} else if (CSS_EXT_RE.test(e.abs)) {
|
|
413
|
+
const css = readFile(e.abs);
|
|
414
|
+
if (css) parts.push(css);
|
|
415
|
+
}
|
|
416
|
+
if (!parts.length) continue;
|
|
417
|
+
const ref = this.emitFile({
|
|
418
|
+
type: "asset",
|
|
419
|
+
name: "og-rcss.css",
|
|
420
|
+
source: parts.join("\n")
|
|
421
|
+
});
|
|
422
|
+
router_css_refs.set(router_css_key(root, abs), ref);
|
|
423
|
+
}
|
|
424
|
+
hole_css_refs.clear();
|
|
425
|
+
const hole_css_by_abs = /* @__PURE__ */ new Map();
|
|
426
|
+
for (const { iid, abs } of compiler.server_island_css_roots()) {
|
|
427
|
+
let ref = hole_css_by_abs.get(abs);
|
|
428
|
+
if (ref === void 0) {
|
|
429
|
+
const parts = [];
|
|
430
|
+
for (const e of await collectFoucCssReachable(abs, {
|
|
431
|
+
root,
|
|
432
|
+
libDir,
|
|
433
|
+
readFile,
|
|
434
|
+
alias: resolve_alias,
|
|
435
|
+
resolve: walk_resolve
|
|
436
|
+
})) if (e.kind === "scoped") {
|
|
437
|
+
const src = readFile(e.abs);
|
|
438
|
+
if (src == null) continue;
|
|
439
|
+
const css = compileFoucScopedCss(e.abs, await preprocess_component_for_css(src, e.abs, root), { keepScript: true });
|
|
440
|
+
if (css) parts.push(css);
|
|
441
|
+
} else if (CSS_EXT_RE.test(e.abs)) {
|
|
442
|
+
const css = readFile(e.abs);
|
|
443
|
+
if (css) parts.push(css);
|
|
444
|
+
}
|
|
445
|
+
ref = parts.length ? this.emitFile({
|
|
446
|
+
type: "asset",
|
|
447
|
+
name: "og-hole.css",
|
|
448
|
+
source: parts.join("\n")
|
|
449
|
+
}) : "";
|
|
450
|
+
hole_css_by_abs.set(abs, ref);
|
|
451
|
+
}
|
|
452
|
+
if (ref) hole_css_refs.set(iid, ref);
|
|
453
|
+
}
|
|
454
|
+
content_css_refs.clear();
|
|
455
|
+
const styles = markup.flatMap((m) => m.styles ? [...m.styles] : []);
|
|
456
|
+
if (styles.length) {
|
|
457
|
+
const { compile } = await import("svelte/compiler");
|
|
458
|
+
for (const [abs, source] of styles) try {
|
|
459
|
+
const { css } = compile(source, {
|
|
460
|
+
filename: abs,
|
|
461
|
+
css: "external",
|
|
462
|
+
dev: false,
|
|
463
|
+
generate: "client",
|
|
464
|
+
experimental: { async: true }
|
|
465
|
+
});
|
|
466
|
+
if (css?.code) {
|
|
467
|
+
const ref = this.emitFile({
|
|
468
|
+
type: "asset",
|
|
469
|
+
name: "og-content.css",
|
|
470
|
+
source: css.code
|
|
471
|
+
});
|
|
472
|
+
content_css_refs.set(content_css_key(abs), ref);
|
|
473
|
+
}
|
|
474
|
+
} catch {}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
configureServer(server) {
|
|
479
|
+
vite_server = server;
|
|
480
|
+
if (measure) {
|
|
481
|
+
install_dev_maps(server);
|
|
482
|
+
install_dev_client_maps(server);
|
|
483
|
+
install_dev_page_keys(server, (iid) => program.registry.get(program.by_id.get(iid) ?? "")?.componentPath, root);
|
|
484
|
+
}
|
|
485
|
+
if (!devtools_effective) return;
|
|
486
|
+
server.middlewares.use((_req, res, next) => {
|
|
487
|
+
res.setHeader("document-policy", "js-profiling");
|
|
488
|
+
next();
|
|
489
|
+
});
|
|
490
|
+
server.middlewares.use((req, res, next) => {
|
|
491
|
+
if ((req.url || "").split("?")[0] !== "/__ogygia_devtools_meta") return next();
|
|
492
|
+
const client_modules = server.environments?.client?.moduleGraph?.idToModuleMap?.values();
|
|
493
|
+
const sources = /* @__PURE__ */ new Map();
|
|
494
|
+
const read = (file) => {
|
|
495
|
+
if (!sources.has(file)) try {
|
|
496
|
+
sources.set(file, fs.readFileSync(file, "utf8"));
|
|
497
|
+
} catch {
|
|
498
|
+
sources.set(file, void 0);
|
|
499
|
+
}
|
|
500
|
+
return sources.get(file);
|
|
501
|
+
};
|
|
502
|
+
const bytes = client_modules ? island_subgraph_bytes(client_modules, read) : {};
|
|
503
|
+
res.setHeader("content-type", "application/json");
|
|
504
|
+
res.end(JSON.stringify({
|
|
505
|
+
names: compiler.region_names(),
|
|
506
|
+
bytes
|
|
507
|
+
}));
|
|
508
|
+
});
|
|
509
|
+
},
|
|
510
|
+
watchChange(id, change) {
|
|
511
|
+
if (is_dev && ROUTE_HOST_OR_OPTION_RE.test(id)) {
|
|
512
|
+
clear_route_csr_cache();
|
|
513
|
+
if (vite_server) {
|
|
514
|
+
invalidate_module_id(vite_server, RESOLVED(V_ROUTE_CSR));
|
|
515
|
+
invalidate_module_id(vite_server, RESOLVED(V_ROUTE_CONFIG));
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (!is_dev || change.event !== "delete" || !vite_server) return;
|
|
519
|
+
if (!invalidate_islands_for_file(id, {
|
|
520
|
+
deleted: true,
|
|
521
|
+
server: vite_server
|
|
522
|
+
})) return;
|
|
523
|
+
vite_server.ws.send({
|
|
524
|
+
type: "full-reload",
|
|
525
|
+
path: "*"
|
|
526
|
+
});
|
|
527
|
+
},
|
|
528
|
+
buildEnd() {
|
|
529
|
+
const server_leg = server_leg_of(this);
|
|
530
|
+
if (is_build && server_leg && !standalone) try {
|
|
531
|
+
const handoff = ssr_hosts_handoff_path(kit_dirs(root).out_dir);
|
|
532
|
+
fs.mkdirSync(path.dirname(handoff), { recursive: true });
|
|
533
|
+
fs.writeFileSync(handoff, JSON.stringify(compiler.ssr_transformed_hosts()));
|
|
534
|
+
} catch (e) {
|
|
535
|
+
if (isMainThread) console.warn("[ogygia] could not write the server-leg island handoff:", e);
|
|
536
|
+
}
|
|
537
|
+
if (__P) {
|
|
538
|
+
const keys = [...__outHash.keys()].sort();
|
|
539
|
+
let d = 2166136261;
|
|
540
|
+
for (const k of keys) {
|
|
541
|
+
d ^= __outHash.get(k);
|
|
542
|
+
d = Math.imul(d, 16777619) >>> 0;
|
|
543
|
+
}
|
|
544
|
+
console.error("\n[ogygia-prof] " + JSON.stringify({
|
|
545
|
+
...__prof,
|
|
546
|
+
transformDigest: (d >>> 0).toString(16),
|
|
547
|
+
transformFiles: keys.length
|
|
548
|
+
}));
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
handleHotUpdate({ file, server }) {
|
|
552
|
+
if (!is_dev) return;
|
|
553
|
+
vite_server = server;
|
|
554
|
+
if (STYLE_BEARING_FILE_RE.test(file)) {
|
|
555
|
+
const mod = server.moduleGraph.getModuleById("\0" + V_ROUTER_CSS);
|
|
556
|
+
if (mod) server.moduleGraph.invalidateModule(mod);
|
|
557
|
+
}
|
|
558
|
+
if (DEV_CSS_FILE_RE.test(file) && !file.includes("/node_modules/")) {
|
|
559
|
+
const src_prefix = path.join(root, "src") + path.sep;
|
|
560
|
+
if (path.normalize(file).startsWith(src_prefix)) {
|
|
561
|
+
const envs = server.environments;
|
|
562
|
+
const client_graph = envs?.client?.moduleGraph;
|
|
563
|
+
if (!(client_graph?.getModulesByFile?.(file)?.size ?? 0)) {
|
|
564
|
+
const owners = derive_css_scope_owners(file, root, [envs?.ssr?.moduleGraph, client_graph]);
|
|
565
|
+
const web_path = "/" + path.relative(root, file).split(path.sep).join("/");
|
|
566
|
+
server.ws.send({
|
|
567
|
+
type: "custom",
|
|
568
|
+
event: "ogygia:css",
|
|
569
|
+
data: {
|
|
570
|
+
path: web_path,
|
|
571
|
+
owners
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
return [];
|
|
575
|
+
}
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
const deleted = !fs.existsSync(strip_id(file));
|
|
580
|
+
const host_changed = !deleted && compiler.is_registered_host(file);
|
|
581
|
+
const entry_changed = !deleted && needs_island_entry_full_reload(file, registry.values());
|
|
582
|
+
if (host_changed || deleted) invalidate_islands_for_file(file, {
|
|
583
|
+
deleted,
|
|
584
|
+
server
|
|
585
|
+
});
|
|
586
|
+
if (!needs_csr_false_full_reload(file) && !deleted && !host_changed && !entry_changed) return;
|
|
587
|
+
server.ws.send({
|
|
588
|
+
type: "full-reload",
|
|
589
|
+
path: "*"
|
|
590
|
+
});
|
|
591
|
+
return [];
|
|
592
|
+
},
|
|
593
|
+
async resolveId(source, importer, options) {
|
|
594
|
+
if (source === "virtual:ogygia/kit-wire" && kit_wire_path) return kit_wire_path;
|
|
595
|
+
if (OGYGIA_INJECTED_IMPORTS.has(source)) return OGYGIA_INJECTED_FILES[source];
|
|
596
|
+
if (svelte_async) {
|
|
597
|
+
const awaiting = async_twin_redirect(source, importer, OGYGIA_REGION_MODULES);
|
|
598
|
+
if (awaiting) return awaiting;
|
|
599
|
+
}
|
|
600
|
+
const ssr = options?.ssr === true;
|
|
601
|
+
if (!ssr && source === "__sveltekit/remote") {
|
|
602
|
+
if (!kit_remote_index) throw new Error("[ogygia] could not locate Kit's client remote-functions (src). Use an @sveltejs/kit that publishes its `src/` (2.70.2 or later, or 3.x).");
|
|
603
|
+
return kit_remote_index;
|
|
604
|
+
}
|
|
605
|
+
if (!ssr && importer && importer.includes("/remote-functions/")) {
|
|
606
|
+
if (KIT_REMOTE_CLIENT.test(source)) return STUB_CLIENT;
|
|
607
|
+
if (KIT_REMOTE_STATE.test(source)) return STUB_STATE;
|
|
608
|
+
if (source === "#app/paths") return STUB_PATHS;
|
|
609
|
+
if (source === "#app/state/client") return STUB_STATE;
|
|
610
|
+
}
|
|
611
|
+
if (!ssr && source === "$app/paths/internal/client") return STUB_PATHS;
|
|
612
|
+
return compiler.resolve_id(source, importer, {
|
|
613
|
+
ssr,
|
|
614
|
+
resolve: (s, i, o) => this.resolve(s, i, o)
|
|
615
|
+
});
|
|
616
|
+
},
|
|
617
|
+
async load(id, options) {
|
|
618
|
+
const ssr = options?.ssr === true;
|
|
619
|
+
const fouc_bare = id.startsWith("\0") ? id.slice(1) : id;
|
|
620
|
+
if (isFoucCssId(fouc_bare)) {
|
|
621
|
+
const rel = foucRelFromId(fouc_bare);
|
|
622
|
+
if (!rel) return {
|
|
623
|
+
code: "export {}",
|
|
624
|
+
moduleSideEffects: false
|
|
625
|
+
};
|
|
626
|
+
const abs = path.join(root, rel);
|
|
627
|
+
return {
|
|
628
|
+
code: await buildFoucCssModuleSource(abs, {
|
|
629
|
+
root,
|
|
630
|
+
libDir,
|
|
631
|
+
readFile: (p) => {
|
|
632
|
+
try {
|
|
633
|
+
return fs.readFileSync(p, "utf8");
|
|
634
|
+
} catch {
|
|
635
|
+
return null;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}),
|
|
639
|
+
moduleSideEffects: true
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
if (isFoucScopedId(fouc_bare)) {
|
|
643
|
+
const rel = foucRelFromId(fouc_bare);
|
|
644
|
+
if (!rel) return {
|
|
645
|
+
code: "",
|
|
646
|
+
moduleType: "css"
|
|
647
|
+
};
|
|
648
|
+
const abs = path.join(root, rel);
|
|
649
|
+
let source = "";
|
|
650
|
+
try {
|
|
651
|
+
source = fs.readFileSync(abs, "utf8");
|
|
652
|
+
} catch {
|
|
653
|
+
return {
|
|
654
|
+
code: "",
|
|
655
|
+
moduleType: "css"
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
return {
|
|
659
|
+
code: compileFoucScopedCss(abs, await preprocess_component_for_css(source, abs, root), { keepScript: true }),
|
|
660
|
+
moduleType: "css"
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
return compiler.emit(id, {
|
|
664
|
+
ssr,
|
|
665
|
+
universalHooks: universal_hooks,
|
|
666
|
+
resolve: bundler_resolve(this),
|
|
667
|
+
kitCodec: kit_transport_init
|
|
668
|
+
});
|
|
669
|
+
},
|
|
670
|
+
async transform(code, id, options) {
|
|
671
|
+
let source = code;
|
|
672
|
+
if (!options?.ssr && KIT_CLIENT_APP_RE.test(id)) source += KIT_PAGE_THREAD;
|
|
673
|
+
const result = await compiler.transform_module(source, id, {
|
|
674
|
+
ssr: options?.ssr === true,
|
|
675
|
+
emitFile: (chunk) => this.emitFile(chunk)
|
|
676
|
+
});
|
|
677
|
+
if (is_dev && vite_server && compiler.server_manifest_stale()) {
|
|
678
|
+
invalidate_module_id(vite_server, RESOLVED(V_SERVER_MANIFEST));
|
|
679
|
+
invalidate_module_id(vite_server, RESOLVED(V_SERVER_ISLANDS));
|
|
680
|
+
}
|
|
681
|
+
if (is_dev && vite_server) for (const marked of compiler.drain_closure_marks()) invalidate_module_id(vite_server, marked);
|
|
682
|
+
if (result) return result;
|
|
683
|
+
return source === code ? null : {
|
|
684
|
+
code: source,
|
|
685
|
+
map: null
|
|
686
|
+
};
|
|
687
|
+
},
|
|
688
|
+
renderChunk(code) {
|
|
689
|
+
const fn = compiler.patch_fn_manifest(code);
|
|
690
|
+
if (!server_leg_of(this)) return fn;
|
|
691
|
+
return compiler.patch_page_data_reads(fn?.code ?? code, (id) => this.getModuleInfo(id), () => this.getModuleIds()) ?? fn;
|
|
692
|
+
},
|
|
693
|
+
outputOptions(output) {
|
|
694
|
+
if (!is_build || server_leg_of(this)) return null;
|
|
695
|
+
const ours = (fallback, dflt) => (info) => compiler.entry_file_pattern(info.name) ?? (typeof fallback === "function" ? fallback(info) : fallback ?? dflt);
|
|
696
|
+
return {
|
|
697
|
+
...output,
|
|
698
|
+
entryFileNames: ours(output.entryFileNames, "[name].js"),
|
|
699
|
+
chunkFileNames: ours(output.chunkFileNames, "[name]-[hash].js")
|
|
700
|
+
};
|
|
701
|
+
},
|
|
702
|
+
generateBundle() {
|
|
703
|
+
if (!is_build || server_leg_of(this)) return;
|
|
704
|
+
for (const shim of compiler.entry_shims((ref) => this.getFileName(ref))) this.emitFile({
|
|
705
|
+
type: "asset",
|
|
706
|
+
fileName: shim.fileName,
|
|
707
|
+
source: shim.source
|
|
708
|
+
});
|
|
709
|
+
},
|
|
710
|
+
closeBundle: {
|
|
711
|
+
order: "pre",
|
|
712
|
+
sequential: true,
|
|
713
|
+
handler() {
|
|
714
|
+
if (!maps_pending) return;
|
|
715
|
+
const { dir, bundle } = maps_pending;
|
|
716
|
+
maps_pending = null;
|
|
717
|
+
try {
|
|
718
|
+
fill_profiler_maps(dir, bundle, root);
|
|
719
|
+
} catch {}
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
async writeBundle(_options, bundle) {
|
|
723
|
+
const server_leg = server_leg_of(this);
|
|
724
|
+
if (is_build && server_leg && measure && _options.dir) {
|
|
725
|
+
try {
|
|
726
|
+
write_module_map(_options.dir, bundle, root);
|
|
727
|
+
} catch {}
|
|
728
|
+
maps_pending = {
|
|
729
|
+
dir: _options.dir,
|
|
730
|
+
bundle
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
if (!is_build || server_leg) return;
|
|
734
|
+
warn_content_leaks(bundle, root, is_island_path);
|
|
735
|
+
if (program.flag_sites.length && isMainThread) try {
|
|
736
|
+
const dir = path.join(root, "node_modules", ".ogygia");
|
|
737
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
738
|
+
const manifest = flags_manifest(program.flag_sites);
|
|
739
|
+
fs.writeFileSync(path.join(dir, "flags-manifest.json"), JSON.stringify(manifest, null, " ") + "\n");
|
|
740
|
+
console.log(`[ogygia] flags manifest: ${manifest.names.length} flag(s) → node_modules/.ogygia/flags-manifest.json`);
|
|
741
|
+
} catch {}
|
|
742
|
+
await follow_pending_page_calls(program, (s, importer) => this.resolve(s, importer));
|
|
743
|
+
const remote_hash = (id) => remote_hash_of(id, process.cwd());
|
|
744
|
+
const entries = compiler.entry_locations((ref) => this.getFileName(ref));
|
|
745
|
+
const map = collectIslandDepModulepreloads(bundle, [APP_SHIMS["$app/state"], APP_SHIMS["$app/stores"]], remote_hash, (module_id) => program.page_keys.get(module_id) ?? null, (id) => {
|
|
746
|
+
try {
|
|
747
|
+
return fs.readFileSync(id, "utf8");
|
|
748
|
+
} catch {
|
|
749
|
+
return null;
|
|
750
|
+
}
|
|
751
|
+
}, entries.runtime_file, {
|
|
752
|
+
islands: entries.islands,
|
|
753
|
+
runtime: entries.runtime
|
|
754
|
+
});
|
|
755
|
+
const page_why = report_seed_shaping(map, bundle, program, root, (identity) => entries.locations[identity] ?? identity);
|
|
756
|
+
for (const [key, ref] of router_css_refs) try {
|
|
757
|
+
const file = this.getFileName(ref);
|
|
758
|
+
map.css[key] = [file.startsWith("/") ? file : "/" + file];
|
|
759
|
+
} catch {}
|
|
760
|
+
for (const [iid, ref] of hole_css_refs) try {
|
|
761
|
+
const file = this.getFileName(ref);
|
|
762
|
+
const key = compiler.island_public_url(iid);
|
|
763
|
+
(map.css[key] ??= []).push(file.startsWith("/") ? file : "/" + file);
|
|
764
|
+
} catch {}
|
|
765
|
+
const content_css = {};
|
|
766
|
+
for (const [key, ref] of content_css_refs) try {
|
|
767
|
+
const file = this.getFileName(ref);
|
|
768
|
+
content_css[key] = [file.startsWith("/") ? file : "/" + file];
|
|
769
|
+
} catch {}
|
|
770
|
+
const css_inline = collect_inline_css(bundle, [...Object.values(map.css).flat(), ...Object.values(content_css).flat()], kit_inline_style_threshold(root));
|
|
771
|
+
if (!measure) {
|
|
772
|
+
map.contents = {};
|
|
773
|
+
map.heavy = {};
|
|
774
|
+
map.hazards = {};
|
|
775
|
+
map.dupes = [];
|
|
776
|
+
}
|
|
777
|
+
const barrels = {};
|
|
778
|
+
if (measure) for (const [key, chunk] of Object.entries(bundle)) {
|
|
779
|
+
if (chunk.type !== "chunk") continue;
|
|
780
|
+
const found = [];
|
|
781
|
+
for (const id of chunk.moduleIds ?? []) {
|
|
782
|
+
if (id.startsWith("\0")) continue;
|
|
783
|
+
const q = id.indexOf("?");
|
|
784
|
+
if ((q === -1 ? id : id.slice(0, q)).endsWith(".svelte")) continue;
|
|
785
|
+
const info = this.getModuleInfo(id);
|
|
786
|
+
if (!info) continue;
|
|
787
|
+
const fanout = info.importedIds.filter((d) => !d.startsWith("\0")).length;
|
|
788
|
+
const own = info.code?.length ?? Infinity;
|
|
789
|
+
if (fanout >= 6 && own <= fanout * 160) {
|
|
790
|
+
const name = summarize_chunk_contents([id], 1, 1)[0];
|
|
791
|
+
if (name) found.push({
|
|
792
|
+
name,
|
|
793
|
+
fanout
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
if (found.length) barrels["/" + (chunk.fileName || key)] = found.sort((a, b) => b.fanout - a.fanout).slice(0, 3);
|
|
798
|
+
}
|
|
799
|
+
const json = JSON.stringify({
|
|
800
|
+
...map,
|
|
801
|
+
...measure ? {
|
|
802
|
+
page_why,
|
|
803
|
+
barrels
|
|
804
|
+
} : {},
|
|
805
|
+
content_css,
|
|
806
|
+
css_inline,
|
|
807
|
+
fn_manifest: Object.fromEntries(compiler.dollar_hoists),
|
|
808
|
+
entries: entries.locations
|
|
809
|
+
});
|
|
810
|
+
emit_island_deps_handoff(root, json, kit_dirs(root).out_dir);
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
island_sourcemaps_plugin({
|
|
814
|
+
program,
|
|
815
|
+
is_island_path
|
|
816
|
+
}),
|
|
817
|
+
server_sourcemaps_plugin(() => measure)
|
|
818
|
+
];
|
|
819
|
+
}
|
|
820
|
+
export { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, debarrel, definePlugin, import_keys_hint, islandChunkFileName, islandId, islandPublicUrl, normalize_import_keys, ogygia, regionId, regionIdentity, rewrite_lake_import_to_placeholder, strategyKey, wrapperVirtualId };
|