@ogygia/core 0.0.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +7 -1
- package/ambient.d.ts +194 -0
- package/dist/ClientBindingStub.svelte +6 -0
- package/dist/ClientBindingStub.svelte.d.ts +26 -0
- package/dist/KeepHost.svelte +19 -0
- package/dist/KeepHost.svelte.d.ts +10 -0
- package/dist/LakeBoundary.svelte +16 -0
- package/dist/LakeBoundary.svelte.d.ts +11 -0
- package/dist/LateIsland.svelte +22 -0
- package/dist/LateIsland.svelte.d.ts +15 -0
- package/dist/LateIslandAwait.svelte +17 -0
- package/dist/LateIslandAwait.svelte.d.ts +15 -0
- package/dist/LiveHost.svelte +19 -0
- package/dist/LiveHost.svelte.d.ts +10 -0
- package/dist/NestedProvider.svelte +13 -0
- package/dist/NestedProvider.svelte.d.ts +8 -0
- package/dist/OgygiaBoundary.svelte +5 -0
- package/dist/OgygiaBoundary.svelte.d.ts +17 -0
- package/dist/PromiseRegion.svelte +40 -0
- package/dist/PromiseRegion.svelte.d.ts +15 -0
- package/dist/PromiseRegionAwait.svelte +27 -0
- package/dist/PromiseRegionAwait.svelte.d.ts +15 -0
- package/dist/Provide.svelte +27 -0
- package/dist/Provide.svelte.d.ts +8 -0
- package/dist/RawHtml.svelte +9 -0
- package/dist/RawHtml.svelte.d.ts +6 -0
- package/dist/Region.svelte +1173 -0
- package/dist/Region.svelte.d.ts +68 -0
- package/dist/SlotBoundary.svelte +13 -0
- package/dist/SlotBoundary.svelte.d.ts +7 -0
- package/dist/app.d.ts +4 -0
- package/dist/app.js +3 -0
- package/dist/boundary.d.ts +35 -0
- package/dist/boundary.js +127 -0
- package/dist/build-cache.d.ts +13 -0
- package/dist/build-cache.js +77 -0
- package/dist/compiler/blank-styles.d.ts +1 -0
- package/dist/compiler/blank-styles.js +63 -0
- package/dist/compiler/bom.d.ts +2 -0
- package/dist/compiler/bom.js +15 -0
- package/dist/compiler/browser-full.d.ts +8 -0
- package/dist/compiler/browser-full.js +8 -0
- package/dist/compiler/browser.d.ts +11 -0
- package/dist/compiler/browser.js +11 -0
- package/dist/compiler/content/transportables.d.ts +26 -0
- package/dist/compiler/content/transportables.js +219 -0
- package/dist/compiler/ctx.d.ts +185 -0
- package/dist/compiler/ctx.js +203 -0
- package/dist/compiler/debarrel/barrel.d.ts +55 -0
- package/dist/compiler/debarrel/barrel.js +248 -0
- package/dist/compiler/debarrel/options.d.ts +67 -0
- package/dist/compiler/debarrel/options.js +31 -0
- package/dist/compiler/debarrel/parse.d.ts +65 -0
- package/dist/compiler/debarrel/parse.js +256 -0
- package/dist/compiler/debarrel/plugin.d.ts +31 -0
- package/dist/compiler/debarrel/plugin.js +190 -0
- package/dist/compiler/debarrel/rewrite.d.ts +27 -0
- package/dist/compiler/debarrel/rewrite.js +118 -0
- package/dist/compiler/debarrel/svelte.d.ts +13 -0
- package/dist/compiler/debarrel/svelte.js +56 -0
- package/dist/compiler/dev/css-scope.d.ts +16 -0
- package/dist/compiler/dev/css-scope.js +38 -0
- package/dist/compiler/dev/dev-hmr.d.ts +25 -0
- package/dist/compiler/dev/dev-hmr.js +29 -0
- package/dist/compiler/dev/hmr.d.ts +34 -0
- package/dist/compiler/dev/hmr.js +57 -0
- package/dist/compiler/dev/region-bytes.d.ts +34 -0
- package/dist/compiler/dev/region-bytes.js +126 -0
- package/dist/compiler/driver.d.ts +280 -0
- package/dist/compiler/driver.js +1352 -0
- package/dist/compiler/flags.d.ts +16 -0
- package/dist/compiler/flags.js +101 -0
- package/dist/compiler/fouc-css.d.ts +97 -0
- package/dist/compiler/fouc-css.js +335 -0
- package/dist/compiler/free-vars.d.ts +20 -0
- package/dist/compiler/free-vars.js +327 -0
- package/dist/compiler/host.d.ts +65 -0
- package/dist/compiler/host.js +51 -0
- package/dist/compiler/ids.d.ts +84 -0
- package/dist/compiler/ids.js +86 -0
- package/dist/compiler/index.d.ts +11 -0
- package/dist/compiler/index.js +11 -0
- package/dist/compiler/kit.d.ts +129 -0
- package/dist/compiler/kit.js +563 -0
- package/dist/compiler/link/build-output.d.ts +44 -0
- package/dist/compiler/link/build-output.js +147 -0
- package/dist/compiler/link/caps.d.ts +48 -0
- package/dist/compiler/link/caps.js +64 -0
- package/dist/compiler/link/context-detect.d.ts +23 -0
- package/dist/compiler/link/context-detect.js +137 -0
- package/dist/compiler/link/emit-gate.d.ts +11 -0
- package/dist/compiler/link/emit-gate.js +40 -0
- package/dist/compiler/link/entry-shim.d.ts +4 -0
- package/dist/compiler/link/entry-shim.js +29 -0
- package/dist/compiler/link/island-deps.d.ts +142 -0
- package/dist/compiler/link/island-deps.js +525 -0
- package/dist/compiler/link/manifest.d.ts +5 -0
- package/dist/compiler/link/manifest.js +9 -0
- package/dist/compiler/link/page-keys.d.ts +64 -0
- package/dist/compiler/link/page-keys.js +683 -0
- package/dist/compiler/link/registry-stub.d.ts +41 -0
- package/dist/compiler/link/registry-stub.js +212 -0
- package/dist/compiler/link/router-config.d.ts +11 -0
- package/dist/compiler/link/router-config.js +15 -0
- package/dist/compiler/link/router-css.d.ts +22 -0
- package/dist/compiler/link/router-css.js +142 -0
- package/dist/compiler/link/runtime-entry.d.ts +71 -0
- package/dist/compiler/link/runtime-entry.js +132 -0
- package/dist/compiler/link/server-manifest.d.ts +12 -0
- package/dist/compiler/link/server-manifest.js +45 -0
- package/dist/compiler/link/speculation.d.ts +17 -0
- package/dist/compiler/link/speculation.js +36 -0
- package/dist/compiler/link/transport.d.ts +31 -0
- package/dist/compiler/link/transport.js +67 -0
- package/dist/compiler/macros/bake.d.ts +20 -0
- package/dist/compiler/macros/bake.js +317 -0
- package/dist/compiler/macros/browser.d.ts +11 -0
- package/dist/compiler/macros/browser.js +69 -0
- package/dist/compiler/macros/dedent.d.ts +12 -0
- package/dist/compiler/macros/dedent.js +36 -0
- package/dist/compiler/macros/dollar.d.ts +15 -0
- package/dist/compiler/macros/dollar.js +387 -0
- package/dist/compiler/macros/pipeline.d.ts +31 -0
- package/dist/compiler/macros/pipeline.js +106 -0
- package/dist/compiler/macros/source.d.ts +6 -0
- package/dist/compiler/macros/source.js +127 -0
- package/dist/compiler/macros/store.d.ts +17 -0
- package/dist/compiler/macros/store.js +244 -0
- package/dist/compiler/macros/wire.d.ts +14 -0
- package/dist/compiler/macros/wire.js +160 -0
- package/dist/compiler/ownership-stamps.d.ts +6 -0
- package/dist/compiler/ownership-stamps.js +144 -0
- package/dist/compiler/parse/oxc.d.ts +34 -0
- package/dist/compiler/parse/oxc.js +59 -0
- package/dist/compiler/parse/scan.d.ts +43 -0
- package/dist/compiler/parse/scan.js +232 -0
- package/dist/compiler/program.d.ts +140 -0
- package/dist/compiler/program.js +242 -0
- package/dist/compiler/region/emit.d.ts +169 -0
- package/dist/compiler/region/emit.js +286 -0
- package/dist/compiler/region/identity.d.ts +28 -0
- package/dist/compiler/region/identity.js +75 -0
- package/dist/compiler/region/ir.d.ts +65 -0
- package/dist/compiler/region/ir.js +0 -0
- package/dist/compiler/region/transform.d.ts +178 -0
- package/dist/compiler/region/transform.js +1933 -0
- package/dist/compiler/script-request.d.ts +1 -0
- package/dist/compiler/script-request.js +43 -0
- package/dist/context-bridge.d.ts +65 -0
- package/dist/context-bridge.js +217 -0
- package/dist/context-registry.d.ts +40 -0
- package/dist/context-registry.js +15 -0
- package/dist/context.d.ts +72 -0
- package/dist/context.js +158 -0
- package/dist/current-region.d.ts +14 -0
- package/dist/current-region.js +36 -0
- package/dist/document.d.ts +41 -0
- package/dist/document.js +125 -0
- package/dist/entry-hydrate.d.ts +5 -0
- package/dist/entry-hydrate.js +42 -0
- package/dist/escape.d.ts +18 -0
- package/dist/escape.js +37 -0
- package/dist/events/bus.d.ts +33 -0
- package/dist/events/bus.js +153 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.js +4 -0
- package/dist/events/schema.d.ts +389 -0
- package/dist/events/schema.js +23 -0
- package/dist/events/server-registry.d.ts +7 -0
- package/dist/events/server-registry.js +13 -0
- package/dist/events/sinks.d.ts +64 -0
- package/dist/events/sinks.js +85 -0
- package/dist/fn-transport.d.ts +33 -0
- package/dist/fn-transport.js +140 -0
- package/dist/frame.d.ts +20 -0
- package/dist/frame.js +19 -0
- package/dist/holes-record.d.ts +6 -0
- package/dist/holes-record.js +8 -0
- package/dist/hooks.d.ts +43 -0
- package/dist/hooks.js +1191 -0
- package/dist/hydration-info.d.ts +1 -0
- package/dist/hydration-info.js +31 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/insights/attr-rules.d.ts +15 -0
- package/dist/insights/attr-rules.js +27 -0
- package/dist/insights/cpu.d.ts +82 -0
- package/dist/insights/cpu.js +177 -0
- package/dist/insights/fp-drift.d.ts +28 -0
- package/dist/insights/fp-drift.js +148 -0
- package/dist/insights/hole-segments.d.ts +26 -0
- package/dist/insights/hole-segments.js +50 -0
- package/dist/insights/html-diff.d.ts +25 -0
- package/dist/insights/html-diff.js +157 -0
- package/dist/insights/hydration-hazards.d.ts +36 -0
- package/dist/insights/hydration-hazards.js +136 -0
- package/dist/insights/hydration-status.d.ts +2 -0
- package/dist/insights/hydration-status.js +0 -0
- package/dist/insights/index.d.ts +14 -0
- package/dist/insights/index.js +12 -0
- package/dist/insights/page-assets.d.ts +211 -0
- package/dist/insights/page-assets.js +608 -0
- package/dist/insights/page-insights.d.ts +749 -0
- package/dist/insights/page-insights.js +2157 -0
- package/dist/insights/session-data.d.ts +108 -0
- package/dist/insights/session-data.js +0 -0
- package/dist/insights/session-insights.d.ts +121 -0
- package/dist/insights/session-insights.js +548 -0
- package/dist/insights/switch.d.ts +53 -0
- package/dist/insights/switch.js +91 -0
- package/dist/insights/testing-version.d.ts +19 -0
- package/dist/insights/testing-version.js +21 -0
- package/dist/insights/third-party.d.ts +75 -0
- package/dist/insights/third-party.js +160 -0
- package/dist/internal-instruments.d.ts +13 -0
- package/dist/internal-instruments.js +12 -0
- package/dist/internal-reconcile.d.ts +3 -0
- package/dist/internal-reconcile.js +3 -0
- package/dist/internal-register.d.ts +7 -0
- package/dist/internal-register.js +7 -0
- package/dist/internal-server.d.ts +7 -0
- package/dist/internal-server.js +7 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.js +13 -0
- package/dist/island-graph.d.ts +36 -0
- package/dist/island-graph.js +89 -0
- package/dist/keep-fallback-marker.d.ts +7 -0
- package/dist/keep-fallback-marker.js +9 -0
- package/dist/keep-fallback.d.ts +13 -0
- package/dist/keep-fallback.js +39 -0
- package/dist/kit-paths.d.ts +2 -0
- package/dist/kit-paths.js +39 -0
- package/dist/late-region-registry.d.ts +40 -0
- package/dist/late-region-registry.js +36 -0
- package/dist/live-transport.d.ts +57 -0
- package/dist/live-transport.js +145 -0
- package/dist/markup.d.ts +4 -0
- package/dist/markup.js +4 -0
- package/dist/own-package.d.ts +15 -0
- package/dist/own-package.js +20 -0
- package/dist/page-defer.d.ts +33 -0
- package/dist/page-defer.js +35 -0
- package/dist/page-facts-script.d.ts +7 -0
- package/dist/page-facts-script.js +9 -0
- package/dist/page-seed-registry.d.ts +72 -0
- package/dist/page-seed-registry.js +31 -0
- package/dist/plugin/capability.d.ts +14 -0
- package/dist/plugin/capability.js +44 -0
- package/dist/plugin/client.d.ts +39 -0
- package/dist/plugin/client.js +6 -0
- package/dist/plugin/css.d.ts +3 -0
- package/dist/plugin/css.js +54 -0
- package/dist/plugin/facts.d.ts +42 -0
- package/dist/plugin/facts.js +37 -0
- package/dist/plugin/hooks.d.ts +33 -0
- package/dist/plugin/hooks.js +38 -0
- package/dist/plugin/index.d.ts +127 -0
- package/dist/plugin/index.js +26 -0
- package/dist/plugin/routes.d.ts +32 -0
- package/dist/plugin/routes.js +35 -0
- package/dist/plugin/server.d.ts +27 -0
- package/dist/plugin/server.js +92 -0
- package/dist/plugin/standard-schema.d.ts +27 -0
- package/dist/plugin/standard-schema.js +0 -0
- package/dist/plugin/testing.d.ts +13 -0
- package/dist/plugin/testing.js +54 -0
- package/dist/plugin/utils.d.ts +13 -0
- package/dist/plugin/utils.js +19 -0
- package/dist/portable-form.d.ts +22 -0
- package/dist/portable-form.js +52 -0
- package/dist/preference.d.ts +35 -0
- package/dist/preference.js +84 -0
- package/dist/preload.d.ts +1 -0
- package/dist/preload.js +21 -0
- package/dist/ref-watch.d.ts +31 -0
- package/dist/ref-watch.js +66 -0
- package/dist/ref.d.ts +124 -0
- package/dist/ref.js +272 -0
- package/dist/region-brand.d.ts +8 -0
- package/dist/region-brand.js +10 -0
- package/dist/region-core.d.ts +2 -0
- package/dist/region-core.js +1 -0
- package/dist/region-snippet.d.ts +73 -0
- package/dist/region-snippet.js +351 -0
- package/dist/region.d.ts +127 -0
- package/dist/region.js +162 -0
- package/dist/request-event.d.ts +1 -0
- package/dist/request-event.js +37 -0
- package/dist/router-css.d.ts +39 -0
- package/dist/router-css.js +66 -0
- package/dist/runtime/app-transport.d.ts +2 -0
- package/dist/runtime/app-transport.js +13 -0
- package/dist/runtime/beacon.d.ts +271 -0
- package/dist/runtime/beacon.js +2190 -0
- package/dist/runtime/boot-link.d.ts +1 -0
- package/dist/runtime/boot-link.js +44 -0
- package/dist/runtime/client-hooks.d.ts +5 -0
- package/dist/runtime/client-hooks.js +22 -0
- package/dist/runtime/client-plugins.d.ts +8 -0
- package/dist/runtime/client-plugins.js +34 -0
- package/dist/runtime/concurrency.d.ts +12 -0
- package/dist/runtime/concurrency.js +29 -0
- package/dist/runtime/connected.d.ts +12 -0
- package/dist/runtime/connected.js +16 -0
- package/dist/runtime/context.d.ts +1 -0
- package/dist/runtime/context.js +19 -0
- package/dist/runtime/core.d.ts +15 -0
- package/dist/runtime/core.js +1173 -0
- package/dist/runtime/drift-watch.d.ts +9 -0
- package/dist/runtime/drift-watch.js +60 -0
- package/dist/runtime/entry-locations.d.ts +33 -0
- package/dist/runtime/entry-locations.js +119 -0
- package/dist/runtime/foreign-props.d.ts +8 -0
- package/dist/runtime/foreign-props.js +14 -0
- package/dist/runtime/form-continuity.d.ts +10 -0
- package/dist/runtime/form-continuity.js +107 -0
- package/dist/runtime/frame-nav.d.ts +36 -0
- package/dist/runtime/frame-nav.js +225 -0
- package/dist/runtime/frame-store.d.ts +62 -0
- package/dist/runtime/frame-store.js +214 -0
- package/dist/runtime/frames.d.ts +1 -0
- package/dist/runtime/frames.js +25 -0
- package/dist/runtime/full.d.ts +4 -0
- package/dist/runtime/full.js +32 -0
- package/dist/runtime/hash.d.ts +41 -0
- package/dist/runtime/hash.js +79 -0
- package/dist/runtime/hole-facts.d.ts +8 -0
- package/dist/runtime/hole-facts.js +57 -0
- package/dist/runtime/host-classes.d.ts +24 -0
- package/dist/runtime/host-classes.js +43 -0
- package/dist/runtime/hydrate-core.d.ts +101 -0
- package/dist/runtime/hydrate-core.js +605 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/interaction-replay.d.ts +11 -0
- package/dist/runtime/interaction-replay.js +70 -0
- package/dist/runtime/interaction.d.ts +33 -0
- package/dist/runtime/interaction.js +217 -0
- package/dist/runtime/island-graph-preload.d.ts +13 -0
- package/dist/runtime/island-graph-preload.js +99 -0
- package/dist/runtime/kit-boot.d.ts +29 -0
- package/dist/runtime/kit-boot.js +60 -0
- package/dist/runtime/kit-page-thread.svelte.d.ts +1 -0
- package/dist/runtime/kit-page-thread.svelte.js +116 -0
- package/dist/runtime/lake-anchors.d.ts +13 -0
- package/dist/runtime/lake-anchors.js +19 -0
- package/dist/runtime/lakes.d.ts +15 -0
- package/dist/runtime/lakes.js +212 -0
- package/dist/runtime/live.d.ts +3 -0
- package/dist/runtime/live.js +17 -0
- package/dist/runtime/load-scheduler.d.ts +53 -0
- package/dist/runtime/load-scheduler.js +317 -0
- package/dist/runtime/morph.d.ts +42 -0
- package/dist/runtime/morph.js +671 -0
- package/dist/runtime/nav-handle.d.ts +25 -0
- package/dist/runtime/nav-handle.js +71 -0
- package/dist/runtime/nav-hooks.d.ts +2 -0
- package/dist/runtime/nav-hooks.js +23 -0
- package/dist/runtime/nearest-attr.d.ts +4 -0
- package/dist/runtime/nearest-attr.js +16 -0
- package/dist/runtime/observe.d.ts +27 -0
- package/dist/runtime/observe.js +63 -0
- package/dist/runtime/own-cost.d.ts +9 -0
- package/dist/runtime/own-cost.js +35 -0
- package/dist/runtime/ownership.d.ts +101 -0
- package/dist/runtime/ownership.js +115 -0
- package/dist/runtime/page-cache.d.ts +23 -0
- package/dist/runtime/page-cache.js +74 -0
- package/dist/runtime/page-defer.d.ts +14 -0
- package/dist/runtime/page-defer.js +103 -0
- package/dist/runtime/parse-html.d.ts +40 -0
- package/dist/runtime/parse-html.js +81 -0
- package/dist/runtime/reconcile.d.ts +41 -0
- package/dist/runtime/reconcile.js +194 -0
- package/dist/runtime/region-attrs.d.ts +95 -0
- package/dist/runtime/region-attrs.js +153 -0
- package/dist/runtime/region-endpoint-url.d.ts +76 -0
- package/dist/runtime/region-endpoint-url.js +169 -0
- package/dist/runtime/region-ids.d.ts +8 -0
- package/dist/runtime/region-ids.js +33 -0
- package/dist/runtime/remote-seeds.d.ts +2 -0
- package/dist/runtime/remote-seeds.js +21 -0
- package/dist/runtime/render-blocking.d.ts +2 -0
- package/dist/runtime/render-blocking.js +30 -0
- package/dist/runtime/restore.d.ts +34 -0
- package/dist/runtime/restore.js +390 -0
- package/dist/runtime/router-nav.d.ts +63 -0
- package/dist/runtime/router-nav.js +740 -0
- package/dist/runtime/router.d.ts +201 -0
- package/dist/runtime/router.js +593 -0
- package/dist/runtime/schedule.d.ts +49 -0
- package/dist/runtime/schedule.js +256 -0
- package/dist/runtime/seeds.d.ts +50 -0
- package/dist/runtime/seeds.js +208 -0
- package/dist/runtime/session.d.ts +52 -0
- package/dist/runtime/session.js +130 -0
- package/dist/runtime/sidecar.d.ts +3 -0
- package/dist/runtime/sidecar.js +56 -0
- package/dist/runtime/slots.d.ts +183 -0
- package/dist/runtime/slots.js +44 -0
- package/dist/runtime/spa-cacheable.d.ts +7 -0
- package/dist/runtime/spa-cacheable.js +18 -0
- package/dist/runtime/speculate-hint.d.ts +1 -0
- package/dist/runtime/speculate-hint.js +35 -0
- package/dist/runtime/svelte-warnings.d.ts +28 -0
- package/dist/runtime/svelte-warnings.js +71 -0
- package/dist/runtime/wire-classes.d.ts +3 -0
- package/dist/runtime/wire-classes.js +69 -0
- package/dist/runtime/wire-format.d.ts +7 -0
- package/dist/runtime/wire-format.js +22 -0
- package/dist/script.d.ts +134 -0
- package/dist/script.js +184 -0
- package/dist/seed-refs.d.ts +105 -0
- package/dist/seed-refs.js +487 -0
- package/dist/server/capability-lifetime.d.ts +28 -0
- package/dist/server/capability-lifetime.js +31 -0
- package/dist/server/dead-kit-resolves.d.ts +1 -0
- package/dist/server/dead-kit-resolves.js +39 -0
- package/dist/server/document-assembly.d.ts +30 -0
- package/dist/server/document-assembly.js +26 -0
- package/dist/server/document-tail.d.ts +113 -0
- package/dist/server/document-tail.js +208 -0
- package/dist/server/endpoint.d.ts +51 -0
- package/dist/server/endpoint.js +90 -0
- package/dist/server/entry-location.d.ts +8 -0
- package/dist/server/entry-location.js +29 -0
- package/dist/server/fingerprint.d.ts +1 -0
- package/dist/server/fingerprint.js +25 -0
- package/dist/server/head-presence.d.ts +45 -0
- package/dist/server/head-presence.js +156 -0
- package/dist/server/hmac.d.ts +38 -0
- package/dist/server/hmac.js +89 -0
- package/dist/server/hole-graph.d.ts +7 -0
- package/dist/server/hole-graph.js +71 -0
- package/dist/server/hole-urls.d.ts +3 -0
- package/dist/server/hole-urls.js +76 -0
- package/dist/server/html-scan.d.ts +19 -0
- package/dist/server/html-scan.js +60 -0
- package/dist/server/kit-context.d.ts +78 -0
- package/dist/server/kit-context.js +110 -0
- package/dist/server/late-wire.d.ts +22 -0
- package/dist/server/late-wire.js +28 -0
- package/dist/server/page-facts.d.ts +25 -0
- package/dist/server/page-facts.js +138 -0
- package/dist/server/page-seed.d.ts +33 -0
- package/dist/server/page-seed.js +60 -0
- package/dist/server/page-stream.d.ts +55 -0
- package/dist/server/page-stream.js +121 -0
- package/dist/server/payload.d.ts +6 -0
- package/dist/server/payload.js +22 -0
- package/dist/server/personal-response.d.ts +6 -0
- package/dist/server/personal-response.js +13 -0
- package/dist/server/props-wire.d.ts +56 -0
- package/dist/server/props-wire.js +178 -0
- package/dist/server/rate-limit.d.ts +22 -0
- package/dist/server/rate-limit.js +63 -0
- package/dist/server/region-css.d.ts +5 -0
- package/dist/server/region-css.js +30 -0
- package/dist/server/region-endpoint.d.ts +35 -0
- package/dist/server/region-endpoint.js +142 -0
- package/dist/server/region-props.d.ts +6 -0
- package/dist/server/region-props.js +44 -0
- package/dist/server/remote-seed-gate.d.ts +50 -0
- package/dist/server/remote-seed-gate.js +66 -0
- package/dist/server/render-cache.d.ts +26 -0
- package/dist/server/render-cache.js +51 -0
- package/dist/server/render-page.d.ts +51 -0
- package/dist/server/render-page.js +176 -0
- package/dist/server/render-region-html.d.ts +2 -0
- package/dist/server/render-region-html.js +19 -0
- package/dist/server/request-stats.d.ts +174 -0
- package/dist/server/request-stats.js +54 -0
- package/dist/server/reversible.d.ts +83 -0
- package/dist/server/reversible.js +994 -0
- package/dist/server/seed-shape.d.ts +22 -0
- package/dist/server/seed-shape.js +24 -0
- package/dist/server/shared-cache.d.ts +35 -0
- package/dist/server/shared-cache.js +104 -0
- package/dist/server/signing-key.d.ts +11 -0
- package/dist/server/signing-key.js +47 -0
- package/dist/server/sized-lru.d.ts +20 -0
- package/dist/server/sized-lru.js +68 -0
- package/dist/server/split-regions.d.ts +81 -0
- package/dist/server/split-regions.js +368 -0
- package/dist/server/stream-regions.d.ts +5 -0
- package/dist/server/stream-regions.js +36 -0
- package/dist/shared-state.d.ts +7 -0
- package/dist/shared-state.js +152 -0
- package/dist/shims/app-environment.d.ts +4 -0
- package/dist/shims/app-environment.js +6 -0
- package/dist/shims/app-navigation.d.ts +33 -0
- package/dist/shims/app-navigation.js +119 -0
- package/dist/shims/app-paths.d.ts +6 -0
- package/dist/shims/app-paths.js +18 -0
- package/dist/shims/app-state.svelte.d.ts +23 -0
- package/dist/shims/app-state.svelte.js +50 -0
- package/dist/shims/app-stores.d.ts +21 -0
- package/dist/shims/app-stores.js +54 -0
- package/dist/shims/kit-bridge.d.ts +29 -0
- package/dist/shims/kit-bridge.js +7 -0
- package/dist/shims/kit-remote/client-stub.d.ts +27 -0
- package/dist/shims/kit-remote/client-stub.js +43 -0
- package/dist/shims/kit-remote/paths-internal-stub.d.ts +3 -0
- package/dist/shims/kit-remote/paths-internal-stub.js +5 -0
- package/dist/shims/kit-remote/remote-cache.d.ts +49 -0
- package/dist/shims/kit-remote/remote-cache.js +73 -0
- package/dist/shims/kit-remote/state-stub.d.ts +8 -0
- package/dist/shims/kit-remote/state-stub.js +8 -0
- package/dist/shims/page-store.svelte.d.ts +39 -0
- package/dist/shims/page-store.svelte.js +77 -0
- package/dist/source.d.ts +29 -0
- package/dist/source.js +87 -0
- package/dist/store-transport.d.ts +86 -0
- package/dist/store-transport.js +229 -0
- package/dist/tool-fetches.d.ts +5 -0
- package/dist/tool-fetches.js +41 -0
- package/dist/transport.d.ts +48 -0
- package/dist/transport.js +181 -0
- package/dist/unscoped-css.d.ts +26 -0
- package/dist/unscoped-css.js +53 -0
- package/dist/vite/dev-maps.d.ts +33 -0
- package/dist/vite/dev-maps.js +140 -0
- package/dist/vite/index.d.ts +19 -0
- package/dist/vite/index.js +820 -0
- package/dist/vite/kit-dirs.d.ts +7 -0
- package/dist/vite/kit-dirs.js +67 -0
- package/dist/vite/late-island.d.ts +25 -0
- package/dist/vite/late-island.js +33 -0
- package/dist/vite/module-map.d.ts +8 -0
- package/dist/vite/module-map.js +144 -0
- package/dist/vite/options.d.ts +208 -0
- package/dist/vite/options.js +74 -0
- package/dist/vite/package-files.d.ts +3 -0
- package/dist/vite/package-files.js +84 -0
- package/dist/vite/paths.d.ts +45 -0
- package/dist/vite/paths.js +112 -0
- package/dist/vite/plugin-api.d.ts +166 -0
- package/dist/vite/plugin-api.js +212 -0
- package/dist/vite/profiler-maps.d.ts +23 -0
- package/dist/vite/profiler-maps.js +178 -0
- package/dist/vite/server-sourcemaps.d.ts +8 -0
- package/dist/vite/server-sourcemaps.js +80 -0
- package/dist/vite/sourcemaps.d.ts +18 -0
- package/dist/vite/sourcemaps.js +80 -0
- package/dist/vite/style-preprocess.d.ts +2 -0
- package/dist/vite/style-preprocess.js +96 -0
- package/package.json +180 -6
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { parse_module } from "../parse/oxc.js";
|
|
2
|
+
// src/compiler/content/transportables.ts
|
|
3
|
+
/**
|
|
4
|
+
* Registration for transportable classes (`static [import.meta.og.wire]` codecs).
|
|
5
|
+
*
|
|
6
|
+
* Registers ONLY exported classes that actually carry a wire codec — NOT every exported class.
|
|
7
|
+
* A plain `export class Foo {}` must never be registered, because the registration appends an
|
|
8
|
+
* `import … from 'ogygia/internal/register'`, and dragging that into an unrelated module (or a
|
|
9
|
+
* workspace package that doesn't even depend on ogygia) breaks its resolution for nothing.
|
|
10
|
+
* Detection is exact, not heuristic: by the time this runs the wire macro has already normalized
|
|
11
|
+
* `static wire = import.meta.og.wire(…)` into `static [Symbol.for('ogygia.wire')] = …`, so a class
|
|
12
|
+
* is transportable iff it has that member (the pre-rewrite call form is matched too, defensively).
|
|
13
|
+
* The macro is name-locked to `static wire`, so there is exactly one shape to find — no aliasing.
|
|
14
|
+
*
|
|
15
|
+
* Tags are root-relative module path + export name: identical in the server build and every
|
|
16
|
+
* island bundle with zero coordination. Registrations import from `ogygia/internal` — a
|
|
17
|
+
* re-export barrel, so tree-shaking keeps island component code out of a tagged `.svelte.ts`
|
|
18
|
+
* state chunk.
|
|
19
|
+
*
|
|
20
|
+
* Constraint: a top-level `export class X` (declaration or `export { X }`). Default exports
|
|
21
|
+
* and class expressions have no stable name to tag by.
|
|
22
|
+
*/
|
|
23
|
+
const CLASS_KW = /\bclass\b/;
|
|
24
|
+
const WIRE_STATIC_MEMBER = /\bstatic\s+#?\w+\s*=\s*import\.meta\.og\.wire\b/;
|
|
25
|
+
const MODULE_KW = /\bmodule\b/;
|
|
26
|
+
const CONTEXT_MODULE_ATTR = /context\s*=\s*["']module["']/;
|
|
27
|
+
const SVELTE_EXT = /\.svelte$/;
|
|
28
|
+
/** Every `<script …>…<\/script>` block (shared `g` regex — reset `lastIndex` per scan). */
|
|
29
|
+
const SCRIPT_BLOCK_G = /<script\b([^>]*)>([\s\S]*?)<\/script>/g;
|
|
30
|
+
/** Marker that a module already carries generated registrations (idempotence). */
|
|
31
|
+
const GENERATED_MARK = "// ogygia: generated registration (transportable codecs + createContext tags)";
|
|
32
|
+
/** Parse a module to its top-level statements once (TS/JS inferred from `id_n`); null on error. */
|
|
33
|
+
function parse_body(code, id_n) {
|
|
34
|
+
try {
|
|
35
|
+
const result = parse_module(code, id_n);
|
|
36
|
+
if (!result.ok || !result.program) return null;
|
|
37
|
+
return result.program.body ?? [];
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Collect names of top-level exported classes that carry a wire codec (and only those). */
|
|
43
|
+
function exportedWireClassNames(code, id_n) {
|
|
44
|
+
const body = parse_body(code, id_n);
|
|
45
|
+
return body ? exportedWireClassNamesFromBody(body) : [];
|
|
46
|
+
}
|
|
47
|
+
function exportedWireClassNamesFromBody(body) {
|
|
48
|
+
const classNodes = /* @__PURE__ */ new Map();
|
|
49
|
+
const exported = /* @__PURE__ */ new Set();
|
|
50
|
+
for (const node of body) if (node.type === "ClassDeclaration" && node.id) classNodes.set(node.id.name, node);
|
|
51
|
+
else if (node.type === "ExportNamedDeclaration") {
|
|
52
|
+
if (node.declaration?.type === "ClassDeclaration" && node.declaration.id?.name) {
|
|
53
|
+
classNodes.set(node.declaration.id.name, node.declaration);
|
|
54
|
+
exported.add(node.declaration.id.name);
|
|
55
|
+
}
|
|
56
|
+
if (!node.source) {
|
|
57
|
+
for (const spec of node.specifiers ?? []) if (spec.local?.type === "Identifier") exported.add(spec.local.name);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return [...exported].filter((name) => {
|
|
61
|
+
const cls = classNodes.get(name);
|
|
62
|
+
return !!cls && classHasWireMember(cls);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A class carrying a wire codec. Post-macro (the usual case here — macros run before this pass):
|
|
67
|
+
* `static [Symbol.for('ogygia.wire')] = …`. Pre-macro, defensively: `static <name> =
|
|
68
|
+
* import.meta.og.wire(…)`. Anything else is a plain class and must NOT be registered.
|
|
69
|
+
*/
|
|
70
|
+
function classHasWireMember(cls) {
|
|
71
|
+
return (cls.body?.body ?? []).some((m) => {
|
|
72
|
+
if (m.static !== true) return false;
|
|
73
|
+
if (m.computed === true && isWireSymbolKey(m.key)) return true;
|
|
74
|
+
return isWireMacroCall(m.value);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** `Symbol.for('ogygia.wire')` — the computed key the wire macro emits. */
|
|
78
|
+
function isWireSymbolKey(key) {
|
|
79
|
+
const k = key;
|
|
80
|
+
if (k?.type !== "CallExpression") return false;
|
|
81
|
+
const callee = k.callee;
|
|
82
|
+
if (callee?.type !== "MemberExpression" || callee.object?.name !== "Symbol" || callee.property?.name !== "for") return false;
|
|
83
|
+
const arg = k.arguments?.[0];
|
|
84
|
+
return !!arg && (arg.type === "StringLiteral" || arg.type === "Literal") && arg.value === "ogygia.wire";
|
|
85
|
+
}
|
|
86
|
+
/** `import.meta.og.wire(…)` — the raw construct, before the macro rewrites it to the symbol key. */
|
|
87
|
+
function isWireMacroCall(value) {
|
|
88
|
+
const v = value;
|
|
89
|
+
if (v?.type !== "CallExpression") return false;
|
|
90
|
+
const callee = v.callee;
|
|
91
|
+
if (callee?.type !== "MemberExpression" || callee.computed || callee.property?.name !== "wire") return false;
|
|
92
|
+
const og = callee.object;
|
|
93
|
+
if (og?.type !== "MemberExpression" || og.computed || og.property?.name !== "og") return false;
|
|
94
|
+
const meta = og.object;
|
|
95
|
+
return meta?.type === "MetaProperty" && meta.meta?.name === "import" && meta.property?.name === "meta";
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Exported consts whose initializer is a `createContext(...)` call — `export const cart =
|
|
99
|
+
* createContext<Cart>()`. Tagged by `module#export` so a provider and every consumer island agree
|
|
100
|
+
* on the context identity (same alias-proof scheme as `wire`). Covers `createContext(...)` and
|
|
101
|
+
* `<ns>.createContext(...)`.
|
|
102
|
+
*/
|
|
103
|
+
function contextExportNamesFromBody(body) {
|
|
104
|
+
const names = [];
|
|
105
|
+
for (const node of body) {
|
|
106
|
+
if (node.type !== "ExportNamedDeclaration") continue;
|
|
107
|
+
const decl = node.declaration;
|
|
108
|
+
if (!decl || decl.type !== "VariableDeclaration") continue;
|
|
109
|
+
for (const d of decl.declarations ?? []) {
|
|
110
|
+
const init = d.init;
|
|
111
|
+
if (d.id?.type !== "Identifier" || !d.id.name || init?.type !== "CallExpression") continue;
|
|
112
|
+
const callee = init.callee;
|
|
113
|
+
if (callee?.type === "Identifier" && callee.name === "createContext" || callee?.type === "MemberExpression" && callee.property?.name === "createContext") names.push(d.id.name);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return names;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Does this module define an exported class carrying a transportable codec? Used to build
|
|
120
|
+
* the eager-registration manifest so islands never need a manual `import` of the class.
|
|
121
|
+
*
|
|
122
|
+
* Signal: an exported class with a `static` member whose key is COMPUTED (`static [x] = …` /
|
|
123
|
+
* `static [x]() {}`) — every rewritten wire member is exactly that — OR, pre-rewrite, the
|
|
124
|
+
* `import.meta.og.wire` construct marker (prescan reads RAW source, where the blessed spelling
|
|
125
|
+
* `static wire = import.meta.og.wire()` is not yet a computed member). A false positive (an
|
|
126
|
+
* unrelated computed static, the marker in a comment) only eagerly loads one extra module; a
|
|
127
|
+
* transportable class is never missed.
|
|
128
|
+
*/
|
|
129
|
+
function moduleHasTransportable(code, id_n) {
|
|
130
|
+
if (!CLASS_KW.test(code) || !code.includes("static")) return false;
|
|
131
|
+
if (WIRE_STATIC_MEMBER.test(code)) return true;
|
|
132
|
+
let body;
|
|
133
|
+
try {
|
|
134
|
+
const result = parse_module(code, id_n);
|
|
135
|
+
if (!result.ok || !result.program) return false;
|
|
136
|
+
body = result.program.body ?? [];
|
|
137
|
+
} catch {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
const isTransportableClass = (cls) => {
|
|
141
|
+
return ((cls?.body)?.body ?? []).some((m) => m.static === true && m.computed === true);
|
|
142
|
+
};
|
|
143
|
+
for (const node of body) {
|
|
144
|
+
if (node.type === "ClassDeclaration" && isTransportableClass(node)) return true;
|
|
145
|
+
if (node.type === "ExportNamedDeclaration" && node.declaration?.type === "ClassDeclaration" && isTransportableClass(node.declaration)) return true;
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Append `__register_transportable` calls for every exported class in this module. Returns
|
|
151
|
+
* the augmented code, or null when there is no exported class. Append-only — the module's
|
|
152
|
+
* existing sourcemap stays valid.
|
|
153
|
+
*/
|
|
154
|
+
function appendTransportRegistrations(code, id_n, root, pathModule) {
|
|
155
|
+
if (code.includes(GENERATED_MARK)) return null;
|
|
156
|
+
const maybeClass = CLASS_KW.test(code);
|
|
157
|
+
const maybeCtx = code.includes("createContext");
|
|
158
|
+
if (!maybeClass && !maybeCtx) return null;
|
|
159
|
+
const body = parse_body(code, id_n);
|
|
160
|
+
if (!body) return null;
|
|
161
|
+
const classes = maybeClass ? exportedWireClassNamesFromBody(body) : [];
|
|
162
|
+
const contexts = maybeCtx ? contextExportNamesFromBody(body) : [];
|
|
163
|
+
if (classes.length === 0 && contexts.length === 0) return null;
|
|
164
|
+
return code + registrationBlock(pathModule.relative(root, id_n).split("\\").join("/"), classes, contexts) + "\n";
|
|
165
|
+
}
|
|
166
|
+
function registrationBlock(rel, classes, contexts) {
|
|
167
|
+
const imports = [];
|
|
168
|
+
if (classes.length) imports.push("__register_transportable as __OGT");
|
|
169
|
+
if (contexts.length) imports.push("__tag_context as __OGC");
|
|
170
|
+
const lines = [
|
|
171
|
+
"",
|
|
172
|
+
"// ogygia: generated registration (transportable codecs + createContext tags)",
|
|
173
|
+
`import { ${imports.join(", ")} } from 'ogygia/internal/register';`
|
|
174
|
+
];
|
|
175
|
+
for (const name of classes) lines.push(`__OGT(${JSON.stringify(rel + "#" + name)}, ${name});`);
|
|
176
|
+
for (const name of contexts) lines.push(`__OGC(${JSON.stringify(rel + "#" + name)}, ${name});`);
|
|
177
|
+
return lines.join("\n");
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* A `.svelte` component can `export class X` from its `<script module>` (instance-`<script>`
|
|
181
|
+
* classes can't be exported, so they never travel). Find the module script and treat its
|
|
182
|
+
* body like any other module: same detection, same registration, injected before the block's
|
|
183
|
+
* closing tag. The class is tagged by the `.svelte` path, and the manifest side-effect-imports
|
|
184
|
+
* the component to run that registration on the client.
|
|
185
|
+
*/
|
|
186
|
+
function moduleScriptOf(code) {
|
|
187
|
+
SCRIPT_BLOCK_G.lastIndex = 0;
|
|
188
|
+
let m;
|
|
189
|
+
while ((m = SCRIPT_BLOCK_G.exec(code)) !== null) {
|
|
190
|
+
const attrs = m[1];
|
|
191
|
+
if (MODULE_KW.test(attrs) || CONTEXT_MODULE_ATTR.test(attrs)) {
|
|
192
|
+
const bodyStart = m.index + m[0].indexOf(">", 0) + 1;
|
|
193
|
+
const bodyEnd = SCRIPT_BLOCK_G.lastIndex - 9;
|
|
194
|
+
return {
|
|
195
|
+
body: code.slice(bodyStart, bodyEnd),
|
|
196
|
+
injectAt: bodyEnd
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
/** True if a `.svelte` file's `<script module>` exports a transportable class. */
|
|
203
|
+
function svelteModuleHasTransportable(code, id_n) {
|
|
204
|
+
if (!code.includes("module") || !CLASS_KW.test(code)) return false;
|
|
205
|
+
const mod = moduleScriptOf(code);
|
|
206
|
+
if (!mod) return false;
|
|
207
|
+
return moduleHasTransportable(mod.body, id_n.replace(SVELTE_EXT, ".svelte.ts"));
|
|
208
|
+
}
|
|
209
|
+
/** Inject registration for a `.svelte` module script's exported transportable classes. */
|
|
210
|
+
function appendSvelteModuleRegistrations(code, id_n, root, pathModule) {
|
|
211
|
+
if (code.includes(GENERATED_MARK) || !CLASS_KW.test(code)) return null;
|
|
212
|
+
const mod = moduleScriptOf(code);
|
|
213
|
+
if (!mod) return null;
|
|
214
|
+
const exported = exportedWireClassNames(mod.body, id_n.replace(SVELTE_EXT, ".svelte.ts"));
|
|
215
|
+
if (exported.length === 0) return null;
|
|
216
|
+
const block = "\n" + registrationBlock(pathModule.relative(root, id_n).split("\\").join("/"), exported, []) + "\n";
|
|
217
|
+
return code.slice(0, mod.injectAt) + block + code.slice(mod.injectAt);
|
|
218
|
+
}
|
|
219
|
+
export { appendSvelteModuleRegistrations, appendTransportRegistrations, moduleHasTransportable, svelteModuleHasTransportable };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { ServerRealm } from "./link/caps.js";
|
|
2
|
+
import { PluginMacro } from "./macros/pipeline.js";
|
|
3
|
+
import { ImportKeys } from "./region/transform.js";
|
|
4
|
+
/** One dependency package's declared compile surface (`"ogygia": { "files": […] }` in ITS
|
|
5
|
+
* package.json) — produced by the plugin's discovery (`vite/package-files.ts`), consumed here
|
|
6
|
+
* type-only: the compiler stays browser-host-clean, so the node:fs/glob work lives plugin-side.
|
|
7
|
+
* All paths are posix REALPATHS — Vite resolves ids through symlinks (pnpm), so gate matching
|
|
8
|
+
* must speak real paths or every check silently misses. */
|
|
9
|
+
export interface PackageScan {
|
|
10
|
+
/** The package's published name — the stable identity prefix for its regions. */
|
|
11
|
+
name: string;
|
|
12
|
+
/** realpath of the package root. */
|
|
13
|
+
root: string;
|
|
14
|
+
/** Declared bare directories (prefix-matched, so files added mid-dev still count). */
|
|
15
|
+
dirs: string[];
|
|
16
|
+
/** Individually declared / glob-expanded files. */
|
|
17
|
+
files: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface CompileCtxInit {
|
|
20
|
+
root: string;
|
|
21
|
+
base: string;
|
|
22
|
+
/** SvelteKit `config.kit.appDir` (default `_app`) — the dir Kit emits AND serves its immutable
|
|
23
|
+
* assets under. ogygia's runtime + island chunks MUST land here too: a custom appDir otherwise
|
|
24
|
+
* 404s them (Kit's adapter only maps `<appDir>/immutable/*` to the immutable-cache route). Read
|
|
25
|
+
* from Kit's `__SVELTEKIT_APP_DIR__` build define; `_app` when Kit isn't present (standalone).
|
|
26
|
+
* NOTE: only the app-internal PATH lives here. `base` / `paths.assets` (CDN) resolution is Kit's
|
|
27
|
+
* `asset()`'s job — `Region.svelte` runs every baked entry / runtime URL through it at SSR — so
|
|
28
|
+
* ogygia never bakes a base into these URLs (doing so double-applies it). */
|
|
29
|
+
app_dir: string;
|
|
30
|
+
libDir: string;
|
|
31
|
+
/** A plugin asked for the build's measurement data (`b.measure()`: the profiler) — embedded maps,
|
|
32
|
+
* per-island detail. */
|
|
33
|
+
measure: boolean;
|
|
34
|
+
/** The server halves of the app's plugins (module path + options), in app order — baked into
|
|
35
|
+
* `virtual:ogygia/server-plugins`. Optional (default none). */
|
|
36
|
+
server_plugins?: readonly ServerRealm[];
|
|
37
|
+
/** The browser halves of the app's plugins (absolute module paths), in app order —
|
|
38
|
+
* imported by the runtime's boot. Optional (default none). */
|
|
39
|
+
client_plugins?: readonly string[];
|
|
40
|
+
/** The keys the plugins claim inside Kit's `config` page option (`b.routeConfig`) — read from the
|
|
41
|
+
* route files and baked into `virtual:ogygia/route-config`. Optional (default none). */
|
|
42
|
+
route_config?: readonly string[];
|
|
43
|
+
/** A plugin asked island entries to keep their foreign-hydrate exports (`b.foreignHydrate()`:
|
|
44
|
+
* another app's runtime wakes this app's islands). Optional (default off). */
|
|
45
|
+
foreign_hydrate?: boolean;
|
|
46
|
+
/** Dependency packages that DECLARED their ogygia compile surface (`"ogygia": { "files": […] }`
|
|
47
|
+
* in THEIR package.json) — prescanned + transformed like app source, node_modules gates lifted
|
|
48
|
+
* for exactly these paths. Optional (default none): standalone/browser hosts have no
|
|
49
|
+
* node_modules to declare from. */
|
|
50
|
+
pkg_scan?: PackageScan[];
|
|
51
|
+
/** PAGE MODULES (`b.pageModules()`): modules that render pages outside Kit's routes, whose reachable
|
|
52
|
+
* components get router-css. `page_importers`: a compiled module importing one of these specifiers
|
|
53
|
+
* is one; `page_files`: absolute paths that are page modules themselves. Optional (default none). */
|
|
54
|
+
page_importers?: readonly string[];
|
|
55
|
+
page_files?: readonly string[];
|
|
56
|
+
is_dev: boolean;
|
|
57
|
+
id_salt: string;
|
|
58
|
+
visibleMargin: string | undefined;
|
|
59
|
+
presets: Record<string, unknown>;
|
|
60
|
+
import_keys: ImportKeys;
|
|
61
|
+
/** Resolved Vite aliases (used by the `bake` macro to bundle the imports a baked fn touches). */
|
|
62
|
+
resolve_alias: unknown[];
|
|
63
|
+
/** The plugins' `import.meta.og.*` macros (`b.macro`), in plugin order. Optional (default none). */
|
|
64
|
+
macros?: readonly PluginMacro[];
|
|
65
|
+
/** ogygia's own package root — the `auto_brand` macro skips ogygia source (it can't self-register). */
|
|
66
|
+
pkg_root: string;
|
|
67
|
+
/** Per-build HMAC material baked into the SSR-only `virtual:ogygia/secret`. */
|
|
68
|
+
build_secret: string;
|
|
69
|
+
/** Region-endpoint rate limit (SSR-only), `{ max: 0 }` when disabled. */
|
|
70
|
+
rate_limit: {
|
|
71
|
+
max: number;
|
|
72
|
+
windowMs: number;
|
|
73
|
+
};
|
|
74
|
+
/** Cookie name sealed into the region MAC, or '' when unbound. */
|
|
75
|
+
session_cookie: string;
|
|
76
|
+
/** Capability-URL TTL in seconds. */
|
|
77
|
+
region_ttl: number;
|
|
78
|
+
/** How long after expiry an anonymous capability still renews, in seconds (`0` = never). */
|
|
79
|
+
renew_window: number;
|
|
80
|
+
/** Router on (app-wide). `false` tree-shakes the feature out. */
|
|
81
|
+
router_enabled: boolean;
|
|
82
|
+
/** View Transitions on for SPA navs. */
|
|
83
|
+
router_view_transitions: boolean;
|
|
84
|
+
/** The app's `src/hooks.client.{ts,js}` absolute path, or null — its `init` runs on boot for
|
|
85
|
+
* csr=false pages (see runtime/client-hooks.ts). */
|
|
86
|
+
client_hooks?: string | null;
|
|
87
|
+
/** Package-internal absolute paths the emit inlines into generated virtual sources. */
|
|
88
|
+
runtime_dir: string;
|
|
89
|
+
runtime_hash: string;
|
|
90
|
+
hmac_module: string;
|
|
91
|
+
region_endpoint_module: string;
|
|
92
|
+
client_binding_stub_file: string;
|
|
93
|
+
/** `$app/*` → on-disk client-shim path map (island modules under csr=false). */
|
|
94
|
+
app_shims: Record<string, string>;
|
|
95
|
+
/** `command === 'build'` — gates the transform-time deterministic island-chunk emit. */
|
|
96
|
+
is_build: boolean;
|
|
97
|
+
/** Core's event emits compiled in (a plugin's `b.events()`: devtools). Bakes the standalone dock
|
|
98
|
+
* boot for csr=true pages into `virtual:ogygia/devtools-boot-url`. */
|
|
99
|
+
devtools: boolean;
|
|
100
|
+
}
|
|
101
|
+
export declare class CompileCtx {
|
|
102
|
+
#private;
|
|
103
|
+
readonly root: string;
|
|
104
|
+
readonly base: string;
|
|
105
|
+
readonly app_dir: string;
|
|
106
|
+
readonly libDir: string;
|
|
107
|
+
readonly pkg_scan: PackageScan[];
|
|
108
|
+
readonly page_importers: readonly string[];
|
|
109
|
+
readonly page_files: readonly string[];
|
|
110
|
+
readonly measure: boolean;
|
|
111
|
+
readonly server_plugins: readonly ServerRealm[];
|
|
112
|
+
readonly client_plugins: readonly string[];
|
|
113
|
+
readonly route_config: readonly string[];
|
|
114
|
+
readonly foreign_hydrate: boolean;
|
|
115
|
+
readonly is_dev: boolean;
|
|
116
|
+
readonly id_salt: string;
|
|
117
|
+
readonly visibleMargin: string | undefined;
|
|
118
|
+
readonly presets: Record<string, unknown>;
|
|
119
|
+
readonly import_keys: ImportKeys;
|
|
120
|
+
readonly resolve_alias: unknown[];
|
|
121
|
+
readonly macros: readonly PluginMacro[];
|
|
122
|
+
readonly pkg_root: string;
|
|
123
|
+
readonly build_secret: string;
|
|
124
|
+
readonly rate_limit: {
|
|
125
|
+
max: number;
|
|
126
|
+
windowMs: number;
|
|
127
|
+
};
|
|
128
|
+
readonly session_cookie: string;
|
|
129
|
+
readonly region_ttl: number;
|
|
130
|
+
readonly renew_window: number;
|
|
131
|
+
readonly router_enabled: boolean;
|
|
132
|
+
readonly router_view_transitions: boolean;
|
|
133
|
+
readonly client_hooks: string | null;
|
|
134
|
+
readonly runtime_dir: string;
|
|
135
|
+
readonly runtime_hash: string;
|
|
136
|
+
readonly hmac_module: string;
|
|
137
|
+
readonly region_endpoint_module: string;
|
|
138
|
+
readonly client_binding_stub_file: string;
|
|
139
|
+
readonly app_shims: Record<string, string>;
|
|
140
|
+
readonly is_build: boolean;
|
|
141
|
+
readonly devtools: boolean;
|
|
142
|
+
constructor(init: CompileCtxInit);
|
|
143
|
+
/** True when `code` carries an ogygia `with { … }` island hint (gates node_modules `.svelte`). */
|
|
144
|
+
has_island_hint(code: string): boolean;
|
|
145
|
+
/** True when a JS module has a real `import … with { <mark key>: … }` declaration. The hint
|
|
146
|
+
* above is a text sniff, so it also matches a comment, a string or generated code that merely
|
|
147
|
+
* mentions `with { wake }`; this parses. A module that does not parse counts as marked, so a
|
|
148
|
+
* warning that depends on it errs toward speaking. */
|
|
149
|
+
has_marked_import(code: string, id: string): boolean;
|
|
150
|
+
/** True when `id` is inside a dependency's DECLARED `ogygia.files` surface — those files are
|
|
151
|
+
* prescanned + transformed exactly like app source (the node_modules gates lift for them). */
|
|
152
|
+
in_declared_pkg(id: string): boolean;
|
|
153
|
+
/** Install-independent region identity for a file under a declared package: `<name>/<rel>`.
|
|
154
|
+
* Store paths carry version + peer-resolution hashes (`node_modules/.pnpm/pkg@1.2.3(...)`),
|
|
155
|
+
* so a root-relative identity would change per install/machine and prod HTML would stop
|
|
156
|
+
* matching its chunks. Returns `null` for anything not under a declared package root. */
|
|
157
|
+
pkg_identity(abs: string): string | null;
|
|
158
|
+
/** The runtime's feature set, as a name segment: the prescan's feature hash, and a trailing `h` when
|
|
159
|
+
* the app has `hooks.client.ts` (the runtime entry then dynamic-imports it). Empty until prescan
|
|
160
|
+
* runs. Both the stable name and the content-hashed file carry it, so a name says which runtime. */
|
|
161
|
+
runtime_features(program_feature_hash: string): string;
|
|
162
|
+
/** The runtime's STABLE name (`RUNTIME_HASH` ⊕ its features): its identity — the key the handoff
|
|
163
|
+
* maps to the content-hashed file the page loads — and the name of that file's shim. Computed here
|
|
164
|
+
* (not the caller) so both build legs name it identically. `program_feature_hash` is
|
|
165
|
+
* `Program.runtime_feature_hash`, threaded in by the caller so this stays a pure naming function. */
|
|
166
|
+
runtime_chunk_filename(program_feature_hash: string): string;
|
|
167
|
+
/** App-internal URL of the runtime chunk (leading slash + appDir; NO base). SSR bakes it as the
|
|
168
|
+
* `<script src>`, then `asset()` prepends base / the assets CDN at render time. */
|
|
169
|
+
runtime_chunk_url(program_feature_hash: string): string;
|
|
170
|
+
/** Output filename for a hydrate island chunk (under the app dir; an on-disk build path). */
|
|
171
|
+
island_chunk_filename(iid: string): string;
|
|
172
|
+
/** App-internal URL of a hydrate island chunk (leading slash + appDir; NO base — `asset()` adds it). */
|
|
173
|
+
island_public_url(iid: string): string;
|
|
174
|
+
/** Read a file as UTF-8, or `null` if it can't be read (the transform tolerates missing deps). */
|
|
175
|
+
read_file(abs: string): string | null;
|
|
176
|
+
/** Virtual island ENTRY module id for an island id. */
|
|
177
|
+
island_virtual_id(iid: string): string;
|
|
178
|
+
/** Virtual wrapper `.svelte` module id for an island id. */
|
|
179
|
+
wrapper_virtual_id(iid: string): string;
|
|
180
|
+
/** Dev URL for a dynamic `import(entry)` of a virtual island module. Base-LESS, exactly like the
|
|
181
|
+
* prod island/runtime URLs and the dev runtime URL: `Region.svelte` runs it through Kit's `asset()`
|
|
182
|
+
* at SSR, which is the sole base authority. Baking `base` here would double it (Vite dev serves
|
|
183
|
+
* `/@id/…` UNDER base, and `asset()` already adds that prefix). */
|
|
184
|
+
dev_url_for(virtualPath: string): string;
|
|
185
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { fs } from "./host.js";
|
|
2
|
+
import { strip_bom } from "./bom.js";
|
|
3
|
+
import { islandVirtualId } from "./ids.js";
|
|
4
|
+
import { parse_module } from "./parse/oxc.js";
|
|
5
|
+
import { islandChunkFileName, islandPublicUrl, wrapperVirtualId } from "./region/transform.js";
|
|
6
|
+
// src/compiler/ctx.ts
|
|
7
|
+
/**
|
|
8
|
+
* `CompileCtx` — the resolved compile context: the config the transform phase reads, plus its
|
|
9
|
+
* derived naming accessors. A plain data holder constructed once the bundler has resolved the build
|
|
10
|
+
* (root / dev / …) and the options are normalized (importKeys / presets / …). It is the config half
|
|
11
|
+
* of the driver's session; the `Compiler` carries it into `transform()` so that phase never reaches
|
|
12
|
+
* back into the Vite adapter — which is what keeps the driver bundler-agnostic (a future REPL feeds
|
|
13
|
+
* a `CompileCtx` + source and gets the same lowering, no Vite in sight).
|
|
14
|
+
*/
|
|
15
|
+
/** Windows separators → posix, for id matching against the (posix) declared-path index. */
|
|
16
|
+
const BACKSLASH_SEP = /\\/;
|
|
17
|
+
/** Matches nothing — the island-hint probe when no import keys are configured. */
|
|
18
|
+
const NEVER_MATCH_RE = /$^/;
|
|
19
|
+
var CompileCtx = class {
|
|
20
|
+
root;
|
|
21
|
+
base;
|
|
22
|
+
app_dir;
|
|
23
|
+
libDir;
|
|
24
|
+
pkg_scan;
|
|
25
|
+
page_importers;
|
|
26
|
+
page_files;
|
|
27
|
+
measure;
|
|
28
|
+
server_plugins;
|
|
29
|
+
client_plugins;
|
|
30
|
+
route_config;
|
|
31
|
+
foreign_hydrate;
|
|
32
|
+
is_dev;
|
|
33
|
+
id_salt;
|
|
34
|
+
visibleMargin;
|
|
35
|
+
presets;
|
|
36
|
+
import_keys;
|
|
37
|
+
resolve_alias;
|
|
38
|
+
macros;
|
|
39
|
+
pkg_root;
|
|
40
|
+
build_secret;
|
|
41
|
+
rate_limit;
|
|
42
|
+
session_cookie;
|
|
43
|
+
region_ttl;
|
|
44
|
+
renew_window;
|
|
45
|
+
router_enabled;
|
|
46
|
+
router_view_transitions;
|
|
47
|
+
client_hooks;
|
|
48
|
+
runtime_dir;
|
|
49
|
+
runtime_hash;
|
|
50
|
+
hmac_module;
|
|
51
|
+
region_endpoint_module;
|
|
52
|
+
client_binding_stub_file;
|
|
53
|
+
app_shims;
|
|
54
|
+
is_build;
|
|
55
|
+
devtools;
|
|
56
|
+
/** `with { … }` hint matcher — a node_modules `.svelte` is only transformed when it carries one
|
|
57
|
+
* (so a library can declare its own islands). Built once from the resolved import keys. */
|
|
58
|
+
#island_hint_re;
|
|
59
|
+
/** The resolved import-attribute keys that make a mark (`wake`, `render`, …). */
|
|
60
|
+
#mark_keys;
|
|
61
|
+
/** Declared package files (exact) + dirs (prefix) — the transform-gate membership index. */
|
|
62
|
+
#pkg_files;
|
|
63
|
+
#pkg_dirs;
|
|
64
|
+
/** Package roots, longest first, for stable-identity mapping (root → published name). */
|
|
65
|
+
#pkg_roots;
|
|
66
|
+
constructor(init) {
|
|
67
|
+
this.root = init.root;
|
|
68
|
+
this.base = init.base;
|
|
69
|
+
this.app_dir = init.app_dir;
|
|
70
|
+
this.libDir = init.libDir;
|
|
71
|
+
this.pkg_scan = init.pkg_scan ?? [];
|
|
72
|
+
this.page_importers = init.page_importers ?? [];
|
|
73
|
+
this.page_files = init.page_files ?? [];
|
|
74
|
+
this.measure = init.measure;
|
|
75
|
+
this.server_plugins = init.server_plugins ?? [];
|
|
76
|
+
this.client_plugins = init.client_plugins ?? [];
|
|
77
|
+
this.route_config = init.route_config ?? [];
|
|
78
|
+
this.foreign_hydrate = init.foreign_hydrate ?? false;
|
|
79
|
+
this.is_dev = init.is_dev;
|
|
80
|
+
this.id_salt = init.id_salt;
|
|
81
|
+
this.visibleMargin = init.visibleMargin;
|
|
82
|
+
this.presets = init.presets;
|
|
83
|
+
this.import_keys = init.import_keys;
|
|
84
|
+
this.resolve_alias = init.resolve_alias;
|
|
85
|
+
this.macros = init.macros ?? [];
|
|
86
|
+
this.pkg_root = init.pkg_root;
|
|
87
|
+
this.build_secret = init.build_secret;
|
|
88
|
+
this.rate_limit = init.rate_limit;
|
|
89
|
+
this.session_cookie = init.session_cookie;
|
|
90
|
+
this.region_ttl = init.region_ttl;
|
|
91
|
+
this.renew_window = init.renew_window;
|
|
92
|
+
this.router_enabled = init.router_enabled;
|
|
93
|
+
this.router_view_transitions = init.router_view_transitions;
|
|
94
|
+
this.client_hooks = init.client_hooks ?? null;
|
|
95
|
+
this.runtime_dir = init.runtime_dir;
|
|
96
|
+
this.runtime_hash = init.runtime_hash;
|
|
97
|
+
this.hmac_module = init.hmac_module;
|
|
98
|
+
this.region_endpoint_module = init.region_endpoint_module;
|
|
99
|
+
this.client_binding_stub_file = init.client_binding_stub_file;
|
|
100
|
+
this.app_shims = init.app_shims;
|
|
101
|
+
this.is_build = init.is_build;
|
|
102
|
+
this.devtools = init.devtools;
|
|
103
|
+
const hint_keys = Object.values(init.import_keys).filter((v) => typeof v === "string");
|
|
104
|
+
this.#island_hint_re = hint_keys.length ? new RegExp(`\\bwith\\s*\\{[^}]*\\b(?:${hint_keys.join("|")})\\b`) : NEVER_MATCH_RE;
|
|
105
|
+
this.#mark_keys = new Set(hint_keys);
|
|
106
|
+
this.#pkg_files = new Set(this.pkg_scan.flatMap((p) => p.files));
|
|
107
|
+
this.#pkg_dirs = this.pkg_scan.flatMap((p) => p.dirs);
|
|
108
|
+
this.#pkg_roots = this.pkg_scan.map((p) => ({
|
|
109
|
+
root: p.root,
|
|
110
|
+
name: p.name
|
|
111
|
+
})).sort((a, b) => b.root.length - a.root.length);
|
|
112
|
+
}
|
|
113
|
+
/** True when `code` carries an ogygia `with { … }` island hint (gates node_modules `.svelte`). */
|
|
114
|
+
has_island_hint(code) {
|
|
115
|
+
return this.#island_hint_re.test(code);
|
|
116
|
+
}
|
|
117
|
+
/** True when a JS module has a real `import … with { <mark key>: … }` declaration. The hint
|
|
118
|
+
* above is a text sniff, so it also matches a comment, a string or generated code that merely
|
|
119
|
+
* mentions `with { wake }`; this parses. A module that does not parse counts as marked, so a
|
|
120
|
+
* warning that depends on it errs toward speaking. */
|
|
121
|
+
has_marked_import(code, id) {
|
|
122
|
+
const { program, ok } = parse_module(code, id);
|
|
123
|
+
if (!ok || !program) return true;
|
|
124
|
+
for (const node of program.body) {
|
|
125
|
+
if (node.type !== "ImportDeclaration") continue;
|
|
126
|
+
for (const attr of node.attributes ?? []) {
|
|
127
|
+
const key = attr.key?.type === "Identifier" ? attr.key.name : attr.key?.value;
|
|
128
|
+
if (typeof key === "string" && this.#mark_keys.has(key)) return true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
/** True when `id` is inside a dependency's DECLARED `ogygia.files` surface — those files are
|
|
134
|
+
* prescanned + transformed exactly like app source (the node_modules gates lift for them). */
|
|
135
|
+
in_declared_pkg(id) {
|
|
136
|
+
if (this.#pkg_files.size === 0 && this.#pkg_dirs.length === 0) return false;
|
|
137
|
+
const p = id.split(BACKSLASH_SEP).join("/");
|
|
138
|
+
if (this.#pkg_files.has(p)) return true;
|
|
139
|
+
for (const dir of this.#pkg_dirs) if (p.startsWith(dir + "/")) return true;
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
/** Install-independent region identity for a file under a declared package: `<name>/<rel>`.
|
|
143
|
+
* Store paths carry version + peer-resolution hashes (`node_modules/.pnpm/pkg@1.2.3(...)`),
|
|
144
|
+
* so a root-relative identity would change per install/machine and prod HTML would stop
|
|
145
|
+
* matching its chunks. Returns `null` for anything not under a declared package root. */
|
|
146
|
+
pkg_identity(abs) {
|
|
147
|
+
if (this.#pkg_roots.length === 0) return null;
|
|
148
|
+
const p = abs.split(BACKSLASH_SEP).join("/");
|
|
149
|
+
for (const { root, name } of this.#pkg_roots) if (p.startsWith(root + "/")) return name + p.slice(root.length);
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
/** The runtime's feature set, as a name segment: the prescan's feature hash, and a trailing `h` when
|
|
153
|
+
* the app has `hooks.client.ts` (the runtime entry then dynamic-imports it). Empty until prescan
|
|
154
|
+
* runs. Both the stable name and the content-hashed file carry it, so a name says which runtime. */
|
|
155
|
+
runtime_features(program_feature_hash) {
|
|
156
|
+
return `${program_feature_hash}${this.client_hooks ? "h" : ""}`;
|
|
157
|
+
}
|
|
158
|
+
/** The runtime's STABLE name (`RUNTIME_HASH` ⊕ its features): its identity — the key the handoff
|
|
159
|
+
* maps to the content-hashed file the page loads — and the name of that file's shim. Computed here
|
|
160
|
+
* (not the caller) so both build legs name it identically. `program_feature_hash` is
|
|
161
|
+
* `Program.runtime_feature_hash`, threaded in by the caller so this stays a pure naming function. */
|
|
162
|
+
runtime_chunk_filename(program_feature_hash) {
|
|
163
|
+
const feat = this.runtime_features(program_feature_hash);
|
|
164
|
+
return `${this.app_dir}/immutable/og-runtime.${this.runtime_hash}${feat ? "-" + feat : ""}.js`;
|
|
165
|
+
}
|
|
166
|
+
/** App-internal URL of the runtime chunk (leading slash + appDir; NO base). SSR bakes it as the
|
|
167
|
+
* `<script src>`, then `asset()` prepends base / the assets CDN at render time. */
|
|
168
|
+
runtime_chunk_url(program_feature_hash) {
|
|
169
|
+
return "/" + this.runtime_chunk_filename(program_feature_hash);
|
|
170
|
+
}
|
|
171
|
+
/** Output filename for a hydrate island chunk (under the app dir; an on-disk build path). */
|
|
172
|
+
island_chunk_filename(iid) {
|
|
173
|
+
return islandChunkFileName(iid, this.app_dir);
|
|
174
|
+
}
|
|
175
|
+
/** App-internal URL of a hydrate island chunk (leading slash + appDir; NO base — `asset()` adds it). */
|
|
176
|
+
island_public_url(iid) {
|
|
177
|
+
return islandPublicUrl(iid, this.app_dir);
|
|
178
|
+
}
|
|
179
|
+
/** Read a file as UTF-8, or `null` if it can't be read (the transform tolerates missing deps). */
|
|
180
|
+
read_file(abs) {
|
|
181
|
+
try {
|
|
182
|
+
return strip_bom(fs.readFileSync(abs, "utf-8"));
|
|
183
|
+
} catch {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/** Virtual island ENTRY module id for an island id. */
|
|
188
|
+
island_virtual_id(iid) {
|
|
189
|
+
return islandVirtualId(iid);
|
|
190
|
+
}
|
|
191
|
+
/** Virtual wrapper `.svelte` module id for an island id. */
|
|
192
|
+
wrapper_virtual_id(iid) {
|
|
193
|
+
return wrapperVirtualId(iid);
|
|
194
|
+
}
|
|
195
|
+
/** Dev URL for a dynamic `import(entry)` of a virtual island module. Base-LESS, exactly like the
|
|
196
|
+
* prod island/runtime URLs and the dev runtime URL: `Region.svelte` runs it through Kit's `asset()`
|
|
197
|
+
* at SSR, which is the sole base authority. Baking `base` here would double it (Vite dev serves
|
|
198
|
+
* `/@id/…` UNDER base, and `asset()` already adds that prefix). */
|
|
199
|
+
dev_url_for(virtualPath) {
|
|
200
|
+
return "/@id/" + virtualPath;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
export { CompileCtx };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ModuleShape } from "./parse.js";
|
|
2
|
+
export interface Host {
|
|
3
|
+
/** The module's source, or null when it cannot be read (virtual, binary, missing). */
|
|
4
|
+
read(id: string): string | null;
|
|
5
|
+
/** Resolve `spec` from `importer` to a file id; null when Vite cannot. */
|
|
6
|
+
resolve(spec: string, importer: string): Promise<string | null>;
|
|
7
|
+
/** May this resolved module be treated as a barrel at all? (matchers + node_modules policy) */
|
|
8
|
+
candidate(id: string, spec: string): boolean;
|
|
9
|
+
/** Is this module forced even though impure? */
|
|
10
|
+
forced(id: string, spec: string): boolean;
|
|
11
|
+
/** Is this module kept whatever it looks like? */
|
|
12
|
+
kept(id: string, spec: string): boolean;
|
|
13
|
+
/** Follow a star into node_modules? */
|
|
14
|
+
follow_packages: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type Leaf = {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
} | {
|
|
20
|
+
id: string;
|
|
21
|
+
namespace: true;
|
|
22
|
+
};
|
|
23
|
+
export type Entry = Leaf | "own" | "ambiguous";
|
|
24
|
+
export interface ExportMap {
|
|
25
|
+
id: string;
|
|
26
|
+
/** the barrel's usable names */
|
|
27
|
+
entries: Map<string, Entry>;
|
|
28
|
+
/** pure barrel → the import can be dropped once every name moved; impure → kept for effects */
|
|
29
|
+
pure: boolean;
|
|
30
|
+
/** rewriting allowed at all (candidate, and pure or forced, and not kept) */
|
|
31
|
+
rewritable: boolean;
|
|
32
|
+
/** some names could not be seen (a star into the unparsable): unknown names stay on the barrel */
|
|
33
|
+
opaque: boolean;
|
|
34
|
+
/** every module this map depends on — a change to any of them invalidates the map */
|
|
35
|
+
deps: Set<string>;
|
|
36
|
+
/** built while a neighbour was still being built by another walk: served, not cached */
|
|
37
|
+
provisional: boolean;
|
|
38
|
+
/** ids on the walk stack this build ran into (a cycle): the map lacks THEIR names, so it is
|
|
39
|
+
* cached only once the walk that owns them has closed the ring (the set is empty there) */
|
|
40
|
+
cycles: Set<string>;
|
|
41
|
+
}
|
|
42
|
+
export declare class BarrelIndex {
|
|
43
|
+
#private;
|
|
44
|
+
constructor(host: Host);
|
|
45
|
+
/** Drop every cached map/shape that depends on `id` (the file changed). */
|
|
46
|
+
invalidate(id: string): void;
|
|
47
|
+
/** The parsed shape of a module (cached), or null when it cannot be read/parsed. */
|
|
48
|
+
shape(id: string): ModuleShape | null;
|
|
49
|
+
/**
|
|
50
|
+
* The export map of a barrel, or null when the module is not a barrel the plugin may rewrite
|
|
51
|
+
* (not a candidate, impure and not forced, kept, unreadable). `spec` is the specifier the
|
|
52
|
+
* importer wrote — matchers see both. Concurrent callers share one build.
|
|
53
|
+
*/
|
|
54
|
+
map(id: string, spec: string): Promise<ExportMap | null>;
|
|
55
|
+
}
|