@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,248 @@
|
|
|
1
|
+
import { analyze_exports } from "./parse.js";
|
|
2
|
+
// src/compiler/debarrel/barrel.ts
|
|
3
|
+
/**
|
|
4
|
+
* The barrel index: for a resolved module id, the map `exported name → leaf` — the module and
|
|
5
|
+
* name an importer can go to directly. Built by walking the barrel's re-exports through nested
|
|
6
|
+
* barrels, `export *` fan-outs and `import … ; export { … }` bindings, with a cycle guard and an
|
|
7
|
+
* `opaque` flag for the parts it cannot see (a star into something it cannot parse).
|
|
8
|
+
*
|
|
9
|
+
* Pure over an injected HOST (read a file, resolve a specifier, decide candidacy), so it is
|
|
10
|
+
* unit-tested against fixture files with a tiny resolver and runs unchanged inside the Vite plugin
|
|
11
|
+
* with `this.resolve`.
|
|
12
|
+
*
|
|
13
|
+
* CONCURRENCY: a bundler transforms hundreds of importers at once, and most of them ask for the same
|
|
14
|
+
* few barrels. One build per barrel is kept in flight (`#pending`) and every concurrent caller awaits
|
|
15
|
+
* it. A cycle is detected against the WALK STACK of the build that is running (a → b → a), never
|
|
16
|
+
* against another build's in-flight state; when a walk meets a barrel some other walk is still
|
|
17
|
+
* building, it does not wait (two walks waiting on each other would never finish) — it leaves that
|
|
18
|
+
* name unresolved and marks its own map PROVISIONAL, so the map is served once but not cached, and
|
|
19
|
+
* the next importer rebuilds it against the finished neighbour.
|
|
20
|
+
*/
|
|
21
|
+
const STRIP_QUERY_RE = /[?#].*$/;
|
|
22
|
+
const NODE_MODULES_RE = /[\\/]node_modules[\\/]/;
|
|
23
|
+
const PARSABLE_RE = /\.(?:[cm]?[jt]sx?|svelte\.[jt]s)$/;
|
|
24
|
+
var BarrelIndex = class {
|
|
25
|
+
#host;
|
|
26
|
+
#maps = /* @__PURE__ */ new Map();
|
|
27
|
+
#shapes = /* @__PURE__ */ new Map();
|
|
28
|
+
#pending = /* @__PURE__ */ new Map();
|
|
29
|
+
constructor(host) {
|
|
30
|
+
this.#host = host;
|
|
31
|
+
}
|
|
32
|
+
/** Drop every cached map/shape that depends on `id` (the file changed). */
|
|
33
|
+
invalidate(id) {
|
|
34
|
+
const clean = id.replace(STRIP_QUERY_RE, "");
|
|
35
|
+
this.#shapes.delete(clean);
|
|
36
|
+
for (const [k, m] of this.#maps) if (k === clean || m && m.deps.has(clean)) this.#maps.delete(k);
|
|
37
|
+
}
|
|
38
|
+
/** The parsed shape of a module (cached), or null when it cannot be read/parsed. */
|
|
39
|
+
shape(id) {
|
|
40
|
+
const clean = id.replace(STRIP_QUERY_RE, "");
|
|
41
|
+
if (this.#shapes.has(clean)) return this.#shapes.get(clean);
|
|
42
|
+
let shape = null;
|
|
43
|
+
if (PARSABLE_RE.test(clean)) {
|
|
44
|
+
const code = this.#host.read(clean);
|
|
45
|
+
if (code != null) shape = analyze_exports(code, clean);
|
|
46
|
+
}
|
|
47
|
+
this.#shapes.set(clean, shape);
|
|
48
|
+
return shape;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The export map of a barrel, or null when the module is not a barrel the plugin may rewrite
|
|
52
|
+
* (not a candidate, impure and not forced, kept, unreadable). `spec` is the specifier the
|
|
53
|
+
* importer wrote — matchers see both. Concurrent callers share one build.
|
|
54
|
+
*/
|
|
55
|
+
async map(id, spec) {
|
|
56
|
+
const clean = id.replace(STRIP_QUERY_RE, "");
|
|
57
|
+
if (clean !== id) return null;
|
|
58
|
+
if (this.#host.kept(clean, spec)) return null;
|
|
59
|
+
if (!this.#host.candidate(clean, spec)) return null;
|
|
60
|
+
if (this.#maps.has(clean)) return this.#maps.get(clean);
|
|
61
|
+
const pending = this.#pending.get(clean);
|
|
62
|
+
if (pending) return pending;
|
|
63
|
+
const shape = this.shape(clean);
|
|
64
|
+
if (!shape) {
|
|
65
|
+
this.#maps.set(clean, null);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
if (!shape.pure && !this.#host.forced(clean, spec)) {
|
|
69
|
+
this.#maps.set(clean, null);
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return this.#start(clean, shape, /* @__PURE__ */ new Set());
|
|
73
|
+
}
|
|
74
|
+
/** Begin one build for `id`, register it as in flight, cache the result unless provisional. */
|
|
75
|
+
#start(id, shape, walk) {
|
|
76
|
+
const run = (async () => {
|
|
77
|
+
try {
|
|
78
|
+
const built = await this.#build(id, shape, walk);
|
|
79
|
+
if (!built.provisional && built.cycles.size === 0) this.#maps.set(id, built);
|
|
80
|
+
return built;
|
|
81
|
+
} finally {
|
|
82
|
+
this.#pending.delete(id);
|
|
83
|
+
}
|
|
84
|
+
})();
|
|
85
|
+
this.#pending.set(id, run);
|
|
86
|
+
return run;
|
|
87
|
+
}
|
|
88
|
+
async #build(id, shape, outer) {
|
|
89
|
+
const walk = new Set(outer);
|
|
90
|
+
walk.add(id);
|
|
91
|
+
const map = {
|
|
92
|
+
id,
|
|
93
|
+
entries: /* @__PURE__ */ new Map(),
|
|
94
|
+
pure: shape.pure,
|
|
95
|
+
rewritable: true,
|
|
96
|
+
opaque: false,
|
|
97
|
+
deps: /* @__PURE__ */ new Set([id]),
|
|
98
|
+
provisional: false,
|
|
99
|
+
cycles: /* @__PURE__ */ new Set()
|
|
100
|
+
};
|
|
101
|
+
const stars = [];
|
|
102
|
+
const explicit = /* @__PURE__ */ new Set();
|
|
103
|
+
for (const rec of shape.exports) if (rec.kind === "own") {
|
|
104
|
+
map.entries.set(rec.exported, "own");
|
|
105
|
+
explicit.add(rec.exported);
|
|
106
|
+
} else if (rec.kind === "reexport") {
|
|
107
|
+
explicit.add(rec.exported);
|
|
108
|
+
const leaf = await this.#leaf(id, rec.source, rec.imported, map, walk);
|
|
109
|
+
if (leaf) map.entries.set(rec.exported, leaf);
|
|
110
|
+
else map.opaque = true;
|
|
111
|
+
} else if (rec.kind === "star_ns") {
|
|
112
|
+
explicit.add(rec.exported);
|
|
113
|
+
const target = await this.#host.resolve(rec.source, id);
|
|
114
|
+
if (target) map.entries.set(rec.exported, {
|
|
115
|
+
id: target.replace(STRIP_QUERY_RE, ""),
|
|
116
|
+
namespace: true
|
|
117
|
+
});
|
|
118
|
+
else map.opaque = true;
|
|
119
|
+
} else stars.push({
|
|
120
|
+
source: rec.source,
|
|
121
|
+
type_only: rec.type_only
|
|
122
|
+
});
|
|
123
|
+
for (const star of stars) {
|
|
124
|
+
const target = await this.#host.resolve(star.source, id);
|
|
125
|
+
if (!target || target !== target.replace(STRIP_QUERY_RE, "")) {
|
|
126
|
+
map.opaque = true;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (!this.#host.follow_packages && NODE_MODULES_RE.test(target)) {
|
|
130
|
+
map.opaque = true;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
map.deps.add(target);
|
|
134
|
+
const names = await this.#star_names(target, map, walk);
|
|
135
|
+
if (!names) {
|
|
136
|
+
map.opaque = true;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
for (const [name, leaf] of names) {
|
|
140
|
+
if (name === "default") continue;
|
|
141
|
+
if (explicit.has(name)) continue;
|
|
142
|
+
const existing = map.entries.get(name);
|
|
143
|
+
if (existing === void 0) map.entries.set(name, leaf);
|
|
144
|
+
else if (existing !== leaf && !same_leaf(existing, leaf)) map.entries.set(name, "ambiguous");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return map;
|
|
148
|
+
}
|
|
149
|
+
/** The leaf behind `import { imported } from source` written inside barrel `from`. */
|
|
150
|
+
async #leaf(from, source, imported, map, walk) {
|
|
151
|
+
const target = await this.#host.resolve(source, from);
|
|
152
|
+
if (!target) return null;
|
|
153
|
+
if (target !== target.replace(STRIP_QUERY_RE, "")) return null;
|
|
154
|
+
map.deps.add(target);
|
|
155
|
+
const inner = await this.#through(target, map, walk);
|
|
156
|
+
if (inner) {
|
|
157
|
+
const e = inner.entries.get(imported);
|
|
158
|
+
if (e && e !== "own" && e !== "ambiguous") return e;
|
|
159
|
+
if (e === "ambiguous") return null;
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
id: target,
|
|
163
|
+
name: imported
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Look through a nested module while building a map. Unlike `map()`, this does not require
|
|
168
|
+
* the nested module to be a CANDIDATE (an importer's rewrite policy) — only that it is pure:
|
|
169
|
+
* a pure nested barrel is transparent, an impure one is a leaf in its own right (its own code
|
|
170
|
+
* must run for the name to exist). On our own walk stack = a cycle (null); in flight on another
|
|
171
|
+
* walk = do not wait (null, and the parent becomes provisional).
|
|
172
|
+
*/
|
|
173
|
+
async #through(id, parent, walk) {
|
|
174
|
+
if (this.#host.kept(id, id)) return null;
|
|
175
|
+
if (this.#maps.has(id)) {
|
|
176
|
+
const m = this.#maps.get(id) ?? null;
|
|
177
|
+
if (m) for (const d of m.deps) parent.deps.add(d);
|
|
178
|
+
return m;
|
|
179
|
+
}
|
|
180
|
+
if (walk.has(id)) {
|
|
181
|
+
if (id !== parent.id) parent.cycles.add(id);
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
if (this.#pending.has(id)) {
|
|
185
|
+
parent.provisional = true;
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
const shape = this.shape(id);
|
|
189
|
+
if (!shape || !shape.pure) return null;
|
|
190
|
+
const built = await this.#start(id, shape, walk);
|
|
191
|
+
if (built.provisional) parent.provisional = true;
|
|
192
|
+
for (const c of built.cycles) if (c !== parent.id) parent.cycles.add(c);
|
|
193
|
+
for (const d of built.deps) parent.deps.add(d);
|
|
194
|
+
return built;
|
|
195
|
+
}
|
|
196
|
+
/** Every non-default name `export * from target` contributes, mapped to its leaf. */
|
|
197
|
+
async #star_names(target, parent, walk) {
|
|
198
|
+
const shape = this.shape(target);
|
|
199
|
+
if (!shape) return null;
|
|
200
|
+
const out = /* @__PURE__ */ new Map();
|
|
201
|
+
if (shape.pure) {
|
|
202
|
+
const inner = await this.#through(target, parent, walk);
|
|
203
|
+
if (!inner) return null;
|
|
204
|
+
if (inner.opaque) parent.opaque = true;
|
|
205
|
+
for (const [name, e] of inner.entries) if (e === "own") out.set(name, {
|
|
206
|
+
id: target,
|
|
207
|
+
name
|
|
208
|
+
});
|
|
209
|
+
else if (e !== "ambiguous") out.set(name, e);
|
|
210
|
+
return out;
|
|
211
|
+
}
|
|
212
|
+
for (const rec of shape.exports) if (rec.kind === "own") out.set(rec.exported, {
|
|
213
|
+
id: target,
|
|
214
|
+
name: rec.exported
|
|
215
|
+
});
|
|
216
|
+
else if (rec.kind === "reexport") {
|
|
217
|
+
const leaf = await this.#leaf(target, rec.source, rec.imported, parent, walk);
|
|
218
|
+
if (leaf) out.set(rec.exported, leaf);
|
|
219
|
+
else parent.opaque = true;
|
|
220
|
+
} else if (rec.kind === "star_ns") {
|
|
221
|
+
const t = await this.#host.resolve(rec.source, target);
|
|
222
|
+
if (t) out.set(rec.exported, {
|
|
223
|
+
id: t.replace(STRIP_QUERY_RE, ""),
|
|
224
|
+
namespace: true
|
|
225
|
+
});
|
|
226
|
+
} else {
|
|
227
|
+
const t = await this.#host.resolve(rec.source, target);
|
|
228
|
+
if (!t) {
|
|
229
|
+
parent.opaque = true;
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
parent.deps.add(t);
|
|
233
|
+
const names = await this.#star_names(t, parent, walk);
|
|
234
|
+
if (!names) {
|
|
235
|
+
parent.opaque = true;
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
for (const [n, leaf] of names) if (n !== "default" && !out.has(n)) out.set(n, leaf);
|
|
239
|
+
}
|
|
240
|
+
return out;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
function same_leaf(a, b) {
|
|
244
|
+
if (typeof a === "string" || typeof b === "string") return a === b;
|
|
245
|
+
if ("namespace" in a || "namespace" in b) return "namespace" in a && "namespace" in b && a.id === b.id;
|
|
246
|
+
return a.id === b.id && a.name === b.name;
|
|
247
|
+
}
|
|
248
|
+
export { BarrelIndex };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ogygia({ barrels })` — what counts as a barrel, which importers get rewritten, what to keep.
|
|
3
|
+
*
|
|
4
|
+
* A BARREL is a module whose exports are re-exports of other modules: `index.ts` files, a package's
|
|
5
|
+
* `components.ts`, `export * from` fan-outs. Importing one name from it drags the whole graph in: in
|
|
6
|
+
* dev every module behind it is transformed and served, in build the chunk graph follows the import
|
|
7
|
+
* graph before tree-shaking, and a package that is not `sideEffects: false` keeps all of it. The
|
|
8
|
+
* debarrel pass replaces `import { A } from 'barrel'` with `import A from '<leaf of A>'` at
|
|
9
|
+
* transform time, so the graph is the leaves the file actually uses.
|
|
10
|
+
*
|
|
11
|
+
* This pass is independent of islands: it does not read or write region marks. An import that
|
|
12
|
+
* carries ogygia attributes (`with { wake }` …) is left exactly as written — a barrel binding is
|
|
13
|
+
* marked through `asRegion` / a mark in the barrel, as before.
|
|
14
|
+
*/
|
|
15
|
+
export type Matcher = string | RegExp | ((id: string) => boolean);
|
|
16
|
+
export interface DebarrelOptions {
|
|
17
|
+
/**
|
|
18
|
+
* DEPENDENCIES whose barrels may be bypassed too. The project's own modules need no listing:
|
|
19
|
+
* every file outside `node_modules` is a candidate, and purity decides (a barrel is PURE when
|
|
20
|
+
* every top-level statement is an import, a re-export, a type, or `export {}`). Packages are
|
|
21
|
+
* opt-in because Vite pre-bundles bare imports in dev: a leaf import that skips the optimizer
|
|
22
|
+
* while another importer gets the pre-bundled copy is two instances of one module. List a
|
|
23
|
+
* package here when you know it is safe (an ESM component library, excluded from
|
|
24
|
+
* `optimizeDeps`). Names, globs or regexes: `['@acme/ui', '@acme/*', /\/components\/index\.js$/]`.
|
|
25
|
+
* A plain string matches the specifier prefix (`'@acme/ui'` covers `@acme/ui/components`).
|
|
26
|
+
*/
|
|
27
|
+
packages?: Matcher[];
|
|
28
|
+
/**
|
|
29
|
+
* Modules that are IMPURE barrels (own top-level code next to the re-exports) but should still
|
|
30
|
+
* be rewritten: the re-exported names go to their leaves, the barrel itself stays imported for
|
|
31
|
+
* its side effects (`import 'barrel'`). Without this, an impure barrel is left alone.
|
|
32
|
+
*/
|
|
33
|
+
force?: Matcher[];
|
|
34
|
+
/** Never rewrite imports of these modules, whatever else says (a barrel whose own module-level
|
|
35
|
+
* code the app depends on — a store singleton created in the barrel itself). */
|
|
36
|
+
keep?: Matcher[];
|
|
37
|
+
/** Which IMPORTERS are rewritten. Default: project files (not `node_modules`) with a JS / TS /
|
|
38
|
+
* Svelte extension. */
|
|
39
|
+
importers?: {
|
|
40
|
+
include?: Matcher[];
|
|
41
|
+
exclude?: Matcher[];
|
|
42
|
+
};
|
|
43
|
+
/** Follow `export * from` into `node_modules` packages when building a barrel's export map
|
|
44
|
+
* (default true). A star that reaches something unparsable (CJS, JSON) makes the barrel
|
|
45
|
+
* OPAQUE for the names it cannot see: those stay on the barrel import. */
|
|
46
|
+
followPackages?: boolean;
|
|
47
|
+
/** A report at the end of each build leg — files rewritten, imports and names moved, barrels
|
|
48
|
+
* bypassed, time spent in the pass, then the barrels by names moved. Default `true`: the eight
|
|
49
|
+
* biggest and a count of the rest; `'all'`: every barrel; `false`: nothing. */
|
|
50
|
+
report?: boolean | "all";
|
|
51
|
+
/** Log every rewrite as it happens (dev + build). */
|
|
52
|
+
debug?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface NormalizedOptions {
|
|
55
|
+
packages: Matcher[];
|
|
56
|
+
force: Matcher[];
|
|
57
|
+
keep: Matcher[];
|
|
58
|
+
importer_include: Matcher[];
|
|
59
|
+
importer_exclude: Matcher[];
|
|
60
|
+
follow_packages: boolean;
|
|
61
|
+
report: false | true | "all";
|
|
62
|
+
debug: boolean;
|
|
63
|
+
}
|
|
64
|
+
export declare function normalize_options(o?: DebarrelOptions | true): NormalizedOptions;
|
|
65
|
+
/** Does `m` match `id` (a resolved file id) or `spec` (the bare specifier as written)? */
|
|
66
|
+
export declare function matches(m: Matcher, id: string, spec: string): boolean;
|
|
67
|
+
export declare function matches_any(ms: Matcher[], id: string, spec: string): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/compiler/debarrel/options.ts
|
|
2
|
+
function normalize_options(o = {}) {
|
|
3
|
+
const opts = o === true ? {} : o;
|
|
4
|
+
return {
|
|
5
|
+
packages: opts.packages ?? [],
|
|
6
|
+
force: opts.force ?? [],
|
|
7
|
+
keep: opts.keep ?? [],
|
|
8
|
+
importer_include: opts.importers?.include ?? [],
|
|
9
|
+
importer_exclude: opts.importers?.exclude ?? [],
|
|
10
|
+
follow_packages: opts.followPackages ?? true,
|
|
11
|
+
report: opts.report === false ? false : opts.report === "all" ? "all" : true,
|
|
12
|
+
debug: !!opts.debug
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const GLOB_STAR_G = /\*/g;
|
|
16
|
+
const REGEX_META_G = /[.+?^${}()|[\]\\]/g;
|
|
17
|
+
/** Does `m` match `id` (a resolved file id) or `spec` (the bare specifier as written)? */
|
|
18
|
+
function matches(m, id, spec) {
|
|
19
|
+
if (typeof m === "function") return m(id) || m(spec);
|
|
20
|
+
if (m instanceof RegExp) return m.test(id) || m.test(spec);
|
|
21
|
+
if (m.includes("*")) {
|
|
22
|
+
const re = new RegExp("^" + m.replace(REGEX_META_G, "\\$&").replace(GLOB_STAR_G, ".*") + "$");
|
|
23
|
+
return re.test(spec) || re.test(id) || re.test(id.split("/node_modules/").pop() ?? id);
|
|
24
|
+
}
|
|
25
|
+
return spec === m || spec.startsWith(m + "/") || id.includes("/" + m + "/") || id.endsWith("/" + m) || id === m;
|
|
26
|
+
}
|
|
27
|
+
function matches_any(ms, id, spec) {
|
|
28
|
+
for (const m of ms) if (matches(m, id, spec)) return true;
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
export { matches, matches_any, normalize_options };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface ImportSpec {
|
|
2
|
+
/** `default` | `namespace` | `named` */
|
|
3
|
+
kind: "default" | "namespace" | "named";
|
|
4
|
+
/** the exported name asked for (`x` in `{ x as y }`, `default` for a default import) */
|
|
5
|
+
imported: string;
|
|
6
|
+
/** the local binding */
|
|
7
|
+
local: string;
|
|
8
|
+
/** `import { type T }` */
|
|
9
|
+
type_only: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ImportDecl {
|
|
12
|
+
start: number;
|
|
13
|
+
end: number;
|
|
14
|
+
source: string;
|
|
15
|
+
/** the verbatim ` with { … }` clause (leading space included), '' when none */
|
|
16
|
+
attributes: string;
|
|
17
|
+
/** the attribute keys (`wake` in `with { wake: 'load' }`) — what a mark-aware caller inspects */
|
|
18
|
+
attribute_keys: string[];
|
|
19
|
+
/** `import type { … }` — the whole declaration is type-only */
|
|
20
|
+
type_only: boolean;
|
|
21
|
+
/** bare `import 'x'` */
|
|
22
|
+
side_effect: boolean;
|
|
23
|
+
specs: ImportSpec[];
|
|
24
|
+
}
|
|
25
|
+
/** What a barrel says about one of its exported names. */
|
|
26
|
+
export type ExportRecord = {
|
|
27
|
+
kind: "reexport";
|
|
28
|
+
exported: string;
|
|
29
|
+
imported: string;
|
|
30
|
+
source: string;
|
|
31
|
+
type_only: boolean;
|
|
32
|
+
} | {
|
|
33
|
+
kind: "star";
|
|
34
|
+
source: string;
|
|
35
|
+
type_only: boolean;
|
|
36
|
+
} | {
|
|
37
|
+
kind: "star_ns";
|
|
38
|
+
exported: string;
|
|
39
|
+
source: string;
|
|
40
|
+
} | {
|
|
41
|
+
kind: "own";
|
|
42
|
+
exported: string;
|
|
43
|
+
};
|
|
44
|
+
export interface ModuleShape {
|
|
45
|
+
imports: ImportDecl[];
|
|
46
|
+
exports: ExportRecord[];
|
|
47
|
+
/** A PURE barrel: nothing but imports, re-exports, type declarations and `export {}`. */
|
|
48
|
+
pure: boolean;
|
|
49
|
+
/** Own names (declared in this module) that are exported. */
|
|
50
|
+
own: Set<string>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Every top-level import of the module, with ranges the rewriter overwrites. Declarations that
|
|
54
|
+
* cannot be rewritten (bare side-effect imports, namespace imports) are returned too, flagged, so
|
|
55
|
+
* a caller sees the whole picture. Null on a syntax error.
|
|
56
|
+
*/
|
|
57
|
+
export declare function analyze_imports(code: string, id: string): ImportDecl[] | null;
|
|
58
|
+
/**
|
|
59
|
+
* The export shape of a module. `pure` is the barrel test: the module contributes NO code of its
|
|
60
|
+
* own — every statement is an import, a re-export, an `export {}` of imported bindings, a type
|
|
61
|
+
* declaration, or an empty export. A module with any own declaration, expression statement, or
|
|
62
|
+
* `export default <expr>` is IMPURE (it runs something), and is only rewritten when forced.
|
|
63
|
+
* Null on a syntax error (or a file oxc cannot read as a module).
|
|
64
|
+
*/
|
|
65
|
+
export declare function analyze_exports(code: string, id: string): ModuleShape | null;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { parse_module } from "../parse/oxc.js";
|
|
2
|
+
// src/compiler/debarrel/parse.ts
|
|
3
|
+
/**
|
|
4
|
+
* Module analysis on the compiler's parser ({@link parse_module} — oxc through Vite, TS understood,
|
|
5
|
+
* byte offsets exact): the import declarations an importer has, and the export SHAPE of a candidate
|
|
6
|
+
* barrel. The id's extension picks the dialect, like everywhere else in the compiler; a Svelte
|
|
7
|
+
* script block is parsed under a synthetic `<file>.svelte.ts` / `.svelte.js` id.
|
|
8
|
+
*/
|
|
9
|
+
const name_of = (n) => {
|
|
10
|
+
if (!n) return "";
|
|
11
|
+
if (n.type === "Identifier") return n.name ?? "";
|
|
12
|
+
return typeof n.value === "string" ? n.value : String(n.value);
|
|
13
|
+
};
|
|
14
|
+
/** The clause runs from ` with` (or the legacy ` assert`) after the source literal to the end. */
|
|
15
|
+
const ATTRIBUTES_CLAUSE_RE = /\s+(?:with|assert)\s*\{[\s\S]*\}/;
|
|
16
|
+
const TRAILING_SEMI_RE = /;\s*$/;
|
|
17
|
+
/** The parsed program body, or null on a syntax error (the real compiler reports those). */
|
|
18
|
+
function program_body(code, id) {
|
|
19
|
+
const { program, ok } = parse_module(code, id);
|
|
20
|
+
if (!ok || !program) return null;
|
|
21
|
+
return program.body;
|
|
22
|
+
}
|
|
23
|
+
/** The verbatim ` with { … }` text of a declaration, from the source (oxc keeps `attributes`). */
|
|
24
|
+
function attributes_text(code, node) {
|
|
25
|
+
const attrs = node.attributes;
|
|
26
|
+
if (!attrs || attrs.length === 0) return "";
|
|
27
|
+
const source = node.source;
|
|
28
|
+
const tail = code.slice(source.end, node.end);
|
|
29
|
+
const m = ATTRIBUTES_CLAUSE_RE.exec(tail);
|
|
30
|
+
return m ? m[0].replace(TRAILING_SEMI_RE, "") : "";
|
|
31
|
+
}
|
|
32
|
+
function attribute_keys(node) {
|
|
33
|
+
const attrs = node.attributes;
|
|
34
|
+
if (!attrs || attrs.length === 0) return [];
|
|
35
|
+
return attrs.map((a) => name_of(a.key));
|
|
36
|
+
}
|
|
37
|
+
function imports_of(code, body) {
|
|
38
|
+
const out = [];
|
|
39
|
+
for (const node of body) {
|
|
40
|
+
if (node.type !== "ImportDeclaration") continue;
|
|
41
|
+
const source = node.source;
|
|
42
|
+
const specifiers = node.specifiers ?? [];
|
|
43
|
+
const specs = specifiers.map((s) => {
|
|
44
|
+
const local = name_of(s.local);
|
|
45
|
+
if (s.type === "ImportDefaultSpecifier") return {
|
|
46
|
+
kind: "default",
|
|
47
|
+
imported: "default",
|
|
48
|
+
local,
|
|
49
|
+
type_only: false
|
|
50
|
+
};
|
|
51
|
+
if (s.type === "ImportNamespaceSpecifier") return {
|
|
52
|
+
kind: "namespace",
|
|
53
|
+
imported: "*",
|
|
54
|
+
local,
|
|
55
|
+
type_only: false
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
kind: "named",
|
|
59
|
+
imported: name_of(s.imported),
|
|
60
|
+
local,
|
|
61
|
+
type_only: s.importKind === "type"
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
out.push({
|
|
65
|
+
start: node.start,
|
|
66
|
+
end: node.end,
|
|
67
|
+
source: source.value,
|
|
68
|
+
attributes: attributes_text(code, node),
|
|
69
|
+
attribute_keys: attribute_keys(node),
|
|
70
|
+
type_only: node.importKind === "type",
|
|
71
|
+
side_effect: specifiers.length === 0,
|
|
72
|
+
specs
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Every top-level import of the module, with ranges the rewriter overwrites. Declarations that
|
|
79
|
+
* cannot be rewritten (bare side-effect imports, namespace imports) are returned too, flagged, so
|
|
80
|
+
* a caller sees the whole picture. Null on a syntax error.
|
|
81
|
+
*/
|
|
82
|
+
function analyze_imports(code, id) {
|
|
83
|
+
const body = program_body(code, id);
|
|
84
|
+
return body ? imports_of(code, body) : null;
|
|
85
|
+
}
|
|
86
|
+
/** Declarations erased at runtime — they never make a module impure. (Enums have runtime shape.) */
|
|
87
|
+
const TYPE_ONLY_DECLS = /* @__PURE__ */ new Set([
|
|
88
|
+
"TSTypeAliasDeclaration",
|
|
89
|
+
"TSInterfaceDeclaration",
|
|
90
|
+
"TSDeclareFunction",
|
|
91
|
+
"TSModuleDeclaration"
|
|
92
|
+
]);
|
|
93
|
+
/**
|
|
94
|
+
* The export shape of a module. `pure` is the barrel test: the module contributes NO code of its
|
|
95
|
+
* own — every statement is an import, a re-export, an `export {}` of imported bindings, a type
|
|
96
|
+
* declaration, or an empty export. A module with any own declaration, expression statement, or
|
|
97
|
+
* `export default <expr>` is IMPURE (it runs something), and is only rewritten when forced.
|
|
98
|
+
* Null on a syntax error (or a file oxc cannot read as a module).
|
|
99
|
+
*/
|
|
100
|
+
function analyze_exports(code, id) {
|
|
101
|
+
const body = program_body(code, id);
|
|
102
|
+
if (!body) return null;
|
|
103
|
+
const imports = imports_of(code, body);
|
|
104
|
+
const bound = /* @__PURE__ */ new Map();
|
|
105
|
+
for (const d of imports) for (const s of d.specs) bound.set(s.local, {
|
|
106
|
+
source: d.source,
|
|
107
|
+
imported: s.imported,
|
|
108
|
+
kind: s.kind
|
|
109
|
+
});
|
|
110
|
+
const exports = [];
|
|
111
|
+
const own = /* @__PURE__ */ new Set();
|
|
112
|
+
let pure = true;
|
|
113
|
+
for (const node of body) switch (node.type) {
|
|
114
|
+
case "ImportDeclaration": continue;
|
|
115
|
+
case "ExportAllDeclaration": {
|
|
116
|
+
const source = node.source.value;
|
|
117
|
+
const exported = node.exported;
|
|
118
|
+
if (exported) exports.push({
|
|
119
|
+
kind: "star_ns",
|
|
120
|
+
exported: name_of(exported),
|
|
121
|
+
source
|
|
122
|
+
});
|
|
123
|
+
else exports.push({
|
|
124
|
+
kind: "star",
|
|
125
|
+
source,
|
|
126
|
+
type_only: node.exportKind === "type"
|
|
127
|
+
});
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
case "ExportNamedDeclaration": {
|
|
131
|
+
const decl = node.declaration;
|
|
132
|
+
if (decl) {
|
|
133
|
+
if (TYPE_ONLY_DECLS.has(decl.type)) {
|
|
134
|
+
for (const n of declared_names(decl)) exports.push({
|
|
135
|
+
kind: "own",
|
|
136
|
+
exported: n
|
|
137
|
+
});
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
pure = false;
|
|
141
|
+
for (const n of declared_names(decl)) {
|
|
142
|
+
own.add(n);
|
|
143
|
+
exports.push({
|
|
144
|
+
kind: "own",
|
|
145
|
+
exported: n
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const source = node.source ? node.source.value : null;
|
|
151
|
+
const specifiers = node.specifiers ?? [];
|
|
152
|
+
const type_decl = node.exportKind === "type";
|
|
153
|
+
for (const s of specifiers) {
|
|
154
|
+
const local = name_of(s.local);
|
|
155
|
+
const exported = name_of(s.exported);
|
|
156
|
+
const type_only = type_decl || s.exportKind === "type";
|
|
157
|
+
if (source) {
|
|
158
|
+
exports.push({
|
|
159
|
+
kind: "reexport",
|
|
160
|
+
exported,
|
|
161
|
+
imported: local,
|
|
162
|
+
source,
|
|
163
|
+
type_only
|
|
164
|
+
});
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
const b = bound.get(local);
|
|
168
|
+
if (b) {
|
|
169
|
+
if (b.kind === "namespace") exports.push({
|
|
170
|
+
kind: "star_ns",
|
|
171
|
+
exported,
|
|
172
|
+
source: b.source
|
|
173
|
+
});
|
|
174
|
+
else exports.push({
|
|
175
|
+
kind: "reexport",
|
|
176
|
+
exported,
|
|
177
|
+
imported: b.imported,
|
|
178
|
+
source: b.source,
|
|
179
|
+
type_only
|
|
180
|
+
});
|
|
181
|
+
} else {
|
|
182
|
+
own.add(exported);
|
|
183
|
+
exports.push({
|
|
184
|
+
kind: "own",
|
|
185
|
+
exported
|
|
186
|
+
});
|
|
187
|
+
if (!type_only) pure = false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
case "ExportDefaultDeclaration": {
|
|
193
|
+
const decl = node.declaration;
|
|
194
|
+
if (decl.type === "Identifier") {
|
|
195
|
+
const b = bound.get(name_of(decl));
|
|
196
|
+
if (b && b.kind !== "namespace") {
|
|
197
|
+
exports.push({
|
|
198
|
+
kind: "reexport",
|
|
199
|
+
exported: "default",
|
|
200
|
+
imported: b.imported,
|
|
201
|
+
source: b.source,
|
|
202
|
+
type_only: false
|
|
203
|
+
});
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
pure = false;
|
|
208
|
+
own.add("default");
|
|
209
|
+
exports.push({
|
|
210
|
+
kind: "own",
|
|
211
|
+
exported: "default"
|
|
212
|
+
});
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
default:
|
|
216
|
+
if (TYPE_ONLY_DECLS.has(node.type)) continue;
|
|
217
|
+
if (node.type === "EmptyStatement") continue;
|
|
218
|
+
pure = false;
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
imports,
|
|
222
|
+
exports,
|
|
223
|
+
pure,
|
|
224
|
+
own
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/** Names a declaration binds (`const { a, b } = …`, `function f`, `class C`, `enum E`, `type T`). */
|
|
228
|
+
function declared_names(decl) {
|
|
229
|
+
const out = [];
|
|
230
|
+
const id = decl.id;
|
|
231
|
+
if (id && id.type === "Identifier") out.push(name_of(id));
|
|
232
|
+
const declarations = decl.declarations;
|
|
233
|
+
if (declarations) for (const d of declarations) collect_pattern(d.id, out);
|
|
234
|
+
return out;
|
|
235
|
+
}
|
|
236
|
+
function collect_pattern(p, out) {
|
|
237
|
+
if (!p) return;
|
|
238
|
+
switch (p.type) {
|
|
239
|
+
case "Identifier":
|
|
240
|
+
out.push(name_of(p));
|
|
241
|
+
return;
|
|
242
|
+
case "ObjectPattern":
|
|
243
|
+
for (const prop of p.properties) collect_pattern(prop.type === "RestElement" ? prop.argument : prop.value, out);
|
|
244
|
+
return;
|
|
245
|
+
case "ArrayPattern":
|
|
246
|
+
for (const el of p.elements) if (el) collect_pattern(el, out);
|
|
247
|
+
return;
|
|
248
|
+
case "AssignmentPattern":
|
|
249
|
+
collect_pattern(p.left, out);
|
|
250
|
+
return;
|
|
251
|
+
case "RestElement":
|
|
252
|
+
collect_pattern(p.argument, out);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
export { analyze_exports, analyze_imports };
|