@ogygia/core 0.0.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +7 -1
- package/ambient.d.ts +194 -0
- package/dist/ClientBindingStub.svelte +6 -0
- package/dist/ClientBindingStub.svelte.d.ts +26 -0
- package/dist/KeepHost.svelte +19 -0
- package/dist/KeepHost.svelte.d.ts +10 -0
- package/dist/LakeBoundary.svelte +16 -0
- package/dist/LakeBoundary.svelte.d.ts +11 -0
- package/dist/LateIsland.svelte +22 -0
- package/dist/LateIsland.svelte.d.ts +15 -0
- package/dist/LateIslandAwait.svelte +17 -0
- package/dist/LateIslandAwait.svelte.d.ts +15 -0
- package/dist/LiveHost.svelte +19 -0
- package/dist/LiveHost.svelte.d.ts +10 -0
- package/dist/NestedProvider.svelte +13 -0
- package/dist/NestedProvider.svelte.d.ts +8 -0
- package/dist/OgygiaBoundary.svelte +5 -0
- package/dist/OgygiaBoundary.svelte.d.ts +17 -0
- package/dist/PromiseRegion.svelte +40 -0
- package/dist/PromiseRegion.svelte.d.ts +15 -0
- package/dist/PromiseRegionAwait.svelte +27 -0
- package/dist/PromiseRegionAwait.svelte.d.ts +15 -0
- package/dist/Provide.svelte +27 -0
- package/dist/Provide.svelte.d.ts +8 -0
- package/dist/RawHtml.svelte +9 -0
- package/dist/RawHtml.svelte.d.ts +6 -0
- package/dist/Region.svelte +1173 -0
- package/dist/Region.svelte.d.ts +68 -0
- package/dist/SlotBoundary.svelte +13 -0
- package/dist/SlotBoundary.svelte.d.ts +7 -0
- package/dist/app.d.ts +4 -0
- package/dist/app.js +3 -0
- package/dist/boundary.d.ts +35 -0
- package/dist/boundary.js +127 -0
- package/dist/build-cache.d.ts +13 -0
- package/dist/build-cache.js +77 -0
- package/dist/compiler/blank-styles.d.ts +1 -0
- package/dist/compiler/blank-styles.js +63 -0
- package/dist/compiler/bom.d.ts +2 -0
- package/dist/compiler/bom.js +15 -0
- package/dist/compiler/browser-full.d.ts +8 -0
- package/dist/compiler/browser-full.js +8 -0
- package/dist/compiler/browser.d.ts +11 -0
- package/dist/compiler/browser.js +11 -0
- package/dist/compiler/content/transportables.d.ts +26 -0
- package/dist/compiler/content/transportables.js +219 -0
- package/dist/compiler/ctx.d.ts +180 -0
- package/dist/compiler/ctx.js +183 -0
- package/dist/compiler/debarrel/barrel.d.ts +55 -0
- package/dist/compiler/debarrel/barrel.js +248 -0
- package/dist/compiler/debarrel/options.d.ts +67 -0
- package/dist/compiler/debarrel/options.js +31 -0
- package/dist/compiler/debarrel/parse.d.ts +65 -0
- package/dist/compiler/debarrel/parse.js +256 -0
- package/dist/compiler/debarrel/plugin.d.ts +31 -0
- package/dist/compiler/debarrel/plugin.js +190 -0
- package/dist/compiler/debarrel/rewrite.d.ts +27 -0
- package/dist/compiler/debarrel/rewrite.js +118 -0
- package/dist/compiler/debarrel/svelte.d.ts +13 -0
- package/dist/compiler/debarrel/svelte.js +56 -0
- package/dist/compiler/dev/css-scope.d.ts +16 -0
- package/dist/compiler/dev/css-scope.js +38 -0
- package/dist/compiler/dev/dev-hmr.d.ts +25 -0
- package/dist/compiler/dev/dev-hmr.js +29 -0
- package/dist/compiler/dev/hmr.d.ts +34 -0
- package/dist/compiler/dev/hmr.js +57 -0
- package/dist/compiler/dev/region-bytes.d.ts +34 -0
- package/dist/compiler/dev/region-bytes.js +126 -0
- package/dist/compiler/driver.d.ts +280 -0
- package/dist/compiler/driver.js +1352 -0
- package/dist/compiler/flags.d.ts +16 -0
- package/dist/compiler/flags.js +101 -0
- package/dist/compiler/fouc-css.d.ts +97 -0
- package/dist/compiler/fouc-css.js +335 -0
- package/dist/compiler/free-vars.d.ts +20 -0
- package/dist/compiler/free-vars.js +327 -0
- package/dist/compiler/host.d.ts +65 -0
- package/dist/compiler/host.js +51 -0
- package/dist/compiler/ids.d.ts +84 -0
- package/dist/compiler/ids.js +86 -0
- package/dist/compiler/index.d.ts +11 -0
- package/dist/compiler/index.js +11 -0
- package/dist/compiler/kit.d.ts +129 -0
- package/dist/compiler/kit.js +563 -0
- package/dist/compiler/link/build-output.d.ts +44 -0
- package/dist/compiler/link/build-output.js +147 -0
- package/dist/compiler/link/caps.d.ts +48 -0
- package/dist/compiler/link/caps.js +64 -0
- package/dist/compiler/link/context-detect.d.ts +23 -0
- package/dist/compiler/link/context-detect.js +137 -0
- package/dist/compiler/link/emit-gate.d.ts +11 -0
- package/dist/compiler/link/emit-gate.js +40 -0
- package/dist/compiler/link/entry-shim.d.ts +4 -0
- package/dist/compiler/link/entry-shim.js +29 -0
- package/dist/compiler/link/island-deps.d.ts +142 -0
- package/dist/compiler/link/island-deps.js +525 -0
- package/dist/compiler/link/manifest.d.ts +5 -0
- package/dist/compiler/link/manifest.js +9 -0
- package/dist/compiler/link/page-keys.d.ts +64 -0
- package/dist/compiler/link/page-keys.js +683 -0
- package/dist/compiler/link/registry-stub.d.ts +41 -0
- package/dist/compiler/link/registry-stub.js +212 -0
- package/dist/compiler/link/router-config.d.ts +11 -0
- package/dist/compiler/link/router-config.js +15 -0
- package/dist/compiler/link/router-css.d.ts +22 -0
- package/dist/compiler/link/router-css.js +142 -0
- package/dist/compiler/link/runtime-entry.d.ts +71 -0
- package/dist/compiler/link/runtime-entry.js +132 -0
- package/dist/compiler/link/server-manifest.d.ts +12 -0
- package/dist/compiler/link/server-manifest.js +45 -0
- package/dist/compiler/link/speculation.d.ts +17 -0
- package/dist/compiler/link/speculation.js +36 -0
- package/dist/compiler/link/transport.d.ts +31 -0
- package/dist/compiler/link/transport.js +67 -0
- package/dist/compiler/macros/bake.d.ts +20 -0
- package/dist/compiler/macros/bake.js +317 -0
- package/dist/compiler/macros/browser.d.ts +11 -0
- package/dist/compiler/macros/browser.js +69 -0
- package/dist/compiler/macros/dedent.d.ts +12 -0
- package/dist/compiler/macros/dedent.js +36 -0
- package/dist/compiler/macros/dollar.d.ts +15 -0
- package/dist/compiler/macros/dollar.js +387 -0
- package/dist/compiler/macros/pipeline.d.ts +31 -0
- package/dist/compiler/macros/pipeline.js +106 -0
- package/dist/compiler/macros/source.d.ts +6 -0
- package/dist/compiler/macros/source.js +127 -0
- package/dist/compiler/macros/store.d.ts +17 -0
- package/dist/compiler/macros/store.js +244 -0
- package/dist/compiler/macros/wire.d.ts +14 -0
- package/dist/compiler/macros/wire.js +160 -0
- package/dist/compiler/ownership-stamps.d.ts +6 -0
- package/dist/compiler/ownership-stamps.js +144 -0
- package/dist/compiler/parse/oxc.d.ts +34 -0
- package/dist/compiler/parse/oxc.js +59 -0
- package/dist/compiler/parse/scan.d.ts +43 -0
- package/dist/compiler/parse/scan.js +232 -0
- package/dist/compiler/program.d.ts +140 -0
- package/dist/compiler/program.js +242 -0
- package/dist/compiler/region/emit.d.ts +169 -0
- package/dist/compiler/region/emit.js +286 -0
- package/dist/compiler/region/identity.d.ts +28 -0
- package/dist/compiler/region/identity.js +75 -0
- package/dist/compiler/region/ir.d.ts +65 -0
- package/dist/compiler/region/ir.js +0 -0
- package/dist/compiler/region/transform.d.ts +178 -0
- package/dist/compiler/region/transform.js +1933 -0
- package/dist/compiler/script-request.d.ts +1 -0
- package/dist/compiler/script-request.js +43 -0
- package/dist/context-bridge.d.ts +65 -0
- package/dist/context-bridge.js +217 -0
- package/dist/context-registry.d.ts +40 -0
- package/dist/context-registry.js +15 -0
- package/dist/context.d.ts +72 -0
- package/dist/context.js +158 -0
- package/dist/current-region.d.ts +14 -0
- package/dist/current-region.js +36 -0
- package/dist/document.d.ts +41 -0
- package/dist/document.js +125 -0
- package/dist/entry-hydrate.d.ts +5 -0
- package/dist/entry-hydrate.js +42 -0
- package/dist/escape.d.ts +18 -0
- package/dist/escape.js +37 -0
- package/dist/events/bus.d.ts +33 -0
- package/dist/events/bus.js +153 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.js +4 -0
- package/dist/events/schema.d.ts +389 -0
- package/dist/events/schema.js +23 -0
- package/dist/events/server-registry.d.ts +7 -0
- package/dist/events/server-registry.js +13 -0
- package/dist/events/sinks.d.ts +64 -0
- package/dist/events/sinks.js +85 -0
- package/dist/fn-transport.d.ts +33 -0
- package/dist/fn-transport.js +140 -0
- package/dist/frame.d.ts +20 -0
- package/dist/frame.js +19 -0
- package/dist/holes-record.d.ts +6 -0
- package/dist/holes-record.js +8 -0
- package/dist/hooks.d.ts +43 -0
- package/dist/hooks.js +1191 -0
- package/dist/hydration-info.d.ts +1 -0
- package/dist/hydration-info.js +31 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/insights/attr-rules.d.ts +15 -0
- package/dist/insights/attr-rules.js +27 -0
- package/dist/insights/cpu.d.ts +82 -0
- package/dist/insights/cpu.js +177 -0
- package/dist/insights/fp-drift.d.ts +28 -0
- package/dist/insights/fp-drift.js +148 -0
- package/dist/insights/hole-segments.d.ts +26 -0
- package/dist/insights/hole-segments.js +50 -0
- package/dist/insights/html-diff.d.ts +25 -0
- package/dist/insights/html-diff.js +157 -0
- package/dist/insights/hydration-hazards.d.ts +36 -0
- package/dist/insights/hydration-hazards.js +136 -0
- package/dist/insights/hydration-status.d.ts +2 -0
- package/dist/insights/hydration-status.js +0 -0
- package/dist/insights/index.d.ts +14 -0
- package/dist/insights/index.js +12 -0
- package/dist/insights/page-assets.d.ts +211 -0
- package/dist/insights/page-assets.js +608 -0
- package/dist/insights/page-insights.d.ts +749 -0
- package/dist/insights/page-insights.js +2157 -0
- package/dist/insights/session-data.d.ts +108 -0
- package/dist/insights/session-data.js +0 -0
- package/dist/insights/session-insights.d.ts +121 -0
- package/dist/insights/session-insights.js +548 -0
- package/dist/insights/switch.d.ts +53 -0
- package/dist/insights/switch.js +91 -0
- package/dist/insights/testing-version.d.ts +19 -0
- package/dist/insights/testing-version.js +21 -0
- package/dist/insights/third-party.d.ts +75 -0
- package/dist/insights/third-party.js +160 -0
- package/dist/internal-instruments.d.ts +13 -0
- package/dist/internal-instruments.js +12 -0
- package/dist/internal-reconcile.d.ts +3 -0
- package/dist/internal-reconcile.js +3 -0
- package/dist/internal-register.d.ts +7 -0
- package/dist/internal-register.js +7 -0
- package/dist/internal-server.d.ts +7 -0
- package/dist/internal-server.js +7 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.js +13 -0
- package/dist/island-graph.d.ts +36 -0
- package/dist/island-graph.js +89 -0
- package/dist/keep-fallback-marker.d.ts +7 -0
- package/dist/keep-fallback-marker.js +9 -0
- package/dist/keep-fallback.d.ts +13 -0
- package/dist/keep-fallback.js +39 -0
- package/dist/kit-paths.d.ts +2 -0
- package/dist/kit-paths.js +39 -0
- package/dist/late-region-registry.d.ts +40 -0
- package/dist/late-region-registry.js +36 -0
- package/dist/live-transport.d.ts +57 -0
- package/dist/live-transport.js +145 -0
- package/dist/markup.d.ts +4 -0
- package/dist/markup.js +4 -0
- package/dist/own-package.d.ts +15 -0
- package/dist/own-package.js +20 -0
- package/dist/page-defer.d.ts +33 -0
- package/dist/page-defer.js +35 -0
- package/dist/page-facts-script.d.ts +7 -0
- package/dist/page-facts-script.js +9 -0
- package/dist/page-seed-registry.d.ts +72 -0
- package/dist/page-seed-registry.js +31 -0
- package/dist/plugin/capability.d.ts +14 -0
- package/dist/plugin/capability.js +44 -0
- package/dist/plugin/client.d.ts +39 -0
- package/dist/plugin/client.js +6 -0
- package/dist/plugin/css.d.ts +3 -0
- package/dist/plugin/css.js +54 -0
- package/dist/plugin/facts.d.ts +42 -0
- package/dist/plugin/facts.js +37 -0
- package/dist/plugin/hooks.d.ts +33 -0
- package/dist/plugin/hooks.js +38 -0
- package/dist/plugin/index.d.ts +127 -0
- package/dist/plugin/index.js +26 -0
- package/dist/plugin/routes.d.ts +32 -0
- package/dist/plugin/routes.js +35 -0
- package/dist/plugin/server.d.ts +27 -0
- package/dist/plugin/server.js +92 -0
- package/dist/plugin/standard-schema.d.ts +27 -0
- package/dist/plugin/standard-schema.js +0 -0
- package/dist/plugin/testing.d.ts +13 -0
- package/dist/plugin/testing.js +54 -0
- package/dist/plugin/utils.d.ts +13 -0
- package/dist/plugin/utils.js +19 -0
- package/dist/portable-form.d.ts +22 -0
- package/dist/portable-form.js +52 -0
- package/dist/preference.d.ts +35 -0
- package/dist/preference.js +84 -0
- package/dist/preload.d.ts +1 -0
- package/dist/preload.js +21 -0
- package/dist/ref-watch.d.ts +31 -0
- package/dist/ref-watch.js +66 -0
- package/dist/ref.d.ts +124 -0
- package/dist/ref.js +272 -0
- package/dist/region-brand.d.ts +8 -0
- package/dist/region-brand.js +10 -0
- package/dist/region-core.d.ts +2 -0
- package/dist/region-core.js +1 -0
- package/dist/region-snippet.d.ts +73 -0
- package/dist/region-snippet.js +351 -0
- package/dist/region.d.ts +127 -0
- package/dist/region.js +162 -0
- package/dist/request-event.d.ts +1 -0
- package/dist/request-event.js +37 -0
- package/dist/router-css.d.ts +39 -0
- package/dist/router-css.js +66 -0
- package/dist/runtime/app-transport.d.ts +2 -0
- package/dist/runtime/app-transport.js +13 -0
- package/dist/runtime/beacon.d.ts +271 -0
- package/dist/runtime/beacon.js +2190 -0
- package/dist/runtime/boot-link.d.ts +1 -0
- package/dist/runtime/boot-link.js +44 -0
- package/dist/runtime/client-hooks.d.ts +5 -0
- package/dist/runtime/client-hooks.js +22 -0
- package/dist/runtime/client-plugins.d.ts +8 -0
- package/dist/runtime/client-plugins.js +34 -0
- package/dist/runtime/concurrency.d.ts +12 -0
- package/dist/runtime/concurrency.js +29 -0
- package/dist/runtime/connected.d.ts +12 -0
- package/dist/runtime/connected.js +16 -0
- package/dist/runtime/context.d.ts +1 -0
- package/dist/runtime/context.js +19 -0
- package/dist/runtime/core.d.ts +15 -0
- package/dist/runtime/core.js +1173 -0
- package/dist/runtime/drift-watch.d.ts +9 -0
- package/dist/runtime/drift-watch.js +60 -0
- package/dist/runtime/entry-locations.d.ts +33 -0
- package/dist/runtime/entry-locations.js +119 -0
- package/dist/runtime/foreign-props.d.ts +8 -0
- package/dist/runtime/foreign-props.js +14 -0
- package/dist/runtime/form-continuity.d.ts +10 -0
- package/dist/runtime/form-continuity.js +107 -0
- package/dist/runtime/frame-nav.d.ts +36 -0
- package/dist/runtime/frame-nav.js +225 -0
- package/dist/runtime/frame-store.d.ts +62 -0
- package/dist/runtime/frame-store.js +214 -0
- package/dist/runtime/frames.d.ts +1 -0
- package/dist/runtime/frames.js +25 -0
- package/dist/runtime/full.d.ts +4 -0
- package/dist/runtime/full.js +32 -0
- package/dist/runtime/hash.d.ts +41 -0
- package/dist/runtime/hash.js +79 -0
- package/dist/runtime/hole-facts.d.ts +8 -0
- package/dist/runtime/hole-facts.js +57 -0
- package/dist/runtime/host-classes.d.ts +24 -0
- package/dist/runtime/host-classes.js +43 -0
- package/dist/runtime/hydrate-core.d.ts +101 -0
- package/dist/runtime/hydrate-core.js +605 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/interaction-replay.d.ts +11 -0
- package/dist/runtime/interaction-replay.js +70 -0
- package/dist/runtime/interaction.d.ts +33 -0
- package/dist/runtime/interaction.js +217 -0
- package/dist/runtime/island-graph-preload.d.ts +13 -0
- package/dist/runtime/island-graph-preload.js +99 -0
- package/dist/runtime/kit-boot.d.ts +29 -0
- package/dist/runtime/kit-boot.js +60 -0
- package/dist/runtime/kit-page-thread.svelte.d.ts +1 -0
- package/dist/runtime/kit-page-thread.svelte.js +116 -0
- package/dist/runtime/lake-anchors.d.ts +13 -0
- package/dist/runtime/lake-anchors.js +19 -0
- package/dist/runtime/lakes.d.ts +15 -0
- package/dist/runtime/lakes.js +212 -0
- package/dist/runtime/live.d.ts +3 -0
- package/dist/runtime/live.js +17 -0
- package/dist/runtime/load-scheduler.d.ts +53 -0
- package/dist/runtime/load-scheduler.js +317 -0
- package/dist/runtime/morph.d.ts +42 -0
- package/dist/runtime/morph.js +671 -0
- package/dist/runtime/nav-handle.d.ts +25 -0
- package/dist/runtime/nav-handle.js +71 -0
- package/dist/runtime/nav-hooks.d.ts +2 -0
- package/dist/runtime/nav-hooks.js +23 -0
- package/dist/runtime/nearest-attr.d.ts +4 -0
- package/dist/runtime/nearest-attr.js +16 -0
- package/dist/runtime/observe.d.ts +27 -0
- package/dist/runtime/observe.js +63 -0
- package/dist/runtime/own-cost.d.ts +9 -0
- package/dist/runtime/own-cost.js +35 -0
- package/dist/runtime/ownership.d.ts +101 -0
- package/dist/runtime/ownership.js +115 -0
- package/dist/runtime/page-cache.d.ts +23 -0
- package/dist/runtime/page-cache.js +74 -0
- package/dist/runtime/page-defer.d.ts +14 -0
- package/dist/runtime/page-defer.js +103 -0
- package/dist/runtime/parse-html.d.ts +40 -0
- package/dist/runtime/parse-html.js +81 -0
- package/dist/runtime/reconcile.d.ts +41 -0
- package/dist/runtime/reconcile.js +194 -0
- package/dist/runtime/region-attrs.d.ts +95 -0
- package/dist/runtime/region-attrs.js +153 -0
- package/dist/runtime/region-endpoint-url.d.ts +76 -0
- package/dist/runtime/region-endpoint-url.js +169 -0
- package/dist/runtime/region-ids.d.ts +8 -0
- package/dist/runtime/region-ids.js +33 -0
- package/dist/runtime/remote-seeds.d.ts +2 -0
- package/dist/runtime/remote-seeds.js +21 -0
- package/dist/runtime/render-blocking.d.ts +2 -0
- package/dist/runtime/render-blocking.js +30 -0
- package/dist/runtime/restore.d.ts +34 -0
- package/dist/runtime/restore.js +390 -0
- package/dist/runtime/router-nav.d.ts +63 -0
- package/dist/runtime/router-nav.js +740 -0
- package/dist/runtime/router.d.ts +201 -0
- package/dist/runtime/router.js +593 -0
- package/dist/runtime/schedule.d.ts +49 -0
- package/dist/runtime/schedule.js +256 -0
- package/dist/runtime/seeds.d.ts +50 -0
- package/dist/runtime/seeds.js +208 -0
- package/dist/runtime/session.d.ts +52 -0
- package/dist/runtime/session.js +130 -0
- package/dist/runtime/sidecar.d.ts +3 -0
- package/dist/runtime/sidecar.js +56 -0
- package/dist/runtime/slots.d.ts +183 -0
- package/dist/runtime/slots.js +44 -0
- package/dist/runtime/spa-cacheable.d.ts +7 -0
- package/dist/runtime/spa-cacheable.js +18 -0
- package/dist/runtime/speculate-hint.d.ts +1 -0
- package/dist/runtime/speculate-hint.js +35 -0
- package/dist/runtime/svelte-warnings.d.ts +28 -0
- package/dist/runtime/svelte-warnings.js +71 -0
- package/dist/runtime/wire-classes.d.ts +3 -0
- package/dist/runtime/wire-classes.js +69 -0
- package/dist/runtime/wire-format.d.ts +7 -0
- package/dist/runtime/wire-format.js +22 -0
- package/dist/script.d.ts +134 -0
- package/dist/script.js +184 -0
- package/dist/seed-refs.d.ts +105 -0
- package/dist/seed-refs.js +487 -0
- package/dist/server/capability-lifetime.d.ts +28 -0
- package/dist/server/capability-lifetime.js +31 -0
- package/dist/server/dead-kit-resolves.d.ts +1 -0
- package/dist/server/dead-kit-resolves.js +39 -0
- package/dist/server/document-assembly.d.ts +30 -0
- package/dist/server/document-assembly.js +26 -0
- package/dist/server/document-tail.d.ts +113 -0
- package/dist/server/document-tail.js +208 -0
- package/dist/server/endpoint.d.ts +51 -0
- package/dist/server/endpoint.js +90 -0
- package/dist/server/entry-location.d.ts +8 -0
- package/dist/server/entry-location.js +29 -0
- package/dist/server/fingerprint.d.ts +1 -0
- package/dist/server/fingerprint.js +25 -0
- package/dist/server/head-presence.d.ts +45 -0
- package/dist/server/head-presence.js +156 -0
- package/dist/server/hmac.d.ts +38 -0
- package/dist/server/hmac.js +89 -0
- package/dist/server/hole-graph.d.ts +7 -0
- package/dist/server/hole-graph.js +71 -0
- package/dist/server/hole-urls.d.ts +3 -0
- package/dist/server/hole-urls.js +76 -0
- package/dist/server/html-scan.d.ts +19 -0
- package/dist/server/html-scan.js +60 -0
- package/dist/server/kit-context.d.ts +78 -0
- package/dist/server/kit-context.js +110 -0
- package/dist/server/late-wire.d.ts +22 -0
- package/dist/server/late-wire.js +28 -0
- package/dist/server/page-facts.d.ts +25 -0
- package/dist/server/page-facts.js +138 -0
- package/dist/server/page-seed.d.ts +33 -0
- package/dist/server/page-seed.js +60 -0
- package/dist/server/page-stream.d.ts +55 -0
- package/dist/server/page-stream.js +121 -0
- package/dist/server/payload.d.ts +6 -0
- package/dist/server/payload.js +22 -0
- package/dist/server/personal-response.d.ts +6 -0
- package/dist/server/personal-response.js +13 -0
- package/dist/server/props-wire.d.ts +56 -0
- package/dist/server/props-wire.js +178 -0
- package/dist/server/rate-limit.d.ts +22 -0
- package/dist/server/rate-limit.js +63 -0
- package/dist/server/region-css.d.ts +5 -0
- package/dist/server/region-css.js +30 -0
- package/dist/server/region-endpoint.d.ts +35 -0
- package/dist/server/region-endpoint.js +142 -0
- package/dist/server/region-props.d.ts +6 -0
- package/dist/server/region-props.js +44 -0
- package/dist/server/remote-seed-gate.d.ts +50 -0
- package/dist/server/remote-seed-gate.js +66 -0
- package/dist/server/render-cache.d.ts +26 -0
- package/dist/server/render-cache.js +51 -0
- package/dist/server/render-page.d.ts +51 -0
- package/dist/server/render-page.js +176 -0
- package/dist/server/render-region-html.d.ts +2 -0
- package/dist/server/render-region-html.js +19 -0
- package/dist/server/request-stats.d.ts +174 -0
- package/dist/server/request-stats.js +54 -0
- package/dist/server/reversible.d.ts +83 -0
- package/dist/server/reversible.js +994 -0
- package/dist/server/seed-shape.d.ts +22 -0
- package/dist/server/seed-shape.js +24 -0
- package/dist/server/shared-cache.d.ts +35 -0
- package/dist/server/shared-cache.js +104 -0
- package/dist/server/signing-key.d.ts +11 -0
- package/dist/server/signing-key.js +47 -0
- package/dist/server/sized-lru.d.ts +20 -0
- package/dist/server/sized-lru.js +68 -0
- package/dist/server/split-regions.d.ts +81 -0
- package/dist/server/split-regions.js +368 -0
- package/dist/server/stream-regions.d.ts +5 -0
- package/dist/server/stream-regions.js +36 -0
- package/dist/shared-state.d.ts +7 -0
- package/dist/shared-state.js +152 -0
- package/dist/shims/app-environment.d.ts +4 -0
- package/dist/shims/app-environment.js +6 -0
- package/dist/shims/app-navigation.d.ts +33 -0
- package/dist/shims/app-navigation.js +119 -0
- package/dist/shims/app-paths.d.ts +6 -0
- package/dist/shims/app-paths.js +18 -0
- package/dist/shims/app-state.svelte.d.ts +23 -0
- package/dist/shims/app-state.svelte.js +50 -0
- package/dist/shims/app-stores.d.ts +21 -0
- package/dist/shims/app-stores.js +54 -0
- package/dist/shims/kit-bridge.d.ts +29 -0
- package/dist/shims/kit-bridge.js +7 -0
- package/dist/shims/kit-remote/client-stub.d.ts +27 -0
- package/dist/shims/kit-remote/client-stub.js +43 -0
- package/dist/shims/kit-remote/paths-internal-stub.d.ts +3 -0
- package/dist/shims/kit-remote/paths-internal-stub.js +5 -0
- package/dist/shims/kit-remote/remote-cache.d.ts +49 -0
- package/dist/shims/kit-remote/remote-cache.js +73 -0
- package/dist/shims/kit-remote/state-stub.d.ts +8 -0
- package/dist/shims/kit-remote/state-stub.js +8 -0
- package/dist/shims/page-store.svelte.d.ts +39 -0
- package/dist/shims/page-store.svelte.js +77 -0
- package/dist/source.d.ts +29 -0
- package/dist/source.js +87 -0
- package/dist/store-transport.d.ts +86 -0
- package/dist/store-transport.js +229 -0
- package/dist/tool-fetches.d.ts +5 -0
- package/dist/tool-fetches.js +41 -0
- package/dist/transport.d.ts +48 -0
- package/dist/transport.js +181 -0
- package/dist/unscoped-css.d.ts +26 -0
- package/dist/unscoped-css.js +53 -0
- package/dist/vite/dev-maps.d.ts +33 -0
- package/dist/vite/dev-maps.js +140 -0
- package/dist/vite/index.d.ts +19 -0
- package/dist/vite/index.js +820 -0
- package/dist/vite/kit-dirs.d.ts +7 -0
- package/dist/vite/kit-dirs.js +67 -0
- package/dist/vite/late-island.d.ts +25 -0
- package/dist/vite/late-island.js +33 -0
- package/dist/vite/module-map.d.ts +8 -0
- package/dist/vite/module-map.js +144 -0
- package/dist/vite/options.d.ts +208 -0
- package/dist/vite/options.js +74 -0
- package/dist/vite/package-files.d.ts +3 -0
- package/dist/vite/package-files.js +84 -0
- package/dist/vite/paths.d.ts +45 -0
- package/dist/vite/paths.js +112 -0
- package/dist/vite/plugin-api.d.ts +166 -0
- package/dist/vite/plugin-api.js +212 -0
- package/dist/vite/profiler-maps.d.ts +23 -0
- package/dist/vite/profiler-maps.js +178 -0
- package/dist/vite/server-sourcemaps.d.ts +8 -0
- package/dist/vite/server-sourcemaps.js +80 -0
- package/dist/vite/sourcemaps.d.ts +18 -0
- package/dist/vite/sourcemaps.js +80 -0
- package/dist/vite/style-preprocess.d.ts +2 -0
- package/dist/vite/style-preprocess.js +96 -0
- package/package.json +180 -6
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { V_SERVER_ISLANDS } from "../ids.js";
|
|
2
|
+
// src/compiler/link/server-manifest.ts
|
|
3
|
+
/** The SERVER-island ids the manifest carries right now (deferred / server-picked regions). */
|
|
4
|
+
function server_island_ids(program) {
|
|
5
|
+
const ids = [];
|
|
6
|
+
for (const [iid, virtualPath] of program.by_id) if (program.registry.get(virtualPath)?.server) ids.push(iid);
|
|
7
|
+
return ids;
|
|
8
|
+
}
|
|
9
|
+
function server_manifest_module(ssr, program, is_dev, devUrlFor, publicUrlFor) {
|
|
10
|
+
if (!ssr) return `export const load_islands = () => Promise.resolve({ islands: {} });\nexport const island_url = {};\nexport const island_name = {};\nexport const island_render = {};\nexport const render_island = {};\nexport const island_reads_page_data = null;`;
|
|
11
|
+
const urls = [];
|
|
12
|
+
const names = [];
|
|
13
|
+
const renders = [];
|
|
14
|
+
/** render id → the server entry that renders it (the smallest id: one answer per build) */
|
|
15
|
+
const by_render = /* @__PURE__ */ new Map();
|
|
16
|
+
for (const [iid, virtualPath] of program.by_id) {
|
|
17
|
+
const reg = program.registry.get(virtualPath);
|
|
18
|
+
if (!reg?.server) continue;
|
|
19
|
+
if (reg.renderId) {
|
|
20
|
+
renders.push(` ${JSON.stringify(iid)}: ${JSON.stringify(reg.renderId)}`);
|
|
21
|
+
const seen = by_render.get(reg.renderId);
|
|
22
|
+
if (seen === void 0 || iid < seen) by_render.set(reg.renderId, iid);
|
|
23
|
+
}
|
|
24
|
+
const file = reg.componentPath ?? "";
|
|
25
|
+
const base = file.slice(file.lastIndexOf("/") + 1);
|
|
26
|
+
if (base.endsWith(".svelte")) names.push(` ${JSON.stringify(iid)}: ${JSON.stringify(base.slice(0, -7))}`);
|
|
27
|
+
urls.push(` ${JSON.stringify(iid)}: ${JSON.stringify(is_dev ? devUrlFor(virtualPath) : publicUrlFor(iid))}`);
|
|
28
|
+
}
|
|
29
|
+
return `export const load_islands = () => import(${JSON.stringify(V_SERVER_ISLANDS)});\nexport const island_url = {\n${urls.join(",\n")}\n};\nexport const island_name = {\n${names.join(",\n")}\n};\nexport const island_render = {\n${renders.join(",\n")}\n};\nexport const render_island = {\n${[...by_render].map(([r, iid]) => ` ${JSON.stringify(r)}: ${JSON.stringify(iid)}`).join(",\n")}\n};\nexport const island_reads_page_data = ${is_dev ? "null" : PAGE_DATA_READS_PLACEHOLDER};`;
|
|
30
|
+
}
|
|
31
|
+
/** `virtual:ogygia/server-islands`: each SERVER island's loader, `id → () => import(entry)` (empty on
|
|
32
|
+
* the client). Imported only by the manifest's `load_islands()` — never statically. */
|
|
33
|
+
function server_islands_module(ssr, program) {
|
|
34
|
+
const entries = [];
|
|
35
|
+
if (ssr) {
|
|
36
|
+
for (const [iid, virtualPath] of program.by_id) if (program.registry.get(virtualPath)?.server) entries.push(` ${JSON.stringify(iid)}: () => import(${JSON.stringify(virtualPath)})`);
|
|
37
|
+
}
|
|
38
|
+
return `export const islands = {\n${entries.join(",\n")}\n};\n`;
|
|
39
|
+
}
|
|
40
|
+
/** The token the build replaces with its answer (driver `patch_page_data_reads`), inside a string
|
|
41
|
+
* literal the bundler cannot fold: a plain `null` placeholder was inlined into every reader as the
|
|
42
|
+
* constant it was (every hole then looked its page up). Unpatched it parses to nothing → `null`. */
|
|
43
|
+
const PAGE_DATA_READS_TOKEN = "__OGYGIA_PAGE_DATA_READS__";
|
|
44
|
+
const PAGE_DATA_READS_PLACEHOLDER = `(() => { try { return JSON.parse("${PAGE_DATA_READS_TOKEN}"); } catch { return null; } })()`;
|
|
45
|
+
export { PAGE_DATA_READS_PLACEHOLDER, PAGE_DATA_READS_TOKEN, server_island_ids, server_islands_module, server_manifest_module };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MPA-mode Speculation Rules — the static `prerender` / `prefetch` JSON the server handle injects
|
|
3
|
+
* into every page head when the SPA router is OFF (`router: false`). Pure: no build state, one
|
|
4
|
+
* deterministic string. Covered by unit tests.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Static Speculation Rules for MPA mode (`router: false`) — the server handle injects them into
|
|
8
|
+
* every page head. Document rules covering same-origin links, with a per-link/subtree opt-out
|
|
9
|
+
* (`data-ogygia-speculate="off"`, re-enable with `"on"`); the region endpoint is never speculated.
|
|
10
|
+
* BOTH lists ship: a prerender-capable browser prerenders (prefetch is its first stage), a
|
|
11
|
+
* prefetch-only browser prefetches, an unsupporting one ignores the JSON entirely — graceful by
|
|
12
|
+
* construction, no JS fallback. In SPA mode no rules exist at all: speculation caches serve real
|
|
13
|
+
* navigations only, which a body-swap router can never read.
|
|
14
|
+
*
|
|
15
|
+
* @internal Exported for unit tests.
|
|
16
|
+
*/
|
|
17
|
+
export declare function mpaSpeculationRules(endpoint?: string): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// src/compiler/link/speculation.ts
|
|
2
|
+
/**
|
|
3
|
+
* MPA-mode Speculation Rules — the static `prerender` / `prefetch` JSON the server handle injects
|
|
4
|
+
* into every page head when the SPA router is OFF (`router: false`). Pure: no build state, one
|
|
5
|
+
* deterministic string. Covered by unit tests.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Static Speculation Rules for MPA mode (`router: false`) — the server handle injects them into
|
|
9
|
+
* every page head. Document rules covering same-origin links, with a per-link/subtree opt-out
|
|
10
|
+
* (`data-ogygia-speculate="off"`, re-enable with `"on"`); the region endpoint is never speculated.
|
|
11
|
+
* BOTH lists ship: a prerender-capable browser prerenders (prefetch is its first stage), a
|
|
12
|
+
* prefetch-only browser prefetches, an unsupporting one ignores the JSON entirely — graceful by
|
|
13
|
+
* construction, no JS fallback. In SPA mode no rules exist at all: speculation caches serve real
|
|
14
|
+
* navigations only, which a body-swap router can never read.
|
|
15
|
+
*
|
|
16
|
+
* @internal Exported for unit tests.
|
|
17
|
+
*/
|
|
18
|
+
function mpaSpeculationRules(endpoint = "/__ogygia__") {
|
|
19
|
+
const where = { and: [
|
|
20
|
+
{ href_matches: "/*" },
|
|
21
|
+
{ not: { href_matches: endpoint + "*" } },
|
|
22
|
+
{ not: { selector_matches: "[rel~=nofollow]" } },
|
|
23
|
+
{ or: [{ not: { selector_matches: "[data-ogygia-speculate=\"off\"], [data-ogygia-speculate=\"off\"] *" } }, { selector_matches: "[data-ogygia-speculate=\"on\"], [data-ogygia-speculate=\"on\"] *" }] }
|
|
24
|
+
] };
|
|
25
|
+
return JSON.stringify({
|
|
26
|
+
prerender: [{
|
|
27
|
+
where,
|
|
28
|
+
eagerness: "moderate"
|
|
29
|
+
}],
|
|
30
|
+
prefetch: [{
|
|
31
|
+
where,
|
|
32
|
+
eagerness: "moderate"
|
|
33
|
+
}]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export { mpaSpeculationRules };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `virtual:ogygia/transport` emitter — re-exports the app's universal `transport` hook (or an empty
|
|
3
|
+
* map) for the client remote wire codec. Universal hooks are isomorphic, so this is client-safe.
|
|
4
|
+
* Pure over the resolved absolute path to the app's universal hooks module (or null).
|
|
5
|
+
*/
|
|
6
|
+
export declare function transport_module(universal_hooks: string | null, kit_codec?: string | null): string;
|
|
7
|
+
/**
|
|
8
|
+
* `virtual:ogygia/kit-transport` emitter — the value behind the barrel's `ogygia.transport` (the Kit
|
|
9
|
+
* `transport` hook the app spreads into its universal hooks). GENERATED per-app, not a fixed export:
|
|
10
|
+
* the real `ogygiaTransport` statically pulls the whole codec cluster (wire/store/snippet/fn + region,
|
|
11
|
+
* ~9 kB) since a wired value can nest any other kind. A **pure-island** app crosses NOTHING through
|
|
12
|
+
* Kit's transport, so it gets an empty map and never bundles a decoder it can't use. `app_crosses_wire`
|
|
13
|
+
* is the compiler's own knowledge (a transportable class / portable snippet → the `wire` mark, plus a
|
|
14
|
+
* remote file or a `region`/content import) — never a scan for `ogygia.transport` in app source.
|
|
15
|
+
* `transport_spec` is the resolvable path to ogygia's own `transport.js` (dist).
|
|
16
|
+
*/
|
|
17
|
+
export declare function kit_transport_module(app_crosses_wire: boolean, transport_spec: string): string;
|
|
18
|
+
/** True when `src` produces a held region / transportable value that can cross Kit's `transport`. */
|
|
19
|
+
export declare function source_crosses_wire(src: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* `virtual:ogygia/transportables` emitter — where the `[ogygia.wire]` codecs come from, so an island
|
|
22
|
+
* receiving a transportable prop never has to import the class itself. Per leg:
|
|
23
|
+
* - SERVER: side-effect-imports every module that defines a transportable class (the region endpoint
|
|
24
|
+
* decodes signed props of any island; loaded once per process).
|
|
25
|
+
* - CLIENT: NO eager import — every island page used to download every transportable class of the
|
|
26
|
+
* app. It exports `wire_loaders`, a class module's tag path (root-relative, the part of a tag
|
|
27
|
+
* before `#`) → a lazy import; the runtime loads just the ones an island's props carry (the server
|
|
28
|
+
* stamps them on its props sidecar) before it decodes them.
|
|
29
|
+
* `modules` is the Program's set of transportable module paths (absolute); `rel` makes a tag path.
|
|
30
|
+
*/
|
|
31
|
+
export declare function transportables_module(modules: Iterable<string>, ssr: boolean, rel: (abs: string) => string, crosses_wire?: boolean): string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { OWN_SPECIFIER_SOURCE } from "../../own-package.js";
|
|
2
|
+
// src/compiler/link/transport.ts
|
|
3
|
+
/**
|
|
4
|
+
* `virtual:ogygia/transport` emitter — re-exports the app's universal `transport` hook (or an empty
|
|
5
|
+
* map) for the client remote wire codec. Universal hooks are isomorphic, so this is client-safe.
|
|
6
|
+
* Pure over the resolved absolute path to the app's universal hooks module (or null).
|
|
7
|
+
*/
|
|
8
|
+
function transport_module(universal_hooks, kit_codec = null) {
|
|
9
|
+
if (!universal_hooks) return `export const transport = {};\nexport const encoders = {};\nexport const decoders = {};`;
|
|
10
|
+
const src = `import * as hooks from ${JSON.stringify(universal_hooks)};\nexport const transport = hooks.transport || {};\nconst codecs = Object.entries(transport);\nexport const encoders = Object.fromEntries(codecs.map(([k, v]) => [k, v.encode]));\nexport const decoders = Object.fromEntries(codecs.map(([k, v]) => [k, v.decode]));`;
|
|
11
|
+
if (!kit_codec) return src;
|
|
12
|
+
return `import { init_transport } from ${JSON.stringify(kit_codec)};\n${src}\ninit_transport(transport);`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `virtual:ogygia/kit-transport` emitter — the value behind the barrel's `ogygia.transport` (the Kit
|
|
16
|
+
* `transport` hook the app spreads into its universal hooks). GENERATED per-app, not a fixed export:
|
|
17
|
+
* the real `ogygiaTransport` statically pulls the whole codec cluster (wire/store/snippet/fn + region,
|
|
18
|
+
* ~9 kB) since a wired value can nest any other kind. A **pure-island** app crosses NOTHING through
|
|
19
|
+
* Kit's transport, so it gets an empty map and never bundles a decoder it can't use. `app_crosses_wire`
|
|
20
|
+
* is the compiler's own knowledge (a transportable class / portable snippet → the `wire` mark, plus a
|
|
21
|
+
* remote file or a `region`/content import) — never a scan for `ogygia.transport` in app source.
|
|
22
|
+
* `transport_spec` is the resolvable path to ogygia's own `transport.js` (dist).
|
|
23
|
+
*/
|
|
24
|
+
function kit_transport_module(app_crosses_wire, transport_spec) {
|
|
25
|
+
if (!app_crosses_wire) return `export const transport = {};\n`;
|
|
26
|
+
return `export { ogygiaTransport as transport } from ${JSON.stringify(transport_spec)};\n`;
|
|
27
|
+
}
|
|
28
|
+
const OGYGIA_WIRE_NAMED = new RegExp(`import\\s+(?:type\\s+)?\\{([\\s\\S]*?)\\}\\s*from\\s*['"]${OWN_SPECIFIER_SOURCE}['"]`, "g");
|
|
29
|
+
const WIRE_API = /\b(?:region|Region|site)\b/;
|
|
30
|
+
const OGYGIA_CONTENT_IMPORT = /from\s*['"]@ogygia\/content(?:\/[a-z-]+)?['"]/;
|
|
31
|
+
const OGYGIA_NS_IMPORT = new RegExp(`import\\s*\\*\\s*as\\s+(\\w+)\\s*from\\s*['"]${OWN_SPECIFIER_SOURCE}['"]`);
|
|
32
|
+
const NS_WIRE_USAGE = /\b(\w+)\.(?:region|Region|site)\b/g;
|
|
33
|
+
/** True when `src` produces a held region / transportable value that can cross Kit's `transport`. */
|
|
34
|
+
function source_crosses_wire(src) {
|
|
35
|
+
if (OGYGIA_CONTENT_IMPORT.test(src)) return true;
|
|
36
|
+
OGYGIA_WIRE_NAMED.lastIndex = 0;
|
|
37
|
+
let m;
|
|
38
|
+
while (m = OGYGIA_WIRE_NAMED.exec(src)) if (WIRE_API.test(m[1])) return true;
|
|
39
|
+
const ns = OGYGIA_NS_IMPORT.exec(src);
|
|
40
|
+
if (!ns) return false;
|
|
41
|
+
NS_WIRE_USAGE.lastIndex = 0;
|
|
42
|
+
let u;
|
|
43
|
+
while (u = NS_WIRE_USAGE.exec(src)) if (u[1] === ns[1]) return true;
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* `virtual:ogygia/transportables` emitter — where the `[ogygia.wire]` codecs come from, so an island
|
|
48
|
+
* receiving a transportable prop never has to import the class itself. Per leg:
|
|
49
|
+
* - SERVER: side-effect-imports every module that defines a transportable class (the region endpoint
|
|
50
|
+
* decodes signed props of any island; loaded once per process).
|
|
51
|
+
* - CLIENT: NO eager import — every island page used to download every transportable class of the
|
|
52
|
+
* app. It exports `wire_loaders`, a class module's tag path (root-relative, the part of a tag
|
|
53
|
+
* before `#`) → a lazy import; the runtime loads just the ones an island's props carry (the server
|
|
54
|
+
* stamps them on its props sidecar) before it decodes them.
|
|
55
|
+
* `modules` is the Program's set of transportable module paths (absolute); `rel` makes a tag path.
|
|
56
|
+
*/
|
|
57
|
+
function transportables_module(modules, ssr, rel, crosses_wire = false) {
|
|
58
|
+
if (ssr) {
|
|
59
|
+
const imports = [];
|
|
60
|
+
for (const abs of modules) imports.push(`import ${JSON.stringify(abs)};`);
|
|
61
|
+
return imports.join("\n") + "\nexport const wire_loaders = {};\nexport const wire_all = false;\n";
|
|
62
|
+
}
|
|
63
|
+
const entries = [];
|
|
64
|
+
for (const abs of modules) entries.push(`${JSON.stringify(rel(abs))}: () => import(${JSON.stringify(abs)})`);
|
|
65
|
+
return `export const wire_loaders = {${entries.join(", ")}};\nexport const wire_all = ${crosses_wire && entries.length > 0};\n`;
|
|
66
|
+
}
|
|
67
|
+
export { kit_transport_module, source_crosses_wire, transport_module, transportables_module };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type AliasEntry = {
|
|
2
|
+
find: string | RegExp;
|
|
3
|
+
replacement: string;
|
|
4
|
+
};
|
|
5
|
+
export type BakeOptions = {
|
|
6
|
+
/** Content hash of the eval entry — names/isolates the bundle in the cache. */
|
|
7
|
+
hash: string;
|
|
8
|
+
/** `resolve.alias` entries so a baked `fn` can import `$lib/…`. */
|
|
9
|
+
alias: AliasEntry[];
|
|
10
|
+
/** Project root — anchors the `$lib` convention fallback. */
|
|
11
|
+
root: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Rewrite every `import.meta.og.bake(fn)` in `src` to its inlined, devalue-serialized result. ASYNC
|
|
15
|
+
* (bundles + executes). Returns the input unchanged (same reference) when there is nothing to do.
|
|
16
|
+
* Throws build-voice on a non-serializable result or an `fn` that references non-imported scope.
|
|
17
|
+
*/
|
|
18
|
+
export declare function rewrite_bake(src: string, id: string, opts: Omit<BakeOptions, "hash"> & {
|
|
19
|
+
markupExts?: readonly string[];
|
|
20
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { fs, path } from "../host.js";
|
|
2
|
+
import { og_member } from "./wire.js";
|
|
3
|
+
import { parse_module } from "../parse/oxc.js";
|
|
4
|
+
import { og_js_regions } from "../parse/scan.js";
|
|
5
|
+
import { BuildCache } from "../../build-cache.js";
|
|
6
|
+
import { uneval } from "devalue";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
// src/compiler/macros/bake.ts
|
|
9
|
+
/**
|
|
10
|
+
* `import.meta.og.bake(fn)` — run `fn` at BUILD, serialize its result, inline it as a constant.
|
|
11
|
+
*
|
|
12
|
+
* const nav = import.meta.og.bake(() => buildNav()); // → const nav = {…the computed tree…}
|
|
13
|
+
*
|
|
14
|
+
* At build the macro bundles `fn` together with the module's imports (via the app's vite / rolldown, aliases resolved),
|
|
15
|
+
* executes the bundle in Node, `devalue.uneval`s the result, and rewrites the call to that literal.
|
|
16
|
+
* At runtime there is no function and no work — just the answer, even in client code. "Run at build,
|
|
17
|
+
* ship the answer." Content-addressed, so an unchanged `fn` (same source + same imports) re-bakes
|
|
18
|
+
* only when its inputs change.
|
|
19
|
+
*
|
|
20
|
+
* The CONTRACT (like Bun's macros): `fn` is self-contained — it may use the module's IMPORTS and
|
|
21
|
+
* literals, and `await` freely, but must not close over the module's other local variables (the
|
|
22
|
+
* eval bundle carries the imports, not the surrounding scope). Its result must be devalue-serializable
|
|
23
|
+
* (JSON + Date/Map/Set/RegExp/BigInt/…): a function or Promise in the result is a build error. Both
|
|
24
|
+
* violations surface as build-voice errors naming the file and line. Node-only.
|
|
25
|
+
*/
|
|
26
|
+
const REGEX_SPECIAL_G = /[.*+?^${}()|[\]\\]/g;
|
|
27
|
+
const LEADING_SLASH_RE = /^\//;
|
|
28
|
+
/** bake's corner of the shared build cache — the transient eval bundles live here (never committed;
|
|
29
|
+
* written and deleted per bake). All writes go through the cache interface, like the git checkouts. */
|
|
30
|
+
const bake_cache = new BuildCache("bake");
|
|
31
|
+
const MARKER = "import.meta.og.bake";
|
|
32
|
+
function walk(node, visit) {
|
|
33
|
+
visit(node);
|
|
34
|
+
for (const key in node) {
|
|
35
|
+
if (key === "type" || key === "start" || key === "end") continue;
|
|
36
|
+
const child = node[key];
|
|
37
|
+
if (Array.isArray(child)) {
|
|
38
|
+
for (const c of child) if (c && typeof c === "object" && typeof c.type === "string") walk(c, visit);
|
|
39
|
+
} else if (child && typeof child === "object" && typeof child.type === "string") walk(child, visit);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function line_of(src, offset) {
|
|
43
|
+
let line = 1;
|
|
44
|
+
for (let i = 0; i < offset && i < src.length; i++) if (src[i] === "\n") line++;
|
|
45
|
+
return line;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Collect import declarations (with bound names) and every bake() call across the module's JS
|
|
49
|
+
* regions — whole file for `.ts`/`.js`, each `<script>` block for `.svelte`. All spans are ABSOLUTE
|
|
50
|
+
* (offset-mapped from each region into `src`), so an edit splices straight into `src`. Returns null
|
|
51
|
+
* when no region parses (a half-typed file waits). `markup_exts` is the construct-host set.
|
|
52
|
+
*/
|
|
53
|
+
function scan(src, id, markup_exts) {
|
|
54
|
+
const regions = og_js_regions(src, id, markup_exts);
|
|
55
|
+
if (!regions) return null;
|
|
56
|
+
const imports = [];
|
|
57
|
+
const calls = [];
|
|
58
|
+
let any = false;
|
|
59
|
+
for (const region of regions) {
|
|
60
|
+
const { program, ok } = parse_module(region.code, id);
|
|
61
|
+
if (!ok || !program) continue;
|
|
62
|
+
any = true;
|
|
63
|
+
const off = region.offset;
|
|
64
|
+
for (const n of program.body ?? []) {
|
|
65
|
+
if (n.type !== "ImportDeclaration") continue;
|
|
66
|
+
const names = [];
|
|
67
|
+
for (const s of n.specifiers ?? []) if (s.local?.name) names.push(s.local.name);
|
|
68
|
+
imports.push({
|
|
69
|
+
start: off + n.start,
|
|
70
|
+
end: off + n.end,
|
|
71
|
+
text: region.code.slice(n.start, n.end),
|
|
72
|
+
names
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
walk(program, (n) => {
|
|
76
|
+
if (n.type !== "CallExpression" || og_member(n.callee) !== "bake") return;
|
|
77
|
+
const abs = off + n.start;
|
|
78
|
+
const args = n.arguments ?? [];
|
|
79
|
+
if (args.length !== 1) throw new Error(`[ogygia] ${id}:${line_of(src, abs)} — import.meta.og.bake(fn) takes exactly one argument (a function).`);
|
|
80
|
+
const a = args[0];
|
|
81
|
+
if (a.type !== "ArrowFunctionExpression" && a.type !== "FunctionExpression") throw new Error(`[ogygia] ${id}:${line_of(src, abs)} — import.meta.og.bake(fn): the argument must be a function (\`() => …\`).`);
|
|
82
|
+
calls.push({
|
|
83
|
+
start: abs,
|
|
84
|
+
end: off + n.end,
|
|
85
|
+
fn: region.code.slice(a.start, a.end)
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return any ? {
|
|
90
|
+
imports,
|
|
91
|
+
calls
|
|
92
|
+
} : null;
|
|
93
|
+
}
|
|
94
|
+
/** The imports the EVAL bundle needs: those whose bound name appears (word-boundary) in some bake
|
|
95
|
+
* fn. Excludes everything the fns don't use — crucially a `.svelte`'s component imports, which
|
|
96
|
+
* rolldown couldn't execute anyway. */
|
|
97
|
+
function eval_imports(imports, calls) {
|
|
98
|
+
const fnText = calls.map((c) => c.fn).join("\n");
|
|
99
|
+
return imports.filter((imp) => imp.names.some((name) => new RegExp(`(?<![\\w$])${name.replace(REGEX_SPECIAL_G, "\\$&")}(?![\\w$])`).test(fnText)));
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Which imports become UNUSED once every bake call is replaced by its result? An import is removable
|
|
103
|
+
* when none of its bound names appears anywhere OUTSIDE the import statements and the bake spans — so
|
|
104
|
+
* the binding was used only to feed a baked function. Over-conservative on purpose (a word-boundary
|
|
105
|
+
* text scan of the remainder counts property keys / strings as uses too): it may KEEP a truly-dead
|
|
106
|
+
* import, never REMOVE a live one. A kept-but-dead import just tree-shakes in the final bundle; a
|
|
107
|
+
* wrongly-removed one would break the module.
|
|
108
|
+
*/
|
|
109
|
+
function dead_imports(src, imports, calls) {
|
|
110
|
+
const blanks = [...imports.map((i) => [i.start, i.end]), ...calls.map((c) => [c.start, c.end])].sort((a, b) => a[0] - b[0]);
|
|
111
|
+
let remainder = "";
|
|
112
|
+
let last = 0;
|
|
113
|
+
for (const [s, e] of blanks) {
|
|
114
|
+
remainder += src.slice(last, s) + " ".repeat(e - s);
|
|
115
|
+
last = e;
|
|
116
|
+
}
|
|
117
|
+
remainder += src.slice(last);
|
|
118
|
+
return imports.filter((imp) => imp.names.length > 0 && imp.names.every((name) => {
|
|
119
|
+
return !new RegExp(`(?<![\\w$])${name.replace(REGEX_SPECIAL_G, "\\$&")}(?![\\w$])`).test(remainder);
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
const RESOLVE_EXTS = [
|
|
123
|
+
"",
|
|
124
|
+
".ts",
|
|
125
|
+
".tsx",
|
|
126
|
+
".mts",
|
|
127
|
+
".cts",
|
|
128
|
+
".js",
|
|
129
|
+
".mjs",
|
|
130
|
+
".cjs",
|
|
131
|
+
".jsx",
|
|
132
|
+
".json"
|
|
133
|
+
];
|
|
134
|
+
const INDEX_EXTS = [
|
|
135
|
+
"/index.ts",
|
|
136
|
+
"/index.mts",
|
|
137
|
+
"/index.js",
|
|
138
|
+
"/index.mjs",
|
|
139
|
+
"/index.jsx",
|
|
140
|
+
"/index.tsx"
|
|
141
|
+
];
|
|
142
|
+
/** Resolve a relative specifier against `dir` to an existing absolute FILE path (extension/`index`
|
|
143
|
+
* probing), or null. */
|
|
144
|
+
function resolve_relative(dir, source) {
|
|
145
|
+
return resolve_file(path.resolve(dir, source));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The rolldown plugin that serves the virtual eval entry and roots resolution at the REAL module's
|
|
149
|
+
* directory. It resolves — WITH extension probing, so an extensionless TS import lands on `x.ts` —
|
|
150
|
+
* the entry's relative imports (`./data`) against `module_dir`, its `$lib/…` against `<root>/src/lib`
|
|
151
|
+
* (the SvelteKit convention, robust even if the config alias isn't populated yet), and any configured
|
|
152
|
+
* alias. Anything a resolved module then pulls in has a real path and resolves normally.
|
|
153
|
+
*/
|
|
154
|
+
function bake_plugin(entry_id, entry_code, module_dir, root, aliases) {
|
|
155
|
+
return {
|
|
156
|
+
name: "ogygia-bake-entry",
|
|
157
|
+
resolveId(source, importer) {
|
|
158
|
+
if (source === entry_id) return entry_id;
|
|
159
|
+
const from_entry = importer === entry_id || importer === void 0;
|
|
160
|
+
for (const { find, replacement } of aliases) {
|
|
161
|
+
let mapped = null;
|
|
162
|
+
if (typeof find === "string") {
|
|
163
|
+
if (source === find) mapped = replacement;
|
|
164
|
+
else if (source.startsWith(find + "/")) mapped = path.join(replacement, source.slice(find.length + 1));
|
|
165
|
+
} else if (find.test(source)) mapped = source.replace(find, replacement);
|
|
166
|
+
if (mapped) return resolve_file(mapped) ?? mapped;
|
|
167
|
+
}
|
|
168
|
+
if (source === "$lib" || source.startsWith("$lib/")) return resolve_file(path.join(root, "src", "lib", source.slice(4).replace(LEADING_SLASH_RE, "")));
|
|
169
|
+
if (from_entry && (source.startsWith("./") || source.startsWith("../"))) return resolve_relative(module_dir, source);
|
|
170
|
+
return null;
|
|
171
|
+
},
|
|
172
|
+
load(id) {
|
|
173
|
+
return id === entry_id ? entry_code : null;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/** Probe an absolute path base to an existing file (extension / `index`), or null. */
|
|
178
|
+
function resolve_file(base) {
|
|
179
|
+
for (const e of RESOLVE_EXTS) {
|
|
180
|
+
const f = base + e;
|
|
181
|
+
try {
|
|
182
|
+
if (fs.statSync(f).isFile()) return f;
|
|
183
|
+
} catch {}
|
|
184
|
+
}
|
|
185
|
+
for (const e of INDEX_EXTS) {
|
|
186
|
+
const f = base + e;
|
|
187
|
+
try {
|
|
188
|
+
if (fs.statSync(f).isFile()) return f;
|
|
189
|
+
} catch {}
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Bundle + execute the eval entry, returning the array of results (one per bake call). Isolated in a
|
|
195
|
+
* fresh module URL each time so Node's ESM cache never serves a stale bake.
|
|
196
|
+
*/
|
|
197
|
+
async function evaluate(entry_code, id, opts) {
|
|
198
|
+
const { build } = await import(
|
|
199
|
+
/* @vite-ignore */
|
|
200
|
+
"vite"
|
|
201
|
+
);
|
|
202
|
+
const ENTRY = "\0ogygia-bake-entry.js";
|
|
203
|
+
const module_dir = path.dirname(id.split("?")[0]);
|
|
204
|
+
const result = await build({
|
|
205
|
+
configFile: false,
|
|
206
|
+
logLevel: "silent",
|
|
207
|
+
root: module_dir,
|
|
208
|
+
resolve: { extensions: [
|
|
209
|
+
".ts",
|
|
210
|
+
".tsx",
|
|
211
|
+
".mts",
|
|
212
|
+
".js",
|
|
213
|
+
".mjs",
|
|
214
|
+
".jsx",
|
|
215
|
+
".json",
|
|
216
|
+
".node"
|
|
217
|
+
] },
|
|
218
|
+
ssr: {
|
|
219
|
+
noExternal: true,
|
|
220
|
+
external: []
|
|
221
|
+
},
|
|
222
|
+
build: {
|
|
223
|
+
write: false,
|
|
224
|
+
minify: false,
|
|
225
|
+
target: "esnext",
|
|
226
|
+
ssr: true,
|
|
227
|
+
rollupOptions: {
|
|
228
|
+
input: ENTRY,
|
|
229
|
+
external: (source) => source.startsWith("node:"),
|
|
230
|
+
plugins: [bake_plugin(ENTRY, entry_code, module_dir, opts.root, opts.alias)],
|
|
231
|
+
output: {
|
|
232
|
+
format: "esm",
|
|
233
|
+
exports: "named"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
{
|
|
239
|
+
const code = (Array.isArray(result) ? result[0].output : result.output)[0].code;
|
|
240
|
+
const dir = bake_cache.dir();
|
|
241
|
+
if (!dir) throw new Error("the build cache (node_modules/.ogygia) is unavailable — cannot stage the bake bundle");
|
|
242
|
+
const file = path.join(dir, `${opts.hash}.mjs`);
|
|
243
|
+
fs.writeFileSync(file, code);
|
|
244
|
+
try {
|
|
245
|
+
const mod = await import(pathToFileURL(file).href + `?t=${opts.hash}`);
|
|
246
|
+
if (typeof mod.__run !== "function") throw new Error("bake eval module produced no __run export");
|
|
247
|
+
return await mod.__run();
|
|
248
|
+
} finally {
|
|
249
|
+
fs.rmSync(file, { force: true });
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Rewrite every `import.meta.og.bake(fn)` in `src` to its inlined, devalue-serialized result. ASYNC
|
|
255
|
+
* (bundles + executes). Returns the input unchanged (same reference) when there is nothing to do.
|
|
256
|
+
* Throws build-voice on a non-serializable result or an `fn` that references non-imported scope.
|
|
257
|
+
*/
|
|
258
|
+
async function rewrite_bake(src, id, opts) {
|
|
259
|
+
if (!src.includes(MARKER)) return src;
|
|
260
|
+
const found = scan(src, id, opts.markupExts ?? [".svelte"]);
|
|
261
|
+
if (!found || !found.calls.length) return src;
|
|
262
|
+
const runners = found.calls.map((c, i) => ` r[${i}] = await (${c.fn})();`).join("\n");
|
|
263
|
+
const entry_code = eval_imports(found.imports, found.calls).map((i) => i.text).join("\n") + `\nexport async function __run() {\n\tconst r = [];\n${runners}\n\treturn r;\n}\n`;
|
|
264
|
+
const hash = hash_of(id + "\0" + entry_code);
|
|
265
|
+
let results;
|
|
266
|
+
try {
|
|
267
|
+
results = await evaluate(entry_code, id, {
|
|
268
|
+
...opts,
|
|
269
|
+
hash
|
|
270
|
+
});
|
|
271
|
+
} catch (e) {
|
|
272
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
273
|
+
throw new Error(`[ogygia] import.meta.og.bake() in ${path.basename(id)}: evaluating the function failed — ${msg}. A baked function may use this module's IMPORTS and literals only (not its other local variables), and must not touch runtime-only modules ($app/*, the browser).`);
|
|
274
|
+
}
|
|
275
|
+
const edits = [];
|
|
276
|
+
found.calls.forEach((c, i) => {
|
|
277
|
+
let literal;
|
|
278
|
+
try {
|
|
279
|
+
literal = uneval(results[i]);
|
|
280
|
+
} catch (e) {
|
|
281
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
282
|
+
throw new Error(`[ogygia] ${id}:${line_of(src, c.start)} — import.meta.og.bake(): the result is not serializable (${msg}). bake produces DATA — return plain values (JSON + Date/Map/Set/RegExp/BigInt), never a function, Promise, or class instance.`);
|
|
283
|
+
}
|
|
284
|
+
edits.push({
|
|
285
|
+
start: c.start,
|
|
286
|
+
end: c.end,
|
|
287
|
+
text: `(${literal})`
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
for (const imp of dead_imports(src, found.imports, found.calls)) {
|
|
291
|
+
const end = src[imp.end] === "\n" ? imp.end + 1 : imp.end;
|
|
292
|
+
edits.push({
|
|
293
|
+
start: imp.start,
|
|
294
|
+
end,
|
|
295
|
+
text: ""
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
edits.sort((a, b) => a.start - b.start);
|
|
299
|
+
let out = "";
|
|
300
|
+
let last = 0;
|
|
301
|
+
for (const e of edits) {
|
|
302
|
+
out += src.slice(last, e.start) + e.text;
|
|
303
|
+
last = e.end;
|
|
304
|
+
}
|
|
305
|
+
out += src.slice(last);
|
|
306
|
+
return out;
|
|
307
|
+
}
|
|
308
|
+
/** Stable non-crypto hash (FNV-1a) → hex. Enough to address a bundle by its inputs. */
|
|
309
|
+
function hash_of(s) {
|
|
310
|
+
let h = 2166136261;
|
|
311
|
+
for (let i = 0; i < s.length; i++) {
|
|
312
|
+
h ^= s.charCodeAt(i);
|
|
313
|
+
h = Math.imul(h, 16777619);
|
|
314
|
+
}
|
|
315
|
+
return (h >>> 0).toString(16).padStart(8, "0");
|
|
316
|
+
}
|
|
317
|
+
export { rewrite_bake };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PluginMacro } from "./pipeline.js";
|
|
2
|
+
/**
|
|
3
|
+
* Run the browser-safe macro passes over one module. `source` is the current text; `macros` are the
|
|
4
|
+
* plugins' browser-safe macros (content's `code` / `md`, built with the app's markdown config).
|
|
5
|
+
* Returns the rewritten code and whether anything changed — the caller invalidates its own sourcemap
|
|
6
|
+
* on `touched`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function run_browser_macros(source: string, id: string, macros?: readonly PluginMacro[]): Promise<{
|
|
9
|
+
code: string;
|
|
10
|
+
touched: boolean;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { rewrite_wire } from "./wire.js";
|
|
2
|
+
import { rewrite_dollar } from "./dollar.js";
|
|
3
|
+
import { rewrite_store } from "./store.js";
|
|
4
|
+
// src/compiler/macros/browser.ts
|
|
5
|
+
/**
|
|
6
|
+
* The BROWSER-safe subset of the module-macro pipeline ({@link ./pipeline.ts}), for a REPL that runs the
|
|
7
|
+
* real compiler in-browser (the Observatory) — the same passes, over the same parser, as a real build.
|
|
8
|
+
*
|
|
9
|
+
* It runs `import.meta.og.wire`, `.$` / `.store`, and the plugins' macros it is handed (content's `.code`
|
|
10
|
+
* / `.md`, with the same Shiki/mdsvex renderers as a build). It deliberately OMITS only
|
|
11
|
+
* `bake` — which runs `fn` at build via a mini rolldown bundle + `node:url` module eval (Node-only) —
|
|
12
|
+
* so `run_module_macros` (which statically imports the node-only `bake` pass) stays out of the browser
|
|
13
|
+
* bundle; this is the narrow, node-free slice the REPL needs. Keep the pass order in sync with pipeline.ts.
|
|
14
|
+
*
|
|
15
|
+
* The `$` / `store` passes emit a SELF-CONTAINED call (`__og_$(tag, bound, () => factory)` — the factory
|
|
16
|
+
* is inline), so a single-tree live preview runs them by providing the runtime `__og_$` / `__og_store`
|
|
17
|
+
* (see the Observatory's `ogygia/internal` module). The build's fn/store MANIFEST (the cross-island decode
|
|
18
|
+
* fallback the driver emits from the hoists) is not needed here — the preview is one tree.
|
|
19
|
+
*/
|
|
20
|
+
const MARKUP_EXTS = [".svelte"];
|
|
21
|
+
/**
|
|
22
|
+
* Run the browser-safe macro passes over one module. `source` is the current text; `macros` are the
|
|
23
|
+
* plugins' browser-safe macros (content's `code` / `md`, built with the app's markdown config).
|
|
24
|
+
* Returns the rewritten code and whether anything changed — the caller invalidates its own sourcemap
|
|
25
|
+
* on `touched`.
|
|
26
|
+
*/
|
|
27
|
+
async function run_browser_macros(source, id, macros = []) {
|
|
28
|
+
let out = source;
|
|
29
|
+
let touched = false;
|
|
30
|
+
if (out.includes("import.meta.og.wire")) {
|
|
31
|
+
const rewritten = rewrite_wire(out, id, MARKUP_EXTS);
|
|
32
|
+
if (rewritten !== out) {
|
|
33
|
+
out = rewritten;
|
|
34
|
+
touched = true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (out.includes("import.meta.og.$")) {
|
|
38
|
+
const res = rewrite_dollar(out, id, id, MARKUP_EXTS);
|
|
39
|
+
if (res.code !== out) {
|
|
40
|
+
out = res.code;
|
|
41
|
+
touched = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (out.includes("import.meta.og.store")) {
|
|
45
|
+
const rewritten = rewrite_store(out, id, id, MARKUP_EXTS);
|
|
46
|
+
if (rewritten !== out) {
|
|
47
|
+
out = rewritten;
|
|
48
|
+
touched = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
for (const macro of macros) {
|
|
52
|
+
if (!out.includes("import.meta.og." + macro.name)) continue;
|
|
53
|
+
const rewritten = await macro.handler(out, {
|
|
54
|
+
id,
|
|
55
|
+
rel: id,
|
|
56
|
+
root: "/",
|
|
57
|
+
markupExts: MARKUP_EXTS
|
|
58
|
+
});
|
|
59
|
+
if (rewritten !== out) {
|
|
60
|
+
out = rewritten;
|
|
61
|
+
touched = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
code: out,
|
|
66
|
+
touched
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export { run_browser_macros };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip the common leading indentation from a block of source, and trim leading/trailing blank
|
|
3
|
+
* lines. Source embedded in a call (`import.meta.og.code(\`…\`, …)`) is indented to match where the
|
|
4
|
+
* call sits; that indentation is an artifact of the surrounding code, not part of the snippet. This
|
|
5
|
+
* normalizes it so the rendered `<pre>` shows the snippet's OWN logical indentation, flush-left.
|
|
6
|
+
*
|
|
7
|
+
* Blank lines (whitespace-only) don't count toward the common indent; tabs and spaces are treated by
|
|
8
|
+
* their literal column contribution to the prefix (the common prefix is computed on raw characters,
|
|
9
|
+
* so mixed tabs/spaces still de-indent correctly as long as the leading run is consistent — which it
|
|
10
|
+
* is for machine-indented source).
|
|
11
|
+
*/
|
|
12
|
+
export declare function dedent(text: string): string;
|