@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,178 @@
|
|
|
1
|
+
import { PROFILER_MAPS_PLACEHOLDER } from "../compiler/ids.js";
|
|
2
|
+
import { build_module_map } from "./module-map.js";
|
|
3
|
+
import { client_maps_stash } from "./server-sourcemaps.js";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import zlib from "node:zlib";
|
|
7
|
+
// src/vite/profiler-maps.ts
|
|
8
|
+
/**
|
|
9
|
+
* THE PROFILER'S MAPS, WRITTEN INTO THE CODE: after the server build has written its chunks (and
|
|
10
|
+
* their hidden `.map` files), the module that `virtual:ogygia/profiler-maps` became gets one JSON
|
|
11
|
+
* string in place of its placeholder: the module map (which source module sits at which lines of each
|
|
12
|
+
* chunk) and every chunk's sourcemap, by chunk file.
|
|
13
|
+
*
|
|
14
|
+
* Why in the code: an adapter copies what the server code imports, not files read by path. Vercel's
|
|
15
|
+
* traces imports (the `.map` files and `ogygia-modules.json` are left behind); adapter-node re-bundles
|
|
16
|
+
* the chunks with maps of its own that point back at chunks it does not ship. A dynamic import rides
|
|
17
|
+
* every adapter; the profiler loads it only when it resolves a frame, so a request pays nothing.
|
|
18
|
+
*/
|
|
19
|
+
function fill_profiler_maps(dir, bundle, root) {
|
|
20
|
+
const chunks = Object.values(bundle).filter((x) => x.type === "chunk" && typeof x.fileName === "string");
|
|
21
|
+
const quoted = [`"${PROFILER_MAPS_PLACEHOLDER}"`, `'${PROFILER_MAPS_PLACEHOLDER}'`];
|
|
22
|
+
let target;
|
|
23
|
+
for (const c of chunks) {
|
|
24
|
+
const file = path.join(dir, c.fileName);
|
|
25
|
+
let code;
|
|
26
|
+
try {
|
|
27
|
+
code = fs.readFileSync(file, "utf8");
|
|
28
|
+
} catch {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (quoted.some((q) => code.includes(q))) {
|
|
32
|
+
target = {
|
|
33
|
+
file,
|
|
34
|
+
code
|
|
35
|
+
};
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (!target) return false;
|
|
40
|
+
const maps = {};
|
|
41
|
+
const src = path.join(root, "src") + path.sep;
|
|
42
|
+
/** chunks the build wrote no map for */
|
|
43
|
+
const mapless = /* @__PURE__ */ new Set();
|
|
44
|
+
for (const c of chunks) {
|
|
45
|
+
const file = path.join(dir, c.fileName);
|
|
46
|
+
if (file === target.file) continue;
|
|
47
|
+
let raw;
|
|
48
|
+
try {
|
|
49
|
+
raw = fs.readFileSync(file + ".map", "utf8");
|
|
50
|
+
} catch {
|
|
51
|
+
mapless.add(c.fileName);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const slim = slim_map(raw, path.dirname(file), src);
|
|
55
|
+
if (slim !== void 0) maps[c.fileName] = slim;
|
|
56
|
+
}
|
|
57
|
+
const client_dir = path.join(dir, "..", "client");
|
|
58
|
+
const stash = client_maps_stash(client_dir);
|
|
59
|
+
for (const rel of list_maps(stash)) {
|
|
60
|
+
let raw;
|
|
61
|
+
try {
|
|
62
|
+
raw = fs.readFileSync(path.join(stash, rel), "utf8");
|
|
63
|
+
} catch {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const chunk = rel.slice(0, -4);
|
|
67
|
+
const at = path.join(client_dir, chunk);
|
|
68
|
+
if (!maps_app_code(raw, path.dirname(at), src)) continue;
|
|
69
|
+
const slim = slim_map(raw, path.dirname(at), src);
|
|
70
|
+
if (slim !== void 0) maps["client/" + chunk.split(path.sep).join("/")] = slim;
|
|
71
|
+
}
|
|
72
|
+
fs.rmSync(stash, {
|
|
73
|
+
recursive: true,
|
|
74
|
+
force: true
|
|
75
|
+
});
|
|
76
|
+
const on_disk = {};
|
|
77
|
+
for (const [k, v] of Object.entries(bundle)) {
|
|
78
|
+
const c = v;
|
|
79
|
+
if (c.type !== "chunk" || !c.fileName) {
|
|
80
|
+
on_disk[k] = v;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
let code = c.code;
|
|
84
|
+
try {
|
|
85
|
+
code = fs.readFileSync(path.join(dir, c.fileName), "utf8");
|
|
86
|
+
} catch {}
|
|
87
|
+
on_disk[k] = {
|
|
88
|
+
...c,
|
|
89
|
+
code
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const modules = build_module_map(on_disk, root).chunks;
|
|
93
|
+
const sources = {};
|
|
94
|
+
const texts = {};
|
|
95
|
+
for (const chunk of mapless) {
|
|
96
|
+
let app = false;
|
|
97
|
+
for (const [, , id] of modules[chunk] ?? []) {
|
|
98
|
+
if (!id.startsWith("src/") || is_data(id)) continue;
|
|
99
|
+
app = true;
|
|
100
|
+
if (id in sources) continue;
|
|
101
|
+
try {
|
|
102
|
+
sources[id] = fs.readFileSync(path.join(root, id), "utf8");
|
|
103
|
+
} catch {}
|
|
104
|
+
}
|
|
105
|
+
const code = on_disk[chunk]?.code;
|
|
106
|
+
if (app && typeof code === "string") texts[chunk] = code;
|
|
107
|
+
}
|
|
108
|
+
const payload = {
|
|
109
|
+
v: 1,
|
|
110
|
+
modules,
|
|
111
|
+
maps,
|
|
112
|
+
...Object.keys(sources).length ? { sources } : {},
|
|
113
|
+
...Object.keys(texts).length ? { chunks: texts } : {}
|
|
114
|
+
};
|
|
115
|
+
const literal = JSON.stringify("gz:" + zlib.gzipSync(JSON.stringify(payload), { level: 9 }).toString("base64"));
|
|
116
|
+
let code = target.code;
|
|
117
|
+
for (const q of quoted) code = code.split(q).join(literal);
|
|
118
|
+
fs.writeFileSync(target.file, code);
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
const is_data = (source) => source.endsWith(".json");
|
|
122
|
+
/** every `.map` under `dir`, relative to it (none when it does not exist) */
|
|
123
|
+
function list_maps(dir) {
|
|
124
|
+
const out = [];
|
|
125
|
+
const walk = (d) => {
|
|
126
|
+
let entries;
|
|
127
|
+
try {
|
|
128
|
+
entries = fs.readdirSync(d, { withFileTypes: true });
|
|
129
|
+
} catch {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
for (const e of entries) {
|
|
133
|
+
const p = path.join(d, e.name);
|
|
134
|
+
if (e.isDirectory()) walk(p);
|
|
135
|
+
else if (e.name.endsWith(".map")) out.push(path.relative(dir, p));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
walk(dir);
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
/** does this map's code come (in part) from the app's own files (a source under `src`) */
|
|
142
|
+
function maps_app_code(raw, chunk_dir, src) {
|
|
143
|
+
try {
|
|
144
|
+
const map = JSON.parse(raw);
|
|
145
|
+
const root = typeof map.sourceRoot === "string" ? map.sourceRoot : "";
|
|
146
|
+
return Array.isArray(map.sources) && map.sources.some((s) => typeof s === "string" && path.resolve(chunk_dir, root + s).startsWith(src));
|
|
147
|
+
} catch {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* A CHUNK'S MAP, CUT TO WHAT THE PROFILER READS: the mappings and names whole (every frame's line
|
|
153
|
+
* and name), the source TEXT only for the app's own code files — what the source checks read on a
|
|
154
|
+
* host without `src/` (a load line by line, a component's `{#each}`, a late island's data). A
|
|
155
|
+
* package's text and imported data (`.json`: no function runs on its lines) are the bulk of a real
|
|
156
|
+
* app's maps and never read there. Undefined for a map of data alone (nothing to name).
|
|
157
|
+
*/
|
|
158
|
+
function slim_map(raw, chunk_dir, src) {
|
|
159
|
+
let map;
|
|
160
|
+
try {
|
|
161
|
+
map = JSON.parse(raw);
|
|
162
|
+
} catch {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const sources = map.sources ?? [];
|
|
166
|
+
if (sources.length > 0 && sources.every(is_data)) return void 0;
|
|
167
|
+
if (Array.isArray(map.sourcesContent)) {
|
|
168
|
+
const root = map.sourceRoot ?? "";
|
|
169
|
+
map.sourcesContent = sources.map((s, i) => {
|
|
170
|
+
const text = map.sourcesContent?.[i];
|
|
171
|
+
if (typeof text !== "string" || is_data(s)) return null;
|
|
172
|
+
const abs = path.resolve(chunk_dir, root + s);
|
|
173
|
+
return abs.startsWith(src) && !abs.includes(`${path.sep}node_modules${path.sep}`) ? text : null;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return JSON.stringify(map);
|
|
177
|
+
}
|
|
178
|
+
export { fill_profiler_maps, slim_map };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
/** where the client build's maps are kept, off the served output: `<kit outDir>/ogygia-client-maps` */
|
|
3
|
+
export declare const CLIENT_MAPS_DIR = "ogygia-client-maps";
|
|
4
|
+
/** `<kit outDir>/output/client` → `<kit outDir>/ogygia-client-maps` */
|
|
5
|
+
export declare function client_maps_stash(client_dir: string): string;
|
|
6
|
+
/** `measuring()`: a plugin asked for the build's measurement data (read when the config resolves,
|
|
7
|
+
* after ogygia's own `config` ran the plugins' build hooks). */
|
|
8
|
+
export declare function server_sourcemaps_plugin(measuring: () => boolean): Plugin;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
// src/vite/server-sourcemaps.ts
|
|
4
|
+
/**
|
|
5
|
+
* PROFILER ON → the SERVER build writes hidden sourcemaps: `.map` files beside the server chunks, no
|
|
6
|
+
* `//# sourceMappingURL` comment. They stay on the server (a browser never loads a server chunk),
|
|
7
|
+
* and the profiler reads `<chunk>.map` to name every line by its source — a load's lines, a
|
|
8
|
+
* component's markup, where a late island's data is fetched — on the host that runs the build
|
|
9
|
+
* (Amplify, Lambda).
|
|
10
|
+
*
|
|
11
|
+
* After Kit's own config hook (`order: 'post'`): that is where Kit marks the build as the server one.
|
|
12
|
+
* Kit then starts the CLIENT build with the server's `sourcemap` setting copied in. Maps left in the
|
|
13
|
+
* client output would be served to anyone, so the client build keeps them hidden and MOVES them out
|
|
14
|
+
* of its output the moment it has written it — into `.svelte-kit/ogygia-client-maps/`, which no
|
|
15
|
+
* adapter copies. The server build (whose writeBundle ran this client build, and whose closeBundle
|
|
16
|
+
* comes before Kit's adapter) then embeds the app's own ones into the profiler's maps module
|
|
17
|
+
* (vite/profiler-maps.ts): the browser's CPU traces name the app's functions by their source line.
|
|
18
|
+
* An app's own `build.sourcemap` choice wins both ways (its maps are its to serve, or not to make).
|
|
19
|
+
*/
|
|
20
|
+
/** app roots whose server build THIS process gave hidden maps (Kit's client build runs as a second
|
|
21
|
+
* `vite.build` with fresh plugin instances, in the same process; two apps built in one process each
|
|
22
|
+
* keep their own answer) */
|
|
23
|
+
const SERVER_MAPS = Symbol.for("ogygia.server-hidden-maps");
|
|
24
|
+
/** where the client build's maps are kept, off the served output: `<kit outDir>/ogygia-client-maps` */
|
|
25
|
+
const CLIENT_MAPS_DIR = "ogygia-client-maps";
|
|
26
|
+
/** `<kit outDir>/output/client` → `<kit outDir>/ogygia-client-maps` */
|
|
27
|
+
function client_maps_stash(client_dir) {
|
|
28
|
+
return path.join(client_dir, "..", "..", CLIENT_MAPS_DIR);
|
|
29
|
+
}
|
|
30
|
+
/** `measuring()`: a plugin asked for the build's measurement data (read when the config resolves,
|
|
31
|
+
* after ogygia's own `config` ran the plugins' build hooks). */
|
|
32
|
+
function server_sourcemaps_plugin(measuring) {
|
|
33
|
+
const g = globalThis;
|
|
34
|
+
/** this instance is the client build of a server build that got hidden maps from us */
|
|
35
|
+
let client_ours = false;
|
|
36
|
+
return {
|
|
37
|
+
name: "ogygia:server-sourcemaps",
|
|
38
|
+
config: {
|
|
39
|
+
order: "post",
|
|
40
|
+
handler(config, env) {
|
|
41
|
+
if (!measuring() || env.command !== "build") return;
|
|
42
|
+
const ours = g[SERVER_MAPS] ??= /* @__PURE__ */ new Set();
|
|
43
|
+
const root = path.resolve(config.root ?? ".");
|
|
44
|
+
if (config.build?.ssr) {
|
|
45
|
+
ours.delete(root);
|
|
46
|
+
if (config.build.sourcemap !== void 0) return;
|
|
47
|
+
ours.add(root);
|
|
48
|
+
return { build: { sourcemap: "hidden" } };
|
|
49
|
+
}
|
|
50
|
+
if (ours.has(root) && config.build?.sourcemap === "hidden") client_ours = true;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
writeBundle: {
|
|
54
|
+
order: "post",
|
|
55
|
+
sequential: true,
|
|
56
|
+
handler(options, bundle) {
|
|
57
|
+
if (!client_ours || !options.dir) return;
|
|
58
|
+
const stash = client_maps_stash(options.dir);
|
|
59
|
+
fs.rmSync(stash, {
|
|
60
|
+
recursive: true,
|
|
61
|
+
force: true
|
|
62
|
+
});
|
|
63
|
+
const maps = /* @__PURE__ */ new Set();
|
|
64
|
+
for (const file of Object.keys(bundle)) maps.add(file.endsWith(".map") ? file : file + ".map");
|
|
65
|
+
for (const file of maps) {
|
|
66
|
+
const from = path.join(options.dir, file);
|
|
67
|
+
if (!fs.existsSync(from)) continue;
|
|
68
|
+
const to = path.join(stash, file);
|
|
69
|
+
try {
|
|
70
|
+
fs.mkdirSync(path.dirname(to), { recursive: true });
|
|
71
|
+
fs.renameSync(from, to);
|
|
72
|
+
} catch {
|
|
73
|
+
fs.rmSync(from, { force: true });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export { CLIENT_MAPS_DIR, client_maps_stash, server_sourcemaps_plugin };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Program } from "../compiler/program.js";
|
|
2
|
+
import { Plugin } from "vite";
|
|
3
|
+
/**
|
|
4
|
+
* Rewrite vite-plugin-svelte island sourcemap `sources` so Vite treats them as virtual.
|
|
5
|
+
*
|
|
6
|
+
* Svelte emits the basename of `virtual:ogygia/island/<id>.svelte` (just `<id>.svelte`).
|
|
7
|
+
* That string does not match Vite's `virtualSourceRE`, so `injectSourcesContent` tries a
|
|
8
|
+
* disk read and warns "points to missing source files". Pointing sources back at the
|
|
9
|
+
* full virtual module id silences the warning (and keeps maps coherent).
|
|
10
|
+
*
|
|
11
|
+
* @internal Also covered by unit tests.
|
|
12
|
+
*/
|
|
13
|
+
export declare function rewrite_island_sourcemap_sources(moduleId: string, sources: (string | null)[] | undefined): (string | null)[] | null;
|
|
14
|
+
/** The `ogygia:island-sourcemaps` post plugin (Vite flattens it into the adapter's array). */
|
|
15
|
+
export declare function island_sourcemaps_plugin(deps: {
|
|
16
|
+
program: Program;
|
|
17
|
+
is_island_path: (id: string) => boolean;
|
|
18
|
+
}): Plugin;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { strip_id } from "../compiler/program.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
// src/vite/sourcemaps.ts
|
|
4
|
+
/**
|
|
5
|
+
* The island-sourcemap sub-plugin — the irreducibly-Vite half of the sourcemap fix (it needs
|
|
6
|
+
* `this.getCombinedSourcemap`). Split out of the adapter's returned array as a factory taking the
|
|
7
|
+
* two things it reads: the `Program` (for the registry row's generated source) and the adapter's
|
|
8
|
+
* `is_island_path` predicate. Kept in `vite/` because it is a Vite `Plugin`, not a driver phase.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Rewrite vite-plugin-svelte island sourcemap `sources` so Vite treats them as virtual.
|
|
12
|
+
*
|
|
13
|
+
* Svelte emits the basename of `virtual:ogygia/island/<id>.svelte` (just `<id>.svelte`).
|
|
14
|
+
* That string does not match Vite's `virtualSourceRE`, so `injectSourcesContent` tries a
|
|
15
|
+
* disk read and warns "points to missing source files". Pointing sources back at the
|
|
16
|
+
* full virtual module id silences the warning (and keeps maps coherent).
|
|
17
|
+
*
|
|
18
|
+
* @internal Also covered by unit tests.
|
|
19
|
+
*/
|
|
20
|
+
function rewrite_island_sourcemap_sources(moduleId, sources) {
|
|
21
|
+
if (!sources?.length) return null;
|
|
22
|
+
let changed = false;
|
|
23
|
+
const next = sources.map((s) => {
|
|
24
|
+
if (typeof s !== "string") return s;
|
|
25
|
+
if (s === moduleId || s.startsWith("virtual:") || s.includes("\0")) return s;
|
|
26
|
+
if (s.endsWith(".svelte") && !s.includes("/") && !path.isAbsolute(s)) {
|
|
27
|
+
changed = true;
|
|
28
|
+
return moduleId;
|
|
29
|
+
}
|
|
30
|
+
return s;
|
|
31
|
+
});
|
|
32
|
+
return changed ? next : null;
|
|
33
|
+
}
|
|
34
|
+
/** The `ogygia:island-sourcemaps` post plugin (Vite flattens it into the adapter's array). */
|
|
35
|
+
function island_sourcemaps_plugin(deps) {
|
|
36
|
+
const { program, is_island_path } = deps;
|
|
37
|
+
return {
|
|
38
|
+
name: "ogygia:island-sourcemaps",
|
|
39
|
+
enforce: "post",
|
|
40
|
+
transform(code, id) {
|
|
41
|
+
const bare = strip_id(id);
|
|
42
|
+
if (!is_island_path(bare)) return null;
|
|
43
|
+
if (bare.includes("/wrapper/")) return {
|
|
44
|
+
code,
|
|
45
|
+
map: { mappings: "" }
|
|
46
|
+
};
|
|
47
|
+
let map;
|
|
48
|
+
try {
|
|
49
|
+
map = this.getCombinedSourcemap();
|
|
50
|
+
} catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
if (!map?.mappings || !map.sources?.length) return null;
|
|
54
|
+
const rewritten = rewrite_island_sourcemap_sources(bare, map.sources);
|
|
55
|
+
const sources = rewritten ?? map.sources;
|
|
56
|
+
const entry = program.registry.get(bare);
|
|
57
|
+
const base_name = bare.slice(bare.lastIndexOf("/") + 1);
|
|
58
|
+
let injected = false;
|
|
59
|
+
const sourcesContent = sources.map((s, i) => {
|
|
60
|
+
const prev = Array.isArray(map.sourcesContent) ? map.sourcesContent[i] : null;
|
|
61
|
+
if (prev != null) return prev;
|
|
62
|
+
if (entry && (s === bare || s === base_name)) {
|
|
63
|
+
injected = true;
|
|
64
|
+
return entry.source;
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
});
|
|
68
|
+
if (!rewritten && !injected) return null;
|
|
69
|
+
return {
|
|
70
|
+
code,
|
|
71
|
+
map: {
|
|
72
|
+
...map,
|
|
73
|
+
sources,
|
|
74
|
+
sourcesContent
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export { island_sourcemaps_plugin, rewrite_island_sourcemap_sources };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
// src/vite/style-preprocess.ts
|
|
4
|
+
/**
|
|
5
|
+
* A component source made compilable by `svelte.compile` alone, for the build-time tree-CSS
|
|
6
|
+
* collection (`compileFoucScopedCss`): `<style lang="scss|sass">` compiled to CSS, `<script
|
|
7
|
+
* lang="ts">` stripped of TypeScript. The compiler reads neither dialect; without this step such a
|
|
8
|
+
* component's scoped CSS compiles to nothing (or ships raw and unscoped) and a server-rendered
|
|
9
|
+
* subtree styled that way goes unstyled.
|
|
10
|
+
*
|
|
11
|
+
* Node-only (this is the Vite leg): `sass-embedded` or `sass` is resolved from the APP root, the
|
|
12
|
+
* way vitePreprocess finds it (neither installed → the block is left as is, one warning); TS is
|
|
13
|
+
* stripped with Vite's own transform (oxc on Vite ≥ 8, esbuild before).
|
|
14
|
+
*/
|
|
15
|
+
const STYLE_BLOCK_G = /<style\b([^>]*)>([\s\S]*?)<\/style>/gi;
|
|
16
|
+
const SCRIPT_BLOCK_G = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
|
|
17
|
+
const STYLE_LANG_ATTR = /\blang\s*=\s*["']?(scss|sass)["']?/i;
|
|
18
|
+
const SCRIPT_LANG_TS_ATTR = /\blang\s*=\s*["']?ts["']?/i;
|
|
19
|
+
let sass;
|
|
20
|
+
let sass_warned = false;
|
|
21
|
+
let transform;
|
|
22
|
+
function load_sass(root) {
|
|
23
|
+
if (sass !== void 0) return sass;
|
|
24
|
+
const require = createRequire(path.join(root, "package.json"));
|
|
25
|
+
for (const name of ["sass-embedded", "sass"]) try {
|
|
26
|
+
sass = require(name);
|
|
27
|
+
return sass;
|
|
28
|
+
} catch {}
|
|
29
|
+
sass = null;
|
|
30
|
+
return sass;
|
|
31
|
+
}
|
|
32
|
+
async function load_ts_transform() {
|
|
33
|
+
if (transform !== void 0) return transform;
|
|
34
|
+
const vite = await import("vite");
|
|
35
|
+
const oxc = vite.transformWithOxc;
|
|
36
|
+
const esbuild = vite.transformWithEsbuild;
|
|
37
|
+
transform = oxc ? (code, id) => oxc(code, id, {
|
|
38
|
+
lang: "ts",
|
|
39
|
+
typescript: { onlyRemoveTypeImports: true }
|
|
40
|
+
}) : esbuild ? (code, id) => esbuild(code, id, {
|
|
41
|
+
loader: "ts",
|
|
42
|
+
target: "esnext",
|
|
43
|
+
tsconfigRaw: { compilerOptions: { verbatimModuleSyntax: true } }
|
|
44
|
+
}) : null;
|
|
45
|
+
return transform;
|
|
46
|
+
}
|
|
47
|
+
/** `source` with `<style lang="scss|sass">` compiled to CSS and `<script lang="ts">` stripped of TS. */
|
|
48
|
+
async function preprocess_component_for_css(source, abs, root) {
|
|
49
|
+
let out = source;
|
|
50
|
+
if (STYLE_LANG_ATTR.test(out)) {
|
|
51
|
+
const compiler = load_sass(root);
|
|
52
|
+
if (!compiler) {
|
|
53
|
+
if (!sass_warned) {
|
|
54
|
+
sass_warned = true;
|
|
55
|
+
console.warn("[ogygia] a server-rendered component has `<style lang=\"scss\">` but neither `sass-embedded` nor `sass` is installed — its hole/router CSS ships unprocessed");
|
|
56
|
+
}
|
|
57
|
+
} else out = out.replace(STYLE_BLOCK_G, (whole, attrs, body) => {
|
|
58
|
+
const lang = STYLE_LANG_ATTR.exec(attrs)?.[1]?.toLowerCase();
|
|
59
|
+
if (!lang) return whole;
|
|
60
|
+
try {
|
|
61
|
+
const { css } = compiler.compileString(body, {
|
|
62
|
+
syntax: lang === "sass" ? "indented" : "scss",
|
|
63
|
+
loadPaths: [
|
|
64
|
+
path.dirname(abs),
|
|
65
|
+
root,
|
|
66
|
+
path.join(root, "node_modules")
|
|
67
|
+
],
|
|
68
|
+
quietDeps: true,
|
|
69
|
+
silenceDeprecations: ["import"]
|
|
70
|
+
});
|
|
71
|
+
return `<style${attrs.replace(STYLE_LANG_ATTR, "")}>${css}</style>`;
|
|
72
|
+
} catch (err) {
|
|
73
|
+
console.warn(`[ogygia] ${path.relative(root, abs)}: scss compile failed — ${err.message}`);
|
|
74
|
+
return whole;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (SCRIPT_LANG_TS_ATTR.test(out)) {
|
|
79
|
+
const ts = await load_ts_transform();
|
|
80
|
+
if (ts) {
|
|
81
|
+
const blocks = [...out.matchAll(SCRIPT_BLOCK_G)];
|
|
82
|
+
for (const m of blocks) {
|
|
83
|
+
const [whole, attrs, body] = m;
|
|
84
|
+
if (!SCRIPT_LANG_TS_ATTR.test(attrs)) continue;
|
|
85
|
+
try {
|
|
86
|
+
const { code } = await ts(body, abs + ".ts");
|
|
87
|
+
out = out.replace(whole, `<script${attrs}>${code}<\/script>`);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
console.warn(`[ogygia] ${path.relative(root, abs)}: TypeScript strip failed — ${err.message}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
export { preprocess_component_for_css };
|
package/package.json
CHANGED
|
@@ -1,7 +1,181 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"name": "@ogygia/core",
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"description": "The core of ogygia (SSR islands for SvelteKit): apps install `ogygia`, plugins build on this",
|
|
5
|
+
"homepage": "https://ogygiajs.dev",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/ogygiajs/ogygia/issues"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/ogygiajs/ogygia.git",
|
|
13
|
+
"directory": "packages/core"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"ambient.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"**/*.css"
|
|
23
|
+
],
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"svelte": "./dist/index.js",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./vite": {
|
|
31
|
+
"types": "./dist/vite/index.d.ts",
|
|
32
|
+
"default": "./dist/vite/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./runtime": {
|
|
35
|
+
"types": "./dist/runtime/index.d.ts",
|
|
36
|
+
"default": "./dist/runtime/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./hooks": {
|
|
39
|
+
"types": "./dist/hooks.d.ts",
|
|
40
|
+
"default": "./dist/hooks.js"
|
|
41
|
+
},
|
|
42
|
+
"./app": {
|
|
43
|
+
"types": "./dist/app.d.ts",
|
|
44
|
+
"default": "./dist/app.js"
|
|
45
|
+
},
|
|
46
|
+
"./internal": {
|
|
47
|
+
"types": "./dist/internal.d.ts",
|
|
48
|
+
"svelte": "./dist/internal.js",
|
|
49
|
+
"default": "./dist/internal.js"
|
|
50
|
+
},
|
|
51
|
+
"./internal/server": {
|
|
52
|
+
"types": "./dist/internal-server.d.ts",
|
|
53
|
+
"svelte": "./dist/internal-server.js",
|
|
54
|
+
"default": "./dist/internal-server.js"
|
|
55
|
+
},
|
|
56
|
+
"./internal/instruments": {
|
|
57
|
+
"types": "./dist/internal-instruments.d.ts",
|
|
58
|
+
"svelte": "./dist/internal-instruments.js",
|
|
59
|
+
"default": "./dist/internal-instruments.js"
|
|
60
|
+
},
|
|
61
|
+
"./internal/register": {
|
|
62
|
+
"types": "./dist/internal-register.d.ts",
|
|
63
|
+
"svelte": "./dist/internal-register.js",
|
|
64
|
+
"default": "./dist/internal-register.js"
|
|
65
|
+
},
|
|
66
|
+
"./internal/compiler-ids": {
|
|
67
|
+
"types": "./dist/compiler/ids.d.ts",
|
|
68
|
+
"svelte": "./dist/compiler/ids.js",
|
|
69
|
+
"default": "./dist/compiler/ids.js"
|
|
70
|
+
},
|
|
71
|
+
"./internal/region-core": {
|
|
72
|
+
"types": "./dist/region-core.d.ts",
|
|
73
|
+
"svelte": "./dist/region-core.js",
|
|
74
|
+
"default": "./dist/region-core.js"
|
|
75
|
+
},
|
|
76
|
+
"./internal/reconcile": {
|
|
77
|
+
"types": "./dist/internal-reconcile.d.ts",
|
|
78
|
+
"svelte": "./dist/internal-reconcile.js",
|
|
79
|
+
"default": "./dist/internal-reconcile.js"
|
|
80
|
+
},
|
|
81
|
+
"./server": {
|
|
82
|
+
"types": "./dist/hooks.d.ts",
|
|
83
|
+
"default": "./dist/hooks.js"
|
|
84
|
+
},
|
|
85
|
+
"./markup": {
|
|
86
|
+
"types": "./dist/markup.d.ts",
|
|
87
|
+
"default": "./dist/markup.js"
|
|
88
|
+
},
|
|
89
|
+
"./plugin": {
|
|
90
|
+
"types": "./dist/plugin/index.d.ts",
|
|
91
|
+
"default": "./dist/plugin/index.js"
|
|
92
|
+
},
|
|
93
|
+
"./plugin/utils": {
|
|
94
|
+
"types": "./dist/plugin/utils.d.ts",
|
|
95
|
+
"default": "./dist/plugin/utils.js"
|
|
96
|
+
},
|
|
97
|
+
"./plugin/css": {
|
|
98
|
+
"types": "./dist/plugin/css.d.ts",
|
|
99
|
+
"default": "./dist/plugin/css.js"
|
|
100
|
+
},
|
|
101
|
+
"./plugin/testing": {
|
|
102
|
+
"types": "./dist/plugin/testing.d.ts",
|
|
103
|
+
"default": "./dist/plugin/testing.js"
|
|
104
|
+
},
|
|
105
|
+
"./plugin/client": {
|
|
106
|
+
"types": "./dist/plugin/client.d.ts",
|
|
107
|
+
"default": "./dist/plugin/client.js"
|
|
108
|
+
},
|
|
109
|
+
"./events": {
|
|
110
|
+
"types": "./dist/events/index.d.ts",
|
|
111
|
+
"default": "./dist/events/index.js"
|
|
112
|
+
},
|
|
113
|
+
"./insights": {
|
|
114
|
+
"types": "./dist/insights/index.d.ts",
|
|
115
|
+
"default": "./dist/insights/index.js"
|
|
116
|
+
},
|
|
117
|
+
"./internal/compiler": {
|
|
118
|
+
"types": "./dist/compiler/index.d.ts",
|
|
119
|
+
"default": "./dist/compiler/index.js"
|
|
120
|
+
},
|
|
121
|
+
"./types": {
|
|
122
|
+
"types": "./ambient.d.ts"
|
|
123
|
+
},
|
|
124
|
+
"./internal/compiler-browser": {
|
|
125
|
+
"types": "./dist/compiler/browser.d.ts",
|
|
126
|
+
"default": "./dist/compiler/browser.js"
|
|
127
|
+
},
|
|
128
|
+
"./internal/compiler-browser-full": {
|
|
129
|
+
"types": "./dist/compiler/browser-full.d.ts",
|
|
130
|
+
"default": "./dist/compiler/browser-full.js"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"publishConfig": {
|
|
134
|
+
"access": "public"
|
|
135
|
+
},
|
|
136
|
+
"dependencies": {
|
|
137
|
+
"devalue": "^5.9.3",
|
|
138
|
+
"esm-env": "^1.2.2",
|
|
139
|
+
"estree-walker": "^3.0.3",
|
|
140
|
+
"magic-string": "^1.4.5",
|
|
141
|
+
"tinyglobby": "^0.2.17"
|
|
142
|
+
},
|
|
143
|
+
"devDependencies": {
|
|
144
|
+
"@sveltejs/kit": "^2.70.2",
|
|
145
|
+
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
|
146
|
+
"@types/node": "^26.1.2",
|
|
147
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
148
|
+
"@vitest/browser": "4.1.12",
|
|
149
|
+
"@vitest/browser-playwright": "4.1.12",
|
|
150
|
+
"rolldown": "^1.2.2",
|
|
151
|
+
"sass-embedded": "^1.104.1",
|
|
152
|
+
"svelte": "5.56.8",
|
|
153
|
+
"svelte-check": "^4.7.4",
|
|
154
|
+
"svelte2tsx": "^0.7.60",
|
|
155
|
+
"tsdown": "^0.23.4",
|
|
156
|
+
"typescript": "^6.0.3",
|
|
157
|
+
"valibot": "^1.4.2",
|
|
158
|
+
"vite": "^8.3.5",
|
|
159
|
+
"vitest": "^4.1.12",
|
|
160
|
+
"@ogygia/tsdown-plugin-svelte": "1.1.0"
|
|
161
|
+
},
|
|
162
|
+
"peerDependencies": {
|
|
163
|
+
"@sveltejs/kit": ">=2.70.2 <4",
|
|
164
|
+
"rolldown": ">=1.0.0",
|
|
165
|
+
"svelte": "^5.56.8",
|
|
166
|
+
"vite": "^8.2.4"
|
|
167
|
+
},
|
|
168
|
+
"peerDependenciesMeta": {
|
|
169
|
+
"rolldown": {
|
|
170
|
+
"optional": true
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"scripts": {
|
|
174
|
+
"build": "tsdown",
|
|
175
|
+
"test": "vitest run",
|
|
176
|
+
"test:node": "vitest run --project node",
|
|
177
|
+
"test:browser": "vitest run --project browser",
|
|
178
|
+
"check": "tsc --noEmit && svelte-check --tsconfig ./tsconfig.check.json --fail-on-warnings && tsc -p test && vitest run",
|
|
179
|
+
"verify:package": "node scripts/verify-package.ts"
|
|
180
|
+
}
|
|
181
|
+
}
|