@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,31 @@
|
|
|
1
|
+
import { DebarrelOptions } from "./options.js";
|
|
2
|
+
import { is_script_request } from "../script-request.js";
|
|
3
|
+
import { Plugin } from "vite";
|
|
4
|
+
export interface DebarrelInternal {
|
|
5
|
+
/** Import-attribute keys that mark an import as ogygia's: such an import is never rewritten. */
|
|
6
|
+
skip_attribute_keys?: string[];
|
|
7
|
+
/** Local bindings of a file that carry an island identity without an attribute (ogygia:
|
|
8
|
+
* `import.meta.og.asRegion(X)`): a declaration binding one of them is never rewritten, so
|
|
9
|
+
* the id the compiler's prescan derives from the raw source is the id the transform sees. */
|
|
10
|
+
skip_locals?: (code: string) => ReadonlySet<string>;
|
|
11
|
+
}
|
|
12
|
+
export declare function debarrel(options?: DebarrelOptions | true, internal?: DebarrelInternal): Plugin;
|
|
13
|
+
/** The build-time report: totals, time spent in the pass, and the barrels by names moved — the
|
|
14
|
+
* `limit` biggest and a count of the rest (`Infinity` for every one). */
|
|
15
|
+
export declare function format_report(r: ReturnType<typeof debarrel_report_shape>, root: string, limit: number): string;
|
|
16
|
+
/** The report record's shape (for `format_report`'s signature — the value lives in the closure). */
|
|
17
|
+
interface DebarrelReport {
|
|
18
|
+
files: number;
|
|
19
|
+
importers: number;
|
|
20
|
+
imports: number;
|
|
21
|
+
names: number;
|
|
22
|
+
first_ms: number;
|
|
23
|
+
last_ms: number;
|
|
24
|
+
barrels: Map<string, {
|
|
25
|
+
names: number;
|
|
26
|
+
importers: Set<string>;
|
|
27
|
+
}>;
|
|
28
|
+
skipped: Set<string> | undefined;
|
|
29
|
+
}
|
|
30
|
+
declare function debarrel_report_shape(): DebarrelReport;
|
|
31
|
+
export { is_script_request };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { BarrelIndex } from "./barrel.js";
|
|
2
|
+
import { matches_any, normalize_options } from "./options.js";
|
|
3
|
+
import { rewrite_module } from "./rewrite.js";
|
|
4
|
+
import { rewrite_svelte } from "./svelte.js";
|
|
5
|
+
import { is_script_request } from "../script-request.js";
|
|
6
|
+
import { strip_bom } from "../bom.js";
|
|
7
|
+
import { readFileSync, statSync } from "node:fs";
|
|
8
|
+
import { searchForWorkspaceRoot } from "vite";
|
|
9
|
+
// src/compiler/debarrel/plugin.ts
|
|
10
|
+
/**
|
|
11
|
+
* The debarrel Vite plugin — barrel imports become leaf imports at transform time.
|
|
12
|
+
*
|
|
13
|
+
* import { Button, Card } from '$lib/components'; // an index.ts that re-exports 40 files
|
|
14
|
+
* → import Button from '/…/components/Button.svelte';
|
|
15
|
+
* import Card from '/…/components/Card.svelte';
|
|
16
|
+
*
|
|
17
|
+
* Why a plugin and not tree-shaking: dev never tree-shakes (every module behind the barrel is
|
|
18
|
+
* transformed and served); build only drops what `sideEffects: false` allows, and a package that
|
|
19
|
+
* registers components or creates stores is not that; the chunk graph follows the import graph
|
|
20
|
+
* before shaking.
|
|
21
|
+
*
|
|
22
|
+
* Two ways in, one code path: `ogygia({ barrels })` folds it into the ogygia plugin array (first,
|
|
23
|
+
* so the region transform sees leaf imports) and tells it to leave region-marked imports alone;
|
|
24
|
+
* `debarrel()` from `ogygia/vite` is the same plugin for any Vite app, marks or not.
|
|
25
|
+
*
|
|
26
|
+
* Runs `enforce: 'pre'`. Uses the compiler's parser for modules, the Svelte parser for `.svelte`
|
|
27
|
+
* script blocks, `this.resolve` for resolution (aliases, `exports` maps, extensions — whatever the
|
|
28
|
+
* app's Vite knows), and `this.addWatchFile` so an edit to a barrel re-transforms the importers
|
|
29
|
+
* that no longer import it.
|
|
30
|
+
*/
|
|
31
|
+
const IMPORTER_RE = /\.(?:[cm]?[jt]sx?|svelte|svelte\.[jt]s)$/;
|
|
32
|
+
const NODE_MODULES_RE = /[\\/]node_modules[\\/]/;
|
|
33
|
+
const QUERY_RE = /[?#].*$/;
|
|
34
|
+
const BACKSLASH_G = /\\/g;
|
|
35
|
+
function debarrel(options = {}, internal = {}) {
|
|
36
|
+
const o = normalize_options(options);
|
|
37
|
+
const skip_keys = new Set(internal.skip_attribute_keys ?? []);
|
|
38
|
+
const policy_for = (code) => {
|
|
39
|
+
const locals = internal.skip_locals?.(code);
|
|
40
|
+
return { skip: (decl) => decl.attribute_keys.some((k) => skip_keys.has(k)) || !!locals && locals.size > 0 && decl.specs.some((s) => locals.has(s.local)) };
|
|
41
|
+
};
|
|
42
|
+
let root = process.cwd().replace(BACKSLASH_G, "/");
|
|
43
|
+
let resolver = null;
|
|
44
|
+
let log = (msg) => console.log(msg);
|
|
45
|
+
let command = "serve";
|
|
46
|
+
const mtimes = /* @__PURE__ */ new Map();
|
|
47
|
+
const fresh_report = () => ({
|
|
48
|
+
files: 0,
|
|
49
|
+
importers: 0,
|
|
50
|
+
imports: 0,
|
|
51
|
+
names: 0,
|
|
52
|
+
first_ms: 0,
|
|
53
|
+
last_ms: 0,
|
|
54
|
+
barrels: /* @__PURE__ */ new Map(),
|
|
55
|
+
/** components the parser could not read: their imports were left on their barrels */
|
|
56
|
+
skipped: /* @__PURE__ */ new Set()
|
|
57
|
+
});
|
|
58
|
+
let report = fresh_report();
|
|
59
|
+
const warned = /* @__PURE__ */ new Set();
|
|
60
|
+
const host = {
|
|
61
|
+
read(id) {
|
|
62
|
+
try {
|
|
63
|
+
const st = statSync(id);
|
|
64
|
+
const prev = mtimes.get(id);
|
|
65
|
+
if (prev !== void 0 && prev !== st.mtimeMs) index.invalidate(id);
|
|
66
|
+
mtimes.set(id, st.mtimeMs);
|
|
67
|
+
return strip_bom(readFileSync(id, "utf8"));
|
|
68
|
+
} catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
async resolve(spec, importer) {
|
|
73
|
+
if (!resolver) return null;
|
|
74
|
+
let r;
|
|
75
|
+
try {
|
|
76
|
+
r = await resolver.resolve(spec, importer, { skipSelf: true });
|
|
77
|
+
} catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
if (!r || r.external) return null;
|
|
81
|
+
return r.id.replace(BACKSLASH_G, "/");
|
|
82
|
+
},
|
|
83
|
+
candidate(id, spec) {
|
|
84
|
+
if (o.packages.length && matches_any(o.packages, id, spec)) return true;
|
|
85
|
+
if (o.force.length && matches_any(o.force, id, spec)) return true;
|
|
86
|
+
return !NODE_MODULES_RE.test(id) && id.startsWith(root + "/");
|
|
87
|
+
},
|
|
88
|
+
forced: (id, spec) => o.force.length > 0 && matches_any(o.force, id, spec),
|
|
89
|
+
kept: (id, spec) => o.keep.length > 0 && matches_any(o.keep, id, spec),
|
|
90
|
+
follow_packages: o.follow_packages
|
|
91
|
+
};
|
|
92
|
+
const index = new BarrelIndex(host);
|
|
93
|
+
const is_importer = (id) => {
|
|
94
|
+
if (id.includes("\0")) return false;
|
|
95
|
+
if (!is_script_request(id)) return false;
|
|
96
|
+
const clean = id.replace(QUERY_RE, "");
|
|
97
|
+
if (!IMPORTER_RE.test(clean)) return false;
|
|
98
|
+
if (o.importer_include.length) return matches_any(o.importer_include, clean, clean);
|
|
99
|
+
if (NODE_MODULES_RE.test(clean)) return false;
|
|
100
|
+
if (o.importer_exclude.length && matches_any(o.importer_exclude, clean, clean)) return false;
|
|
101
|
+
return true;
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
name: "ogygia:debarrel",
|
|
105
|
+
enforce: "pre",
|
|
106
|
+
configResolved(config) {
|
|
107
|
+
root = searchForWorkspaceRoot(config.root).replace(BACKSLASH_G, "/");
|
|
108
|
+
command = config.command;
|
|
109
|
+
log = (msg) => config.logger.info(msg);
|
|
110
|
+
},
|
|
111
|
+
buildStart() {
|
|
112
|
+
resolver = this;
|
|
113
|
+
},
|
|
114
|
+
async transform(raw, id) {
|
|
115
|
+
if (!is_importer(id)) return null;
|
|
116
|
+
const code = strip_bom(raw);
|
|
117
|
+
resolver = this;
|
|
118
|
+
const t0 = performance.now();
|
|
119
|
+
if (report.files === 0) report.first_ms = t0;
|
|
120
|
+
report.files++;
|
|
121
|
+
const importer = id.replace(QUERY_RE, "");
|
|
122
|
+
const seen = [];
|
|
123
|
+
const lookup = async (spec) => {
|
|
124
|
+
const resolved = await host.resolve(spec, importer);
|
|
125
|
+
if (!resolved) return null;
|
|
126
|
+
const map = await index.map(resolved, spec);
|
|
127
|
+
if (map) seen.push(map);
|
|
128
|
+
return map;
|
|
129
|
+
};
|
|
130
|
+
const policy = policy_for(code);
|
|
131
|
+
const result = importer.endsWith(".svelte") ? await rewrite_svelte(code, importer, lookup, policy, (why) => {
|
|
132
|
+
report.skipped.add(importer);
|
|
133
|
+
if (warned.has(importer)) return;
|
|
134
|
+
warned.add(importer);
|
|
135
|
+
console.warn(`[ogygia] barrels: skipped ${short(importer, root)}: ${why.code}${why.line ? ` at ${why.line}:${why.column ?? 1}` : ""} — its imports stay on their barrels`);
|
|
136
|
+
}) : await rewrite_module(code, importer, lookup, policy);
|
|
137
|
+
for (const map of seen) for (const d of map.deps) if (!d.includes("\0")) this.addWatchFile(d);
|
|
138
|
+
report.last_ms = performance.now();
|
|
139
|
+
if (!result) return null;
|
|
140
|
+
report.importers++;
|
|
141
|
+
report.imports += result.moves.length;
|
|
142
|
+
for (const m of result.moves) {
|
|
143
|
+
report.names += m.names.length;
|
|
144
|
+
const b = report.barrels.get(m.barrel) ?? {
|
|
145
|
+
names: 0,
|
|
146
|
+
importers: /* @__PURE__ */ new Set()
|
|
147
|
+
};
|
|
148
|
+
b.names += m.names.length;
|
|
149
|
+
b.importers.add(importer);
|
|
150
|
+
report.barrels.set(m.barrel, b);
|
|
151
|
+
}
|
|
152
|
+
if (o.debug) for (const m of result.moves) log(`[ogygia] barrels: ${short(importer, root)}: ${m.names.join(", ")} ← ${short(m.barrel, root)} → ${m.leaves.map((l) => short(l, root)).join(", ")}`);
|
|
153
|
+
return {
|
|
154
|
+
code: result.code,
|
|
155
|
+
map: result.map
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
watchChange(id) {
|
|
159
|
+
index.invalidate(id.replace(BACKSLASH_G, "/"));
|
|
160
|
+
},
|
|
161
|
+
closeBundle() {
|
|
162
|
+
if (o.report && command === "build") log(format_report(report, root, o.report === "all" ? Infinity : 8));
|
|
163
|
+
report = fresh_report();
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function short(id, root) {
|
|
168
|
+
return id.startsWith(root + "/") ? id.slice(root.length + 1) : id;
|
|
169
|
+
}
|
|
170
|
+
const n = (v) => v.toLocaleString("en-US");
|
|
171
|
+
/** The build-time report: totals, time spent in the pass, and the barrels by names moved — the
|
|
172
|
+
* `limit` biggest and a count of the rest (`Infinity` for every one). */
|
|
173
|
+
function format_report(r, root, limit) {
|
|
174
|
+
const span_s = ((r.last_ms - r.first_ms) / 1e3).toFixed(2);
|
|
175
|
+
const skipped = r.skipped?.size ? [` ${n(r.skipped.size)} component${r.skipped.size === 1 ? "" : "s"} skipped (could not be parsed; their imports stay on their barrels): ${[...r.skipped].slice(0, limit).map((id) => short(id, root)).join(", ")}${r.skipped.size > limit ? ` and ${n(r.skipped.size - limit)} more` : ""}`] : [];
|
|
176
|
+
if (r.importers === 0) return [`[ogygia] barrels: ${n(r.files)} files scanned, no barrel imports to rewrite (${span_s} s)`, ...skipped].join("\n");
|
|
177
|
+
const head = `[ogygia] barrels: ${n(r.importers)} of ${n(r.files)} files rewritten — ${n(r.imports)} barrel imports → leaves (${n(r.names)} names), ${n(r.barrels.size)} barrels bypassed, ${span_s} s first to last transform`;
|
|
178
|
+
const sorted = [...r.barrels.entries()].sort((a, b) => b[1].names - a[1].names);
|
|
179
|
+
const top = sorted.slice(0, limit);
|
|
180
|
+
const width = Math.max(...top.map(([, b]) => n(b.names).length));
|
|
181
|
+
const rows = top.map(([id, b]) => ` ${n(b.names).padStart(width)} names ${short(id, root)} ← ${n(b.importers.size)} importer${b.importers.size === 1 ? "" : "s"}`);
|
|
182
|
+
const rest = sorted.length - top.length;
|
|
183
|
+
if (rest > 0) rows.push(` … and ${n(rest)} more barrel${rest === 1 ? "" : "s"} (\`barrels: { report: 'all' }\` lists every one)`);
|
|
184
|
+
return [
|
|
185
|
+
head,
|
|
186
|
+
...rows,
|
|
187
|
+
...skipped
|
|
188
|
+
].join("\n");
|
|
189
|
+
}
|
|
190
|
+
export { debarrel, format_report, is_script_request };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ExportMap } from "./barrel.js";
|
|
2
|
+
import { ImportDecl } from "./parse.js";
|
|
3
|
+
import MagicString from "magic-string";
|
|
4
|
+
export interface RewriteMove {
|
|
5
|
+
barrel: string;
|
|
6
|
+
names: string[];
|
|
7
|
+
leaves: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface RewriteResult {
|
|
10
|
+
code: string;
|
|
11
|
+
map: ReturnType<MagicString["generateMap"]>;
|
|
12
|
+
moves: RewriteMove[];
|
|
13
|
+
}
|
|
14
|
+
export interface Lookup {
|
|
15
|
+
/** The barrel's export map for the import's specifier, or null when the import is left alone. */
|
|
16
|
+
(source: string): Promise<ExportMap | null>;
|
|
17
|
+
}
|
|
18
|
+
export interface RewritePolicy {
|
|
19
|
+
/** Leave this declaration exactly as written (ogygia: an import that carries region marks). */
|
|
20
|
+
skip?: (decl: ImportDecl) => boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Rewrite one module's import declarations. `offset` maps positions when `code` is a slice of a
|
|
23
|
+
* bigger file (a Svelte `<script>` block): edits are applied to `ms` at `offset + pos`. `id`
|
|
24
|
+
* names the code for the parser (its extension picks the dialect). */
|
|
25
|
+
export declare function rewrite_imports(code: string, id: string, lookup: Lookup, ms: MagicString, offset?: number, policy?: RewritePolicy): Promise<RewriteMove[]>;
|
|
26
|
+
/** Whole-file rewrite for a JS/TS module. */
|
|
27
|
+
export declare function rewrite_module(code: string, id: string, lookup: Lookup, policy?: RewritePolicy): Promise<RewriteResult | null>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { analyze_imports } from "./parse.js";
|
|
2
|
+
import MagicString from "magic-string";
|
|
3
|
+
// src/compiler/debarrel/rewrite.ts
|
|
4
|
+
/**
|
|
5
|
+
* The importer rewrite: every `import { … } from 'barrel'` whose names the index can place is
|
|
6
|
+
* replaced, in place, by one import per leaf — attributes preserved, local names unchanged, type
|
|
7
|
+
* modifiers kept. Names the index cannot place stay on the barrel; a pure barrel whose names all
|
|
8
|
+
* moved loses its import, an impure (forced) one keeps a bare `import 'barrel'` so its own code
|
|
9
|
+
* still runs. Pure over a lookup function and a code string; sourcemap via magic-string.
|
|
10
|
+
*/
|
|
11
|
+
const BAD_IDENT_RE = /[^A-Za-z0-9_$\u0080-\uFFFF]/;
|
|
12
|
+
const JS_STRING_ESCAPE_RE = /[\\'\n\r\u2028\u2029]/g;
|
|
13
|
+
const JS_STRING_ESCAPES = {
|
|
14
|
+
"\\": "\\\\",
|
|
15
|
+
"'": "\\'",
|
|
16
|
+
"\n": "\\n",
|
|
17
|
+
"\r": "\\r",
|
|
18
|
+
"\u2028": "\\u2028",
|
|
19
|
+
"\u2029": "\\u2029"
|
|
20
|
+
};
|
|
21
|
+
const quote = (s) => "'" + s.replace(JS_STRING_ESCAPE_RE, (c) => JS_STRING_ESCAPES[c]) + "'";
|
|
22
|
+
/** Rewrite one module's import declarations. `offset` maps positions when `code` is a slice of a
|
|
23
|
+
* bigger file (a Svelte `<script>` block): edits are applied to `ms` at `offset + pos`. `id`
|
|
24
|
+
* names the code for the parser (its extension picks the dialect). */
|
|
25
|
+
async function rewrite_imports(code, id, lookup, ms, offset = 0, policy = {}) {
|
|
26
|
+
const decls = analyze_imports(code, id);
|
|
27
|
+
if (!decls) return [];
|
|
28
|
+
const moves = [];
|
|
29
|
+
for (const decl of decls) {
|
|
30
|
+
if (decl.side_effect) continue;
|
|
31
|
+
if (decl.type_only) continue;
|
|
32
|
+
if (decl.specs.some((s) => s.kind === "namespace")) continue;
|
|
33
|
+
if (policy.skip && policy.skip(decl)) continue;
|
|
34
|
+
const map = await lookup(decl.source);
|
|
35
|
+
if (!map || !map.rewritable) continue;
|
|
36
|
+
const by_leaf = /* @__PURE__ */ new Map();
|
|
37
|
+
const stays = [];
|
|
38
|
+
for (const spec of decl.specs) {
|
|
39
|
+
const entry = map.entries.get(spec.imported);
|
|
40
|
+
if (!entry || entry === "own" || entry === "ambiguous") {
|
|
41
|
+
stays.push(spec);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const namespace = "namespace" in entry;
|
|
45
|
+
const key = namespace ? entry.id + "\0*" : entry.id;
|
|
46
|
+
const group = by_leaf.get(key) ?? {
|
|
47
|
+
id: entry.id,
|
|
48
|
+
namespace,
|
|
49
|
+
items: []
|
|
50
|
+
};
|
|
51
|
+
group.items.push({
|
|
52
|
+
spec,
|
|
53
|
+
leaf: entry
|
|
54
|
+
});
|
|
55
|
+
by_leaf.set(key, group);
|
|
56
|
+
}
|
|
57
|
+
if (by_leaf.size === 0) continue;
|
|
58
|
+
const lines = [];
|
|
59
|
+
const leaves = [];
|
|
60
|
+
const moved = [];
|
|
61
|
+
for (const group of by_leaf.values()) {
|
|
62
|
+
leaves.push(group.id);
|
|
63
|
+
const specs = group.items.map((i) => i.spec);
|
|
64
|
+
for (const s of specs) moved.push(s.imported);
|
|
65
|
+
const attrs = decl.attributes;
|
|
66
|
+
if (group.namespace) {
|
|
67
|
+
for (const s of specs) lines.push(`import * as ${s.local} from ${quote(group.id)}${attrs};`);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const type_all = decl.type_only || specs.every((s) => s.type_only);
|
|
71
|
+
const type_kw = type_all ? "type " : "";
|
|
72
|
+
const named = [];
|
|
73
|
+
let default_local = null;
|
|
74
|
+
const more_defaults = [];
|
|
75
|
+
for (const { spec: s, leaf } of group.items) {
|
|
76
|
+
const target = "namespace" in leaf ? "*" : leaf.name;
|
|
77
|
+
if (target === "default") {
|
|
78
|
+
if (default_local === null) default_local = s.local;
|
|
79
|
+
else more_defaults.push(s.local);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const mod = !type_all && s.type_only ? "type " : "";
|
|
83
|
+
const name = BAD_IDENT_RE.test(target) ? JSON.stringify(target) : target;
|
|
84
|
+
named.push(target === s.local ? `${mod}${target}` : `${mod}${name} as ${s.local}`);
|
|
85
|
+
}
|
|
86
|
+
if (default_local !== null && named.length) lines.push(`import ${type_kw}${default_local}, { ${named.join(", ")} } from ${quote(group.id)}${attrs};`);
|
|
87
|
+
else if (default_local !== null) lines.push(`import ${type_kw}${default_local} from ${quote(group.id)}${attrs};`);
|
|
88
|
+
else lines.push(`import ${type_kw}{ ${named.join(", ")} } from ${quote(group.id)}${attrs};`);
|
|
89
|
+
for (const local of more_defaults) lines.push(`import ${type_kw}${local} from ${quote(group.id)}${attrs};`);
|
|
90
|
+
}
|
|
91
|
+
if (stays.length) {
|
|
92
|
+
const type_kw = decl.type_only ? "type " : "";
|
|
93
|
+
const def = stays.find((s) => s.kind === "default");
|
|
94
|
+
const named = stays.filter((s) => s.kind === "named").map((s) => `${!decl.type_only && s.type_only ? "type " : ""}${s.imported === s.local ? s.imported : `${s.imported} as ${s.local}`}`);
|
|
95
|
+
const parts = [def ? def.local : null, named.length ? `{ ${named.join(", ")} }` : null].filter(Boolean);
|
|
96
|
+
lines.push(`import ${type_kw}${parts.join(", ")} from ${quote(decl.source)}${decl.attributes};`);
|
|
97
|
+
} else if (!map.pure) lines.push(`import ${quote(decl.source)}${decl.attributes};`);
|
|
98
|
+
ms.overwrite(offset + decl.start, offset + decl.end, lines.join("\n"));
|
|
99
|
+
moves.push({
|
|
100
|
+
barrel: map.id,
|
|
101
|
+
names: moved,
|
|
102
|
+
leaves: [...new Set(leaves)]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return moves;
|
|
106
|
+
}
|
|
107
|
+
/** Whole-file rewrite for a JS/TS module. */
|
|
108
|
+
async function rewrite_module(code, id, lookup, policy = {}) {
|
|
109
|
+
const ms = new MagicString(code);
|
|
110
|
+
const moves = await rewrite_imports(code, id, lookup, ms, 0, policy);
|
|
111
|
+
if (moves.length === 0) return null;
|
|
112
|
+
return {
|
|
113
|
+
code: ms.toString(),
|
|
114
|
+
map: ms.generateMap({ hires: true }),
|
|
115
|
+
moves
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export { rewrite_imports, rewrite_module };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { blank_styles } from "../blank-styles.js";
|
|
2
|
+
import { Lookup, RewritePolicy, RewriteResult } from "./rewrite.js";
|
|
3
|
+
/** Why a component was skipped: the parser's code and where (1-based line and column). */
|
|
4
|
+
export interface SvelteSkip {
|
|
5
|
+
code: string;
|
|
6
|
+
line?: number;
|
|
7
|
+
column?: number;
|
|
8
|
+
}
|
|
9
|
+
/** Rewrite the imports in a Svelte component's script blocks. Null when nothing changed.
|
|
10
|
+
* `on_skip`: told when the component still cannot be parsed (its imports then stay on their
|
|
11
|
+
* barrels) — the plugin warns and counts it, rather than skip in silence. */
|
|
12
|
+
export declare function rewrite_svelte(code: string, filename: string, lookup: Lookup, policy?: RewritePolicy, on_skip?: (why: SvelteSkip) => void): Promise<RewriteResult | null>;
|
|
13
|
+
export { blank_styles };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { blank_styles } from "../blank-styles.js";
|
|
2
|
+
import { rewrite_imports } from "./rewrite.js";
|
|
3
|
+
import { parse } from "svelte/compiler";
|
|
4
|
+
import MagicString from "magic-string";
|
|
5
|
+
// src/compiler/debarrel/svelte.ts
|
|
6
|
+
/**
|
|
7
|
+
* Svelte importers: the imports live in `<script>` and `<script module>` blocks. The Svelte parser
|
|
8
|
+
* (modern AST, the one the region transform uses) gives their exact content ranges — no regex over
|
|
9
|
+
* markup, so a `<script>` inside a template string or an `{@html}` never confuses us. The block's
|
|
10
|
+
* `lang` picks the dialect: the slice is parsed under `<file>.svelte.ts` / `<file>.svelte.js`.
|
|
11
|
+
* The styles are blanked before the parse (`blank_styles`): only the scripts are read.
|
|
12
|
+
*/
|
|
13
|
+
function lang_of_block(block) {
|
|
14
|
+
for (const attr of block.attributes) {
|
|
15
|
+
if (attr.type !== "Attribute" || attr.name !== "lang" || attr.value === true) continue;
|
|
16
|
+
const v = (Array.isArray(attr.value) ? attr.value : [attr.value]).map((t) => t.type === "Text" ? t.data ?? "" : "").join("");
|
|
17
|
+
return v === "ts" || v === "typescript" ? "ts" : "js";
|
|
18
|
+
}
|
|
19
|
+
return "js";
|
|
20
|
+
}
|
|
21
|
+
/** Rewrite the imports in a Svelte component's script blocks. Null when nothing changed.
|
|
22
|
+
* `on_skip`: told when the component still cannot be parsed (its imports then stay on their
|
|
23
|
+
* barrels) — the plugin warns and counts it, rather than skip in silence. */
|
|
24
|
+
async function rewrite_svelte(code, filename, lookup, policy = {}, on_skip) {
|
|
25
|
+
let ast;
|
|
26
|
+
try {
|
|
27
|
+
ast = parse(blank_styles(code), {
|
|
28
|
+
modern: true,
|
|
29
|
+
filename
|
|
30
|
+
});
|
|
31
|
+
} catch (err) {
|
|
32
|
+
const e = err;
|
|
33
|
+
on_skip?.({
|
|
34
|
+
code: e.code ?? (e.message ?? "parse error").split("\n")[0].slice(0, 80),
|
|
35
|
+
line: e.start?.line,
|
|
36
|
+
column: e.start?.column !== void 0 ? e.start.column + 1 : void 0
|
|
37
|
+
});
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const ms = new MagicString(code);
|
|
41
|
+
const moves = [];
|
|
42
|
+
for (const block of [ast.module, ast.instance]) {
|
|
43
|
+
if (!block) continue;
|
|
44
|
+
const { start, end } = block.content;
|
|
45
|
+
const inner = code.slice(start, end);
|
|
46
|
+
const id = `${filename}.${lang_of_block(block)}`;
|
|
47
|
+
moves.push(...await rewrite_imports(inner, id, lookup, ms, start, policy));
|
|
48
|
+
}
|
|
49
|
+
if (moves.length === 0) return null;
|
|
50
|
+
return {
|
|
51
|
+
code: ms.toString(),
|
|
52
|
+
map: ms.generateMap({ hires: true }),
|
|
53
|
+
moves
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export { blank_styles, rewrite_svelte };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Structural shape of a Vite dev module-graph node (the two fields the owner walk reads). */
|
|
2
|
+
export type DevGraphModule = {
|
|
3
|
+
file?: string | null;
|
|
4
|
+
importers?: Iterable<DevGraphModule>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Which top-level route scopes can reach `abs_file` — walked UP the dev module graph until route
|
|
8
|
+
* files are hit. A scope is a route file's first path segment under `src/routes` (`'(docs)'`,
|
|
9
|
+
* `'playground'`, `''` for a root-level route file). `[]` = no route owner found; the client treats
|
|
10
|
+
* that as shared and joins anywhere (the safe default for exotic graphs).
|
|
11
|
+
*
|
|
12
|
+
* @internal Exported for unit tests.
|
|
13
|
+
*/
|
|
14
|
+
export declare function derive_css_scope_owners(abs_file: string, root: string, graphs: Array<{
|
|
15
|
+
getModulesByFile?: (f: string) => Set<DevGraphModule> | undefined;
|
|
16
|
+
} | undefined | null>): string[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { path } from "../host.js";
|
|
2
|
+
import { kit_dirs } from "../kit.js";
|
|
3
|
+
// src/compiler/dev/css-scope.ts
|
|
4
|
+
/**
|
|
5
|
+
* Dev-only CSS scope ownership — walks UP the Vite dev module graph to find which top-level route
|
|
6
|
+
* scopes can reach a changed stylesheet, so the soft-CSS-HMR bridge joins a file only on the pages
|
|
7
|
+
* whose sub-app actually owns it. Pure over the graph nodes it is handed; reads, never mutates.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Which top-level route scopes can reach `abs_file` — walked UP the dev module graph until route
|
|
11
|
+
* files are hit. A scope is a route file's first path segment under `src/routes` (`'(docs)'`,
|
|
12
|
+
* `'playground'`, `''` for a root-level route file). `[]` = no route owner found; the client treats
|
|
13
|
+
* that as shared and joins anywhere (the safe default for exotic graphs).
|
|
14
|
+
*
|
|
15
|
+
* @internal Exported for unit tests.
|
|
16
|
+
*/
|
|
17
|
+
function derive_css_scope_owners(abs_file, root, graphs) {
|
|
18
|
+
const routes_dir = kit_dirs(root).routes_dir + path.sep;
|
|
19
|
+
const owners = /* @__PURE__ */ new Set();
|
|
20
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21
|
+
const stack = [];
|
|
22
|
+
for (const g of graphs) for (const m of g?.getModulesByFile?.(abs_file) ?? []) stack.push(m);
|
|
23
|
+
let steps = 0;
|
|
24
|
+
while (stack.length && steps++ < 5e3) {
|
|
25
|
+
const mod = stack.pop();
|
|
26
|
+
if (seen.has(mod)) continue;
|
|
27
|
+
seen.add(mod);
|
|
28
|
+
const f = mod.file ? path.normalize(mod.file) : null;
|
|
29
|
+
if (f && f.startsWith(routes_dir)) {
|
|
30
|
+
const seg = f.slice(routes_dir.length).split(path.sep)[0] ?? "";
|
|
31
|
+
owners.add(seg.includes(".") ? "" : seg);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
for (const imp of mod.importers ?? []) stack.push(imp);
|
|
35
|
+
}
|
|
36
|
+
return [...owners].sort();
|
|
37
|
+
}
|
|
38
|
+
export { derive_css_scope_owners };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client bridge source for `virtual:ogygia/dev-hmr` (vite serve only). Pure codegen: it returns the
|
|
3
|
+
* JS text the adapter serves for the dev soft-CSS-HMR bridge. No build state.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Client bridge source for `virtual:ogygia/dev-hmr` (vite serve only): a LAZY map of app CSS under
|
|
7
|
+
* `/src`, joined per-file when the plugin broadcasts a scoped `ogygia:css` event — plus full-reload
|
|
8
|
+
* on `vite:error`.
|
|
9
|
+
*
|
|
10
|
+
* LAZY is load-bearing. The bridge used to join every `/src` stylesheet EAGERLY, which painted the
|
|
11
|
+
* whole app's CSS onto every page — invisible while one app owned one look, but the moment two
|
|
12
|
+
* sub-apps share one project (the `(docs)` / `playground` split), each page wore the other's skin
|
|
13
|
+
* in dev while prod (Kit's per-route CSS) stayed clean. Now a page boots with exactly its SSR CSS,
|
|
14
|
+
* and joins a stylesheet only when it changes AND this page's route scope owns it (the
|
|
15
|
+
* `ogygia-dev-scope` meta the handle stamps vs. the owners the plugin derives from the module
|
|
16
|
+
* graph). Once joined, later edits soft-apply through Vite's normal CSS HMR.
|
|
17
|
+
*
|
|
18
|
+
* Do **not** strip Kit’s `<style data-sveltekit>` FOUC bag. Under `csr = false` that bag is
|
|
19
|
+
* how page + component CSS is delivered (no client module graph for route shells). Removing
|
|
20
|
+
* it blanks the page; a MutationObserver would also delete FOUC styles the SPA router merges
|
|
21
|
+
* in on navigation.
|
|
22
|
+
*
|
|
23
|
+
* @internal Emitted by the plugin; exported for unit tests.
|
|
24
|
+
*/
|
|
25
|
+
export declare function dev_hmr_client_source(): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/compiler/dev/dev-hmr.ts
|
|
2
|
+
/**
|
|
3
|
+
* Client bridge source for `virtual:ogygia/dev-hmr` (vite serve only). Pure codegen: it returns the
|
|
4
|
+
* JS text the adapter serves for the dev soft-CSS-HMR bridge. No build state.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Client bridge source for `virtual:ogygia/dev-hmr` (vite serve only): a LAZY map of app CSS under
|
|
8
|
+
* `/src`, joined per-file when the plugin broadcasts a scoped `ogygia:css` event — plus full-reload
|
|
9
|
+
* on `vite:error`.
|
|
10
|
+
*
|
|
11
|
+
* LAZY is load-bearing. The bridge used to join every `/src` stylesheet EAGERLY, which painted the
|
|
12
|
+
* whole app's CSS onto every page — invisible while one app owned one look, but the moment two
|
|
13
|
+
* sub-apps share one project (the `(docs)` / `playground` split), each page wore the other's skin
|
|
14
|
+
* in dev while prod (Kit's per-route CSS) stayed clean. Now a page boots with exactly its SSR CSS,
|
|
15
|
+
* and joins a stylesheet only when it changes AND this page's route scope owns it (the
|
|
16
|
+
* `ogygia-dev-scope` meta the handle stamps vs. the owners the plugin derives from the module
|
|
17
|
+
* graph). Once joined, later edits soft-apply through Vite's normal CSS HMR.
|
|
18
|
+
*
|
|
19
|
+
* Do **not** strip Kit’s `<style data-sveltekit>` FOUC bag. Under `csr = false` that bag is
|
|
20
|
+
* how page + component CSS is delivered (no client module graph for route shells). Removing
|
|
21
|
+
* it blanks the page; a MutationObserver would also delete FOUC styles the SPA router merges
|
|
22
|
+
* in on navigation.
|
|
23
|
+
*
|
|
24
|
+
* @internal Emitted by the plugin; exported for unit tests.
|
|
25
|
+
*/
|
|
26
|
+
function dev_hmr_client_source() {
|
|
27
|
+
return "import \"/@vite/client\";\nconst css_modules = import.meta.glob(\"/src/**/*.{css,scss,sass,less,styl}\", { eager: false });\nconst scope_meta = document.querySelector('meta[name=\"ogygia-dev-scope\"]');\nconst scope = scope_meta ? scope_meta.getAttribute(\"content\") || \"\" : \"\";\n// Soft path: scoped join on first change, then Vite CSS HMR (injected after FOUC; later rules win).\n// Hard path: anything Vite can't apply.\nfunction ogygia_full_reload() {\n location.reload();\n}\nif (import.meta.hot) {\n import.meta.hot.accept();\n import.meta.hot.on(\"vite:error\", ogygia_full_reload);\n import.meta.hot.on(\"ogygia:css\", (d) => {\n const p = d && d.path;\n if (!p || !css_modules[p]) return;\n const owners = (d && d.owners) || [];\n // Join only what this page's sub-app owns; ownerless css (shared / undeterminable) joins anywhere.\n if (owners.length && owners.indexOf(scope) === -1) return;\n css_modules[p]();\n });\n}\n";
|
|
28
|
+
}
|
|
29
|
+
export { dev_hmr_client_source };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host route shells (`+page` / `+layout` / …) never join the browser module graph under
|
|
3
|
+
* `csr=false`, so Vite's fine-grained HMR for them has no client importer. Force a full reload.
|
|
4
|
+
* Standalone CSS is soft-updated via `virtual:ogygia/dev-hmr` (Vite inject after Kit FOUC).
|
|
5
|
+
* If that soft path fails, the client bridge listens for `vite:error` and reloads the document.
|
|
6
|
+
*
|
|
7
|
+
* @internal HMR policy helper (also covered by unit tests).
|
|
8
|
+
*/
|
|
9
|
+
export declare function needs_csr_false_full_reload(file: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Island entry `.svelte` files (the `import X from '…' with { hydrate }`) sit behind a virtual
|
|
12
|
+
* wrapper; Svelte soft HMR through that edge is unreliable. Shared `.ts` deps still soft-update.
|
|
13
|
+
*
|
|
14
|
+
* @internal HMR policy helper (also covered by unit tests).
|
|
15
|
+
*/
|
|
16
|
+
export declare function needs_island_entry_full_reload(file: string, entries: Iterable<{
|
|
17
|
+
componentPath?: string | null;
|
|
18
|
+
}>): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Absolute path equality with querystrings stripped (host vs component vs Vite watch paths).
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function same_module_path(a: string | null | undefined, b: string | null | undefined): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Virtual island ids whose generated source must be dropped when `file` changes or is deleted.
|
|
26
|
+
* Island ids are `hash(componentPath\\0strategyKey)` — renaming a host route keeps the same id, so
|
|
27
|
+
* Vite's moduleGraph must be invalidated or it keeps serving the old import.
|
|
28
|
+
*
|
|
29
|
+
* @internal HMR invalidation helper (also covered by unit tests).
|
|
30
|
+
*/
|
|
31
|
+
export declare function island_vpaths_affected_by_file(file: string, entries: Iterable<[string, {
|
|
32
|
+
hostPath?: string | null;
|
|
33
|
+
componentPath?: string | null;
|
|
34
|
+
}]>): string[];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { path } from "../host.js";
|
|
2
|
+
// src/compiler/dev/hmr.ts
|
|
3
|
+
/**
|
|
4
|
+
* HMR reload-decision helpers — pure policy functions the Vite adapter's `handleHotUpdate` /
|
|
5
|
+
* `watchChange` consult to decide between a soft update and a full document reload. No build state;
|
|
6
|
+
* data in → decision out. Covered by unit tests.
|
|
7
|
+
*/
|
|
8
|
+
const BACKSLASH = /\\/g;
|
|
9
|
+
const STYLE_EXT = /\.(css|scss|sass|less|styl)(?:$|\?)/i;
|
|
10
|
+
const KIT_ROUTE_FILE = /(?:^|\/)\+(?:page|layout|error|server|hooks)(?:\.|$)/;
|
|
11
|
+
/**
|
|
12
|
+
* Host route shells (`+page` / `+layout` / …) never join the browser module graph under
|
|
13
|
+
* `csr=false`, so Vite's fine-grained HMR for them has no client importer. Force a full reload.
|
|
14
|
+
* Standalone CSS is soft-updated via `virtual:ogygia/dev-hmr` (Vite inject after Kit FOUC).
|
|
15
|
+
* If that soft path fails, the client bridge listens for `vite:error` and reloads the document.
|
|
16
|
+
*
|
|
17
|
+
* @internal HMR policy helper (also covered by unit tests).
|
|
18
|
+
*/
|
|
19
|
+
function needs_csr_false_full_reload(file) {
|
|
20
|
+
const norm = file.replace(BACKSLASH, "/");
|
|
21
|
+
if (STYLE_EXT.test(norm)) return false;
|
|
22
|
+
return KIT_ROUTE_FILE.test(norm);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Island entry `.svelte` files (the `import X from '…' with { hydrate }`) sit behind a virtual
|
|
26
|
+
* wrapper; Svelte soft HMR through that edge is unreliable. Shared `.ts` deps still soft-update.
|
|
27
|
+
*
|
|
28
|
+
* @internal HMR policy helper (also covered by unit tests).
|
|
29
|
+
*/
|
|
30
|
+
function needs_island_entry_full_reload(file, entries) {
|
|
31
|
+
const bare = file.split("?")[0];
|
|
32
|
+
if (!bare.endsWith(".svelte")) return false;
|
|
33
|
+
if (STYLE_EXT.test(bare.replace(BACKSLASH, "/"))) return false;
|
|
34
|
+
for (const entry of entries) if (same_module_path(entry.componentPath, file)) return true;
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Absolute path equality with querystrings stripped (host vs component vs Vite watch paths).
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
function same_module_path(a, b) {
|
|
42
|
+
if (!a || !b) return false;
|
|
43
|
+
return path.resolve(a.split("?")[0]) === path.resolve(b.split("?")[0]);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Virtual island ids whose generated source must be dropped when `file` changes or is deleted.
|
|
47
|
+
* Island ids are `hash(componentPath\\0strategyKey)` — renaming a host route keeps the same id, so
|
|
48
|
+
* Vite's moduleGraph must be invalidated or it keeps serving the old import.
|
|
49
|
+
*
|
|
50
|
+
* @internal HMR invalidation helper (also covered by unit tests).
|
|
51
|
+
*/
|
|
52
|
+
function island_vpaths_affected_by_file(file, entries) {
|
|
53
|
+
const out = [];
|
|
54
|
+
for (const [vpath, entry] of entries) if (same_module_path(entry.hostPath, file) || same_module_path(entry.componentPath, file)) out.push(vpath);
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
export { island_vpaths_affected_by_file, needs_csr_false_full_reload, needs_island_entry_full_reload, same_module_path };
|