@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.
Files changed (548) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -1
  3. package/ambient.d.ts +194 -0
  4. package/dist/ClientBindingStub.svelte +6 -0
  5. package/dist/ClientBindingStub.svelte.d.ts +26 -0
  6. package/dist/KeepHost.svelte +19 -0
  7. package/dist/KeepHost.svelte.d.ts +10 -0
  8. package/dist/LakeBoundary.svelte +16 -0
  9. package/dist/LakeBoundary.svelte.d.ts +11 -0
  10. package/dist/LateIsland.svelte +22 -0
  11. package/dist/LateIsland.svelte.d.ts +15 -0
  12. package/dist/LateIslandAwait.svelte +17 -0
  13. package/dist/LateIslandAwait.svelte.d.ts +15 -0
  14. package/dist/LiveHost.svelte +19 -0
  15. package/dist/LiveHost.svelte.d.ts +10 -0
  16. package/dist/NestedProvider.svelte +13 -0
  17. package/dist/NestedProvider.svelte.d.ts +8 -0
  18. package/dist/OgygiaBoundary.svelte +5 -0
  19. package/dist/OgygiaBoundary.svelte.d.ts +17 -0
  20. package/dist/PromiseRegion.svelte +40 -0
  21. package/dist/PromiseRegion.svelte.d.ts +15 -0
  22. package/dist/PromiseRegionAwait.svelte +27 -0
  23. package/dist/PromiseRegionAwait.svelte.d.ts +15 -0
  24. package/dist/Provide.svelte +27 -0
  25. package/dist/Provide.svelte.d.ts +8 -0
  26. package/dist/RawHtml.svelte +9 -0
  27. package/dist/RawHtml.svelte.d.ts +6 -0
  28. package/dist/Region.svelte +1173 -0
  29. package/dist/Region.svelte.d.ts +68 -0
  30. package/dist/SlotBoundary.svelte +13 -0
  31. package/dist/SlotBoundary.svelte.d.ts +7 -0
  32. package/dist/app.d.ts +4 -0
  33. package/dist/app.js +3 -0
  34. package/dist/boundary.d.ts +35 -0
  35. package/dist/boundary.js +127 -0
  36. package/dist/build-cache.d.ts +13 -0
  37. package/dist/build-cache.js +77 -0
  38. package/dist/compiler/blank-styles.d.ts +1 -0
  39. package/dist/compiler/blank-styles.js +63 -0
  40. package/dist/compiler/bom.d.ts +2 -0
  41. package/dist/compiler/bom.js +15 -0
  42. package/dist/compiler/browser-full.d.ts +8 -0
  43. package/dist/compiler/browser-full.js +8 -0
  44. package/dist/compiler/browser.d.ts +11 -0
  45. package/dist/compiler/browser.js +11 -0
  46. package/dist/compiler/content/transportables.d.ts +26 -0
  47. package/dist/compiler/content/transportables.js +219 -0
  48. package/dist/compiler/ctx.d.ts +180 -0
  49. package/dist/compiler/ctx.js +183 -0
  50. package/dist/compiler/debarrel/barrel.d.ts +55 -0
  51. package/dist/compiler/debarrel/barrel.js +248 -0
  52. package/dist/compiler/debarrel/options.d.ts +67 -0
  53. package/dist/compiler/debarrel/options.js +31 -0
  54. package/dist/compiler/debarrel/parse.d.ts +65 -0
  55. package/dist/compiler/debarrel/parse.js +256 -0
  56. package/dist/compiler/debarrel/plugin.d.ts +31 -0
  57. package/dist/compiler/debarrel/plugin.js +190 -0
  58. package/dist/compiler/debarrel/rewrite.d.ts +27 -0
  59. package/dist/compiler/debarrel/rewrite.js +118 -0
  60. package/dist/compiler/debarrel/svelte.d.ts +13 -0
  61. package/dist/compiler/debarrel/svelte.js +56 -0
  62. package/dist/compiler/dev/css-scope.d.ts +16 -0
  63. package/dist/compiler/dev/css-scope.js +38 -0
  64. package/dist/compiler/dev/dev-hmr.d.ts +25 -0
  65. package/dist/compiler/dev/dev-hmr.js +29 -0
  66. package/dist/compiler/dev/hmr.d.ts +34 -0
  67. package/dist/compiler/dev/hmr.js +57 -0
  68. package/dist/compiler/dev/region-bytes.d.ts +34 -0
  69. package/dist/compiler/dev/region-bytes.js +126 -0
  70. package/dist/compiler/driver.d.ts +280 -0
  71. package/dist/compiler/driver.js +1352 -0
  72. package/dist/compiler/flags.d.ts +16 -0
  73. package/dist/compiler/flags.js +101 -0
  74. package/dist/compiler/fouc-css.d.ts +97 -0
  75. package/dist/compiler/fouc-css.js +335 -0
  76. package/dist/compiler/free-vars.d.ts +20 -0
  77. package/dist/compiler/free-vars.js +327 -0
  78. package/dist/compiler/host.d.ts +65 -0
  79. package/dist/compiler/host.js +51 -0
  80. package/dist/compiler/ids.d.ts +84 -0
  81. package/dist/compiler/ids.js +86 -0
  82. package/dist/compiler/index.d.ts +11 -0
  83. package/dist/compiler/index.js +11 -0
  84. package/dist/compiler/kit.d.ts +129 -0
  85. package/dist/compiler/kit.js +563 -0
  86. package/dist/compiler/link/build-output.d.ts +44 -0
  87. package/dist/compiler/link/build-output.js +147 -0
  88. package/dist/compiler/link/caps.d.ts +48 -0
  89. package/dist/compiler/link/caps.js +64 -0
  90. package/dist/compiler/link/context-detect.d.ts +23 -0
  91. package/dist/compiler/link/context-detect.js +137 -0
  92. package/dist/compiler/link/emit-gate.d.ts +11 -0
  93. package/dist/compiler/link/emit-gate.js +40 -0
  94. package/dist/compiler/link/entry-shim.d.ts +4 -0
  95. package/dist/compiler/link/entry-shim.js +29 -0
  96. package/dist/compiler/link/island-deps.d.ts +142 -0
  97. package/dist/compiler/link/island-deps.js +525 -0
  98. package/dist/compiler/link/manifest.d.ts +5 -0
  99. package/dist/compiler/link/manifest.js +9 -0
  100. package/dist/compiler/link/page-keys.d.ts +64 -0
  101. package/dist/compiler/link/page-keys.js +683 -0
  102. package/dist/compiler/link/registry-stub.d.ts +41 -0
  103. package/dist/compiler/link/registry-stub.js +212 -0
  104. package/dist/compiler/link/router-config.d.ts +11 -0
  105. package/dist/compiler/link/router-config.js +15 -0
  106. package/dist/compiler/link/router-css.d.ts +22 -0
  107. package/dist/compiler/link/router-css.js +142 -0
  108. package/dist/compiler/link/runtime-entry.d.ts +71 -0
  109. package/dist/compiler/link/runtime-entry.js +132 -0
  110. package/dist/compiler/link/server-manifest.d.ts +12 -0
  111. package/dist/compiler/link/server-manifest.js +45 -0
  112. package/dist/compiler/link/speculation.d.ts +17 -0
  113. package/dist/compiler/link/speculation.js +36 -0
  114. package/dist/compiler/link/transport.d.ts +31 -0
  115. package/dist/compiler/link/transport.js +67 -0
  116. package/dist/compiler/macros/bake.d.ts +20 -0
  117. package/dist/compiler/macros/bake.js +317 -0
  118. package/dist/compiler/macros/browser.d.ts +11 -0
  119. package/dist/compiler/macros/browser.js +69 -0
  120. package/dist/compiler/macros/dedent.d.ts +12 -0
  121. package/dist/compiler/macros/dedent.js +36 -0
  122. package/dist/compiler/macros/dollar.d.ts +15 -0
  123. package/dist/compiler/macros/dollar.js +387 -0
  124. package/dist/compiler/macros/pipeline.d.ts +31 -0
  125. package/dist/compiler/macros/pipeline.js +106 -0
  126. package/dist/compiler/macros/source.d.ts +6 -0
  127. package/dist/compiler/macros/source.js +127 -0
  128. package/dist/compiler/macros/store.d.ts +17 -0
  129. package/dist/compiler/macros/store.js +244 -0
  130. package/dist/compiler/macros/wire.d.ts +14 -0
  131. package/dist/compiler/macros/wire.js +160 -0
  132. package/dist/compiler/ownership-stamps.d.ts +6 -0
  133. package/dist/compiler/ownership-stamps.js +144 -0
  134. package/dist/compiler/parse/oxc.d.ts +34 -0
  135. package/dist/compiler/parse/oxc.js +59 -0
  136. package/dist/compiler/parse/scan.d.ts +43 -0
  137. package/dist/compiler/parse/scan.js +232 -0
  138. package/dist/compiler/program.d.ts +140 -0
  139. package/dist/compiler/program.js +242 -0
  140. package/dist/compiler/region/emit.d.ts +169 -0
  141. package/dist/compiler/region/emit.js +286 -0
  142. package/dist/compiler/region/identity.d.ts +28 -0
  143. package/dist/compiler/region/identity.js +75 -0
  144. package/dist/compiler/region/ir.d.ts +65 -0
  145. package/dist/compiler/region/ir.js +0 -0
  146. package/dist/compiler/region/transform.d.ts +178 -0
  147. package/dist/compiler/region/transform.js +1933 -0
  148. package/dist/compiler/script-request.d.ts +1 -0
  149. package/dist/compiler/script-request.js +43 -0
  150. package/dist/context-bridge.d.ts +65 -0
  151. package/dist/context-bridge.js +217 -0
  152. package/dist/context-registry.d.ts +40 -0
  153. package/dist/context-registry.js +15 -0
  154. package/dist/context.d.ts +72 -0
  155. package/dist/context.js +158 -0
  156. package/dist/current-region.d.ts +14 -0
  157. package/dist/current-region.js +36 -0
  158. package/dist/document.d.ts +41 -0
  159. package/dist/document.js +125 -0
  160. package/dist/entry-hydrate.d.ts +5 -0
  161. package/dist/entry-hydrate.js +42 -0
  162. package/dist/escape.d.ts +18 -0
  163. package/dist/escape.js +37 -0
  164. package/dist/events/bus.d.ts +33 -0
  165. package/dist/events/bus.js +153 -0
  166. package/dist/events/index.d.ts +4 -0
  167. package/dist/events/index.js +4 -0
  168. package/dist/events/schema.d.ts +389 -0
  169. package/dist/events/schema.js +23 -0
  170. package/dist/events/server-registry.d.ts +7 -0
  171. package/dist/events/server-registry.js +13 -0
  172. package/dist/events/sinks.d.ts +64 -0
  173. package/dist/events/sinks.js +85 -0
  174. package/dist/fn-transport.d.ts +33 -0
  175. package/dist/fn-transport.js +140 -0
  176. package/dist/frame.d.ts +20 -0
  177. package/dist/frame.js +19 -0
  178. package/dist/holes-record.d.ts +6 -0
  179. package/dist/holes-record.js +8 -0
  180. package/dist/hooks.d.ts +43 -0
  181. package/dist/hooks.js +1191 -0
  182. package/dist/hydration-info.d.ts +1 -0
  183. package/dist/hydration-info.js +31 -0
  184. package/dist/index.d.ts +21 -0
  185. package/dist/index.js +17 -0
  186. package/dist/insights/attr-rules.d.ts +15 -0
  187. package/dist/insights/attr-rules.js +27 -0
  188. package/dist/insights/cpu.d.ts +82 -0
  189. package/dist/insights/cpu.js +177 -0
  190. package/dist/insights/fp-drift.d.ts +28 -0
  191. package/dist/insights/fp-drift.js +148 -0
  192. package/dist/insights/hole-segments.d.ts +26 -0
  193. package/dist/insights/hole-segments.js +50 -0
  194. package/dist/insights/html-diff.d.ts +25 -0
  195. package/dist/insights/html-diff.js +157 -0
  196. package/dist/insights/hydration-hazards.d.ts +36 -0
  197. package/dist/insights/hydration-hazards.js +136 -0
  198. package/dist/insights/hydration-status.d.ts +2 -0
  199. package/dist/insights/hydration-status.js +0 -0
  200. package/dist/insights/index.d.ts +14 -0
  201. package/dist/insights/index.js +12 -0
  202. package/dist/insights/page-assets.d.ts +211 -0
  203. package/dist/insights/page-assets.js +608 -0
  204. package/dist/insights/page-insights.d.ts +749 -0
  205. package/dist/insights/page-insights.js +2157 -0
  206. package/dist/insights/session-data.d.ts +108 -0
  207. package/dist/insights/session-data.js +0 -0
  208. package/dist/insights/session-insights.d.ts +121 -0
  209. package/dist/insights/session-insights.js +548 -0
  210. package/dist/insights/switch.d.ts +53 -0
  211. package/dist/insights/switch.js +91 -0
  212. package/dist/insights/testing-version.d.ts +19 -0
  213. package/dist/insights/testing-version.js +21 -0
  214. package/dist/insights/third-party.d.ts +75 -0
  215. package/dist/insights/third-party.js +160 -0
  216. package/dist/internal-instruments.d.ts +13 -0
  217. package/dist/internal-instruments.js +12 -0
  218. package/dist/internal-reconcile.d.ts +3 -0
  219. package/dist/internal-reconcile.js +3 -0
  220. package/dist/internal-register.d.ts +7 -0
  221. package/dist/internal-register.js +7 -0
  222. package/dist/internal-server.d.ts +7 -0
  223. package/dist/internal-server.js +7 -0
  224. package/dist/internal.d.ts +13 -0
  225. package/dist/internal.js +13 -0
  226. package/dist/island-graph.d.ts +36 -0
  227. package/dist/island-graph.js +89 -0
  228. package/dist/keep-fallback-marker.d.ts +7 -0
  229. package/dist/keep-fallback-marker.js +9 -0
  230. package/dist/keep-fallback.d.ts +13 -0
  231. package/dist/keep-fallback.js +39 -0
  232. package/dist/kit-paths.d.ts +2 -0
  233. package/dist/kit-paths.js +39 -0
  234. package/dist/late-region-registry.d.ts +40 -0
  235. package/dist/late-region-registry.js +36 -0
  236. package/dist/live-transport.d.ts +57 -0
  237. package/dist/live-transport.js +145 -0
  238. package/dist/markup.d.ts +4 -0
  239. package/dist/markup.js +4 -0
  240. package/dist/own-package.d.ts +15 -0
  241. package/dist/own-package.js +20 -0
  242. package/dist/page-defer.d.ts +33 -0
  243. package/dist/page-defer.js +35 -0
  244. package/dist/page-facts-script.d.ts +7 -0
  245. package/dist/page-facts-script.js +9 -0
  246. package/dist/page-seed-registry.d.ts +72 -0
  247. package/dist/page-seed-registry.js +31 -0
  248. package/dist/plugin/capability.d.ts +14 -0
  249. package/dist/plugin/capability.js +44 -0
  250. package/dist/plugin/client.d.ts +39 -0
  251. package/dist/plugin/client.js +6 -0
  252. package/dist/plugin/css.d.ts +3 -0
  253. package/dist/plugin/css.js +54 -0
  254. package/dist/plugin/facts.d.ts +42 -0
  255. package/dist/plugin/facts.js +37 -0
  256. package/dist/plugin/hooks.d.ts +33 -0
  257. package/dist/plugin/hooks.js +38 -0
  258. package/dist/plugin/index.d.ts +127 -0
  259. package/dist/plugin/index.js +26 -0
  260. package/dist/plugin/routes.d.ts +32 -0
  261. package/dist/plugin/routes.js +35 -0
  262. package/dist/plugin/server.d.ts +27 -0
  263. package/dist/plugin/server.js +92 -0
  264. package/dist/plugin/standard-schema.d.ts +27 -0
  265. package/dist/plugin/standard-schema.js +0 -0
  266. package/dist/plugin/testing.d.ts +13 -0
  267. package/dist/plugin/testing.js +54 -0
  268. package/dist/plugin/utils.d.ts +13 -0
  269. package/dist/plugin/utils.js +19 -0
  270. package/dist/portable-form.d.ts +22 -0
  271. package/dist/portable-form.js +52 -0
  272. package/dist/preference.d.ts +35 -0
  273. package/dist/preference.js +84 -0
  274. package/dist/preload.d.ts +1 -0
  275. package/dist/preload.js +21 -0
  276. package/dist/ref-watch.d.ts +31 -0
  277. package/dist/ref-watch.js +66 -0
  278. package/dist/ref.d.ts +124 -0
  279. package/dist/ref.js +272 -0
  280. package/dist/region-brand.d.ts +8 -0
  281. package/dist/region-brand.js +10 -0
  282. package/dist/region-core.d.ts +2 -0
  283. package/dist/region-core.js +1 -0
  284. package/dist/region-snippet.d.ts +73 -0
  285. package/dist/region-snippet.js +351 -0
  286. package/dist/region.d.ts +127 -0
  287. package/dist/region.js +162 -0
  288. package/dist/request-event.d.ts +1 -0
  289. package/dist/request-event.js +37 -0
  290. package/dist/router-css.d.ts +39 -0
  291. package/dist/router-css.js +66 -0
  292. package/dist/runtime/app-transport.d.ts +2 -0
  293. package/dist/runtime/app-transport.js +13 -0
  294. package/dist/runtime/beacon.d.ts +271 -0
  295. package/dist/runtime/beacon.js +2190 -0
  296. package/dist/runtime/boot-link.d.ts +1 -0
  297. package/dist/runtime/boot-link.js +44 -0
  298. package/dist/runtime/client-hooks.d.ts +5 -0
  299. package/dist/runtime/client-hooks.js +22 -0
  300. package/dist/runtime/client-plugins.d.ts +8 -0
  301. package/dist/runtime/client-plugins.js +34 -0
  302. package/dist/runtime/concurrency.d.ts +12 -0
  303. package/dist/runtime/concurrency.js +29 -0
  304. package/dist/runtime/connected.d.ts +12 -0
  305. package/dist/runtime/connected.js +16 -0
  306. package/dist/runtime/context.d.ts +1 -0
  307. package/dist/runtime/context.js +19 -0
  308. package/dist/runtime/core.d.ts +15 -0
  309. package/dist/runtime/core.js +1173 -0
  310. package/dist/runtime/drift-watch.d.ts +9 -0
  311. package/dist/runtime/drift-watch.js +60 -0
  312. package/dist/runtime/entry-locations.d.ts +33 -0
  313. package/dist/runtime/entry-locations.js +119 -0
  314. package/dist/runtime/foreign-props.d.ts +8 -0
  315. package/dist/runtime/foreign-props.js +14 -0
  316. package/dist/runtime/form-continuity.d.ts +10 -0
  317. package/dist/runtime/form-continuity.js +107 -0
  318. package/dist/runtime/frame-nav.d.ts +36 -0
  319. package/dist/runtime/frame-nav.js +225 -0
  320. package/dist/runtime/frame-store.d.ts +62 -0
  321. package/dist/runtime/frame-store.js +214 -0
  322. package/dist/runtime/frames.d.ts +1 -0
  323. package/dist/runtime/frames.js +25 -0
  324. package/dist/runtime/full.d.ts +4 -0
  325. package/dist/runtime/full.js +32 -0
  326. package/dist/runtime/hash.d.ts +41 -0
  327. package/dist/runtime/hash.js +79 -0
  328. package/dist/runtime/hole-facts.d.ts +8 -0
  329. package/dist/runtime/hole-facts.js +57 -0
  330. package/dist/runtime/host-classes.d.ts +24 -0
  331. package/dist/runtime/host-classes.js +43 -0
  332. package/dist/runtime/hydrate-core.d.ts +101 -0
  333. package/dist/runtime/hydrate-core.js +605 -0
  334. package/dist/runtime/index.d.ts +2 -0
  335. package/dist/runtime/index.js +1 -0
  336. package/dist/runtime/interaction-replay.d.ts +11 -0
  337. package/dist/runtime/interaction-replay.js +70 -0
  338. package/dist/runtime/interaction.d.ts +33 -0
  339. package/dist/runtime/interaction.js +217 -0
  340. package/dist/runtime/island-graph-preload.d.ts +13 -0
  341. package/dist/runtime/island-graph-preload.js +99 -0
  342. package/dist/runtime/kit-boot.d.ts +29 -0
  343. package/dist/runtime/kit-boot.js +60 -0
  344. package/dist/runtime/kit-page-thread.svelte.d.ts +1 -0
  345. package/dist/runtime/kit-page-thread.svelte.js +116 -0
  346. package/dist/runtime/lake-anchors.d.ts +13 -0
  347. package/dist/runtime/lake-anchors.js +19 -0
  348. package/dist/runtime/lakes.d.ts +15 -0
  349. package/dist/runtime/lakes.js +212 -0
  350. package/dist/runtime/live.d.ts +3 -0
  351. package/dist/runtime/live.js +17 -0
  352. package/dist/runtime/load-scheduler.d.ts +53 -0
  353. package/dist/runtime/load-scheduler.js +317 -0
  354. package/dist/runtime/morph.d.ts +42 -0
  355. package/dist/runtime/morph.js +671 -0
  356. package/dist/runtime/nav-handle.d.ts +25 -0
  357. package/dist/runtime/nav-handle.js +71 -0
  358. package/dist/runtime/nav-hooks.d.ts +2 -0
  359. package/dist/runtime/nav-hooks.js +23 -0
  360. package/dist/runtime/nearest-attr.d.ts +4 -0
  361. package/dist/runtime/nearest-attr.js +16 -0
  362. package/dist/runtime/observe.d.ts +27 -0
  363. package/dist/runtime/observe.js +63 -0
  364. package/dist/runtime/own-cost.d.ts +9 -0
  365. package/dist/runtime/own-cost.js +35 -0
  366. package/dist/runtime/ownership.d.ts +101 -0
  367. package/dist/runtime/ownership.js +115 -0
  368. package/dist/runtime/page-cache.d.ts +23 -0
  369. package/dist/runtime/page-cache.js +74 -0
  370. package/dist/runtime/page-defer.d.ts +14 -0
  371. package/dist/runtime/page-defer.js +103 -0
  372. package/dist/runtime/parse-html.d.ts +40 -0
  373. package/dist/runtime/parse-html.js +81 -0
  374. package/dist/runtime/reconcile.d.ts +41 -0
  375. package/dist/runtime/reconcile.js +194 -0
  376. package/dist/runtime/region-attrs.d.ts +95 -0
  377. package/dist/runtime/region-attrs.js +153 -0
  378. package/dist/runtime/region-endpoint-url.d.ts +76 -0
  379. package/dist/runtime/region-endpoint-url.js +169 -0
  380. package/dist/runtime/region-ids.d.ts +8 -0
  381. package/dist/runtime/region-ids.js +33 -0
  382. package/dist/runtime/remote-seeds.d.ts +2 -0
  383. package/dist/runtime/remote-seeds.js +21 -0
  384. package/dist/runtime/render-blocking.d.ts +2 -0
  385. package/dist/runtime/render-blocking.js +30 -0
  386. package/dist/runtime/restore.d.ts +34 -0
  387. package/dist/runtime/restore.js +390 -0
  388. package/dist/runtime/router-nav.d.ts +63 -0
  389. package/dist/runtime/router-nav.js +740 -0
  390. package/dist/runtime/router.d.ts +201 -0
  391. package/dist/runtime/router.js +593 -0
  392. package/dist/runtime/schedule.d.ts +49 -0
  393. package/dist/runtime/schedule.js +256 -0
  394. package/dist/runtime/seeds.d.ts +50 -0
  395. package/dist/runtime/seeds.js +208 -0
  396. package/dist/runtime/session.d.ts +52 -0
  397. package/dist/runtime/session.js +130 -0
  398. package/dist/runtime/sidecar.d.ts +3 -0
  399. package/dist/runtime/sidecar.js +56 -0
  400. package/dist/runtime/slots.d.ts +183 -0
  401. package/dist/runtime/slots.js +44 -0
  402. package/dist/runtime/spa-cacheable.d.ts +7 -0
  403. package/dist/runtime/spa-cacheable.js +18 -0
  404. package/dist/runtime/speculate-hint.d.ts +1 -0
  405. package/dist/runtime/speculate-hint.js +35 -0
  406. package/dist/runtime/svelte-warnings.d.ts +28 -0
  407. package/dist/runtime/svelte-warnings.js +71 -0
  408. package/dist/runtime/wire-classes.d.ts +3 -0
  409. package/dist/runtime/wire-classes.js +69 -0
  410. package/dist/runtime/wire-format.d.ts +7 -0
  411. package/dist/runtime/wire-format.js +22 -0
  412. package/dist/script.d.ts +134 -0
  413. package/dist/script.js +184 -0
  414. package/dist/seed-refs.d.ts +105 -0
  415. package/dist/seed-refs.js +487 -0
  416. package/dist/server/capability-lifetime.d.ts +28 -0
  417. package/dist/server/capability-lifetime.js +31 -0
  418. package/dist/server/dead-kit-resolves.d.ts +1 -0
  419. package/dist/server/dead-kit-resolves.js +39 -0
  420. package/dist/server/document-assembly.d.ts +30 -0
  421. package/dist/server/document-assembly.js +26 -0
  422. package/dist/server/document-tail.d.ts +113 -0
  423. package/dist/server/document-tail.js +208 -0
  424. package/dist/server/endpoint.d.ts +51 -0
  425. package/dist/server/endpoint.js +90 -0
  426. package/dist/server/entry-location.d.ts +8 -0
  427. package/dist/server/entry-location.js +29 -0
  428. package/dist/server/fingerprint.d.ts +1 -0
  429. package/dist/server/fingerprint.js +25 -0
  430. package/dist/server/head-presence.d.ts +45 -0
  431. package/dist/server/head-presence.js +156 -0
  432. package/dist/server/hmac.d.ts +38 -0
  433. package/dist/server/hmac.js +89 -0
  434. package/dist/server/hole-graph.d.ts +7 -0
  435. package/dist/server/hole-graph.js +71 -0
  436. package/dist/server/hole-urls.d.ts +3 -0
  437. package/dist/server/hole-urls.js +76 -0
  438. package/dist/server/html-scan.d.ts +19 -0
  439. package/dist/server/html-scan.js +60 -0
  440. package/dist/server/kit-context.d.ts +78 -0
  441. package/dist/server/kit-context.js +110 -0
  442. package/dist/server/late-wire.d.ts +22 -0
  443. package/dist/server/late-wire.js +28 -0
  444. package/dist/server/page-facts.d.ts +25 -0
  445. package/dist/server/page-facts.js +138 -0
  446. package/dist/server/page-seed.d.ts +33 -0
  447. package/dist/server/page-seed.js +60 -0
  448. package/dist/server/page-stream.d.ts +55 -0
  449. package/dist/server/page-stream.js +121 -0
  450. package/dist/server/payload.d.ts +6 -0
  451. package/dist/server/payload.js +22 -0
  452. package/dist/server/personal-response.d.ts +6 -0
  453. package/dist/server/personal-response.js +13 -0
  454. package/dist/server/props-wire.d.ts +56 -0
  455. package/dist/server/props-wire.js +178 -0
  456. package/dist/server/rate-limit.d.ts +22 -0
  457. package/dist/server/rate-limit.js +63 -0
  458. package/dist/server/region-css.d.ts +5 -0
  459. package/dist/server/region-css.js +30 -0
  460. package/dist/server/region-endpoint.d.ts +35 -0
  461. package/dist/server/region-endpoint.js +142 -0
  462. package/dist/server/region-props.d.ts +6 -0
  463. package/dist/server/region-props.js +44 -0
  464. package/dist/server/remote-seed-gate.d.ts +50 -0
  465. package/dist/server/remote-seed-gate.js +66 -0
  466. package/dist/server/render-cache.d.ts +26 -0
  467. package/dist/server/render-cache.js +51 -0
  468. package/dist/server/render-page.d.ts +51 -0
  469. package/dist/server/render-page.js +176 -0
  470. package/dist/server/render-region-html.d.ts +2 -0
  471. package/dist/server/render-region-html.js +19 -0
  472. package/dist/server/request-stats.d.ts +174 -0
  473. package/dist/server/request-stats.js +54 -0
  474. package/dist/server/reversible.d.ts +83 -0
  475. package/dist/server/reversible.js +994 -0
  476. package/dist/server/seed-shape.d.ts +22 -0
  477. package/dist/server/seed-shape.js +24 -0
  478. package/dist/server/shared-cache.d.ts +35 -0
  479. package/dist/server/shared-cache.js +104 -0
  480. package/dist/server/signing-key.d.ts +11 -0
  481. package/dist/server/signing-key.js +47 -0
  482. package/dist/server/sized-lru.d.ts +20 -0
  483. package/dist/server/sized-lru.js +68 -0
  484. package/dist/server/split-regions.d.ts +81 -0
  485. package/dist/server/split-regions.js +368 -0
  486. package/dist/server/stream-regions.d.ts +5 -0
  487. package/dist/server/stream-regions.js +36 -0
  488. package/dist/shared-state.d.ts +7 -0
  489. package/dist/shared-state.js +152 -0
  490. package/dist/shims/app-environment.d.ts +4 -0
  491. package/dist/shims/app-environment.js +6 -0
  492. package/dist/shims/app-navigation.d.ts +33 -0
  493. package/dist/shims/app-navigation.js +119 -0
  494. package/dist/shims/app-paths.d.ts +6 -0
  495. package/dist/shims/app-paths.js +18 -0
  496. package/dist/shims/app-state.svelte.d.ts +23 -0
  497. package/dist/shims/app-state.svelte.js +50 -0
  498. package/dist/shims/app-stores.d.ts +21 -0
  499. package/dist/shims/app-stores.js +54 -0
  500. package/dist/shims/kit-bridge.d.ts +29 -0
  501. package/dist/shims/kit-bridge.js +7 -0
  502. package/dist/shims/kit-remote/client-stub.d.ts +27 -0
  503. package/dist/shims/kit-remote/client-stub.js +43 -0
  504. package/dist/shims/kit-remote/paths-internal-stub.d.ts +3 -0
  505. package/dist/shims/kit-remote/paths-internal-stub.js +5 -0
  506. package/dist/shims/kit-remote/remote-cache.d.ts +49 -0
  507. package/dist/shims/kit-remote/remote-cache.js +73 -0
  508. package/dist/shims/kit-remote/state-stub.d.ts +8 -0
  509. package/dist/shims/kit-remote/state-stub.js +8 -0
  510. package/dist/shims/page-store.svelte.d.ts +39 -0
  511. package/dist/shims/page-store.svelte.js +77 -0
  512. package/dist/source.d.ts +29 -0
  513. package/dist/source.js +87 -0
  514. package/dist/store-transport.d.ts +86 -0
  515. package/dist/store-transport.js +229 -0
  516. package/dist/tool-fetches.d.ts +5 -0
  517. package/dist/tool-fetches.js +41 -0
  518. package/dist/transport.d.ts +48 -0
  519. package/dist/transport.js +181 -0
  520. package/dist/unscoped-css.d.ts +26 -0
  521. package/dist/unscoped-css.js +53 -0
  522. package/dist/vite/dev-maps.d.ts +33 -0
  523. package/dist/vite/dev-maps.js +140 -0
  524. package/dist/vite/index.d.ts +19 -0
  525. package/dist/vite/index.js +820 -0
  526. package/dist/vite/kit-dirs.d.ts +7 -0
  527. package/dist/vite/kit-dirs.js +67 -0
  528. package/dist/vite/late-island.d.ts +25 -0
  529. package/dist/vite/late-island.js +33 -0
  530. package/dist/vite/module-map.d.ts +8 -0
  531. package/dist/vite/module-map.js +144 -0
  532. package/dist/vite/options.d.ts +208 -0
  533. package/dist/vite/options.js +74 -0
  534. package/dist/vite/package-files.d.ts +3 -0
  535. package/dist/vite/package-files.js +84 -0
  536. package/dist/vite/paths.d.ts +45 -0
  537. package/dist/vite/paths.js +112 -0
  538. package/dist/vite/plugin-api.d.ts +166 -0
  539. package/dist/vite/plugin-api.js +212 -0
  540. package/dist/vite/profiler-maps.d.ts +23 -0
  541. package/dist/vite/profiler-maps.js +178 -0
  542. package/dist/vite/server-sourcemaps.d.ts +8 -0
  543. package/dist/vite/server-sourcemaps.js +80 -0
  544. package/dist/vite/sourcemaps.d.ts +18 -0
  545. package/dist/vite/sourcemaps.js +80 -0
  546. package/dist/vite/style-preprocess.d.ts +2 -0
  547. package/dist/vite/style-preprocess.js +96 -0
  548. package/package.json +180 -6
@@ -0,0 +1 @@
1
+ export declare function is_script_request(id: string): boolean;
@@ -0,0 +1,43 @@
1
+ // src/compiler/script-request.ts
2
+ /**
3
+ * Is this module id a request for the module's SCRIPT? The query decides. vite-plugin-svelte serves
4
+ * a component's extracted CSS as `Foo.svelte?svelte&type=style&lang.css`, and Vite's `?raw`, `?url`,
5
+ * `?inline`, `?worker` are not the module's code either. Passes that strip the query before an
6
+ * extension test took those for the component: the barrel rewrite ran the Svelte parser over plain
7
+ * CSS, threw, and reported every component with a `<style>` as skipped (3,233 false warnings in one
8
+ * production build, burying the real ones). A cache query (`?v=123`, `?t=…`) or ogygia's own
9
+ * (`?og-region`) is still the script. String scanning, no regex: it runs for every module.
10
+ */
11
+ /** Vite's query flags whose payload is not the module's script */
12
+ const NON_SCRIPT_FLAGS = /* @__PURE__ */ new Set([
13
+ "raw",
14
+ "url",
15
+ "inline",
16
+ "worker",
17
+ "sharedworker",
18
+ "direct"
19
+ ]);
20
+ const SCRIPT_LANGS = /* @__PURE__ */ new Set([
21
+ "js",
22
+ "ts",
23
+ "jsx",
24
+ "tsx",
25
+ "mjs",
26
+ "cjs",
27
+ "mts",
28
+ "cts"
29
+ ]);
30
+ function is_script_request(id) {
31
+ const q = id.indexOf("?");
32
+ if (q === -1) return true;
33
+ const end = id.indexOf("#", q);
34
+ for (const part of id.slice(q + 1, end === -1 ? void 0 : end).split("&")) {
35
+ const eq = part.indexOf("=");
36
+ const key = eq === -1 ? part : part.slice(0, eq);
37
+ if (NON_SCRIPT_FLAGS.has(key)) return false;
38
+ if (key === "type" && part.slice(eq + 1) !== "script") return false;
39
+ if (key.startsWith("lang.") && !SCRIPT_LANGS.has(key.slice(5))) return false;
40
+ }
41
+ return true;
42
+ }
43
+ export { is_script_request };
@@ -0,0 +1,65 @@
1
+ import { SetContextOptions } from "./context-registry.js";
2
+ /** Serialize a context value for the DOM — same codec as island props (one hub key). */
3
+ export declare function serialize_context(value: unknown): string;
4
+ export declare function serialize_provided_context(map: Map<string, unknown>): string | null;
5
+ /**
6
+ * Walk up from an island being hydrated, collecting every `<ogygia-provide>` above it (nearest wins)
7
+ * into one Map, then fold in the single page-level `<script data-ogygia-provide-page>` marker as the
8
+ * ROOT (lowest priority). ogygia seeds `hydrate(…, { context })` with the Map, so a child island's own
9
+ * `getContext('key')` — unchanged — reads a layout's context across the island-root split on a
10
+ * csr=false page.
11
+ *
12
+ * Two providers feed it: a `<Provide>` component (scoped, walked up — nesting/shadowing correct), and
13
+ * the drop-in `setContext` (page marker — one flat root the whole page shares, for existing layouts
14
+ * that just import `setContext` from `ogygia`). Scoped beats root on the same key. Undefined when
15
+ * neither exists (the common case: nothing to seed, no cost). Same decode codec as island props (a
16
+ * `[ogygia.wire]` value revives to its one live instance).
17
+ */
18
+ export declare function collect_provided_context(start: Element | null): Map<string, unknown> | undefined;
19
+ /** A typed context handle: callable to make a `<Provide>` entry, `.get()` to read (typed). */
20
+ export interface Context<T> {
21
+ /** `theme('dark')` → `{ theme: 'dark' }` — an entry for `<Provide values={[ … ]}>`. */
22
+ (value: T): Record<string, unknown>;
23
+ /** Typed read — plain `getContext(key)` under the hood (seeded across islands), or the default. */
24
+ get(): T | undefined;
25
+ /** The underlying string key, for `getContext(theme.key)` interop. */
26
+ readonly key: string;
27
+ }
28
+ /**
29
+ * Typed sugar over a string context key, shared with plain `getContext`. Callable to produce a
30
+ * `<Provide>` entry, `.get()` to read (typed). The key is the same string plain `getContext` uses, so
31
+ * typed and untyped code read the same context. An optional default is returned when nothing is
32
+ * provided above.
33
+ *
34
+ * ```ts
35
+ * export const theme = createContext<'light' | 'dark'>('theme', 'light');
36
+ * // provide: <Provide values={[ theme('dark') ]}>…</Provide>
37
+ * // read: theme.get() // typed
38
+ * // getContext('theme') // untyped — same key, same value
39
+ * ```
40
+ */
41
+ export declare function createContext<T>(key: string, defaultValue?: T): Context<T>;
42
+ /**
43
+ * Drop-in `setContext` — swap `import { setContext } from 'svelte'` for `from 'ogygia'` and an
44
+ * existing csr=false layout's context reaches child islands with NO other change.
45
+ *
46
+ * It does exactly what Svelte's does (sets context for same-root descendants + the SSR-nested tree),
47
+ * AND on the server records the value so the handle can emit one page-level marker every island seeds
48
+ * from — closing the gap where a plain `setContext` shows up on the server but is gone on the client
49
+ * (child islands are separate hydration roots). Only string keys bridge (they must serialize and be
50
+ * read by `getContext('key')`); a symbol key is Svelte-only, same-root, no bridge.
51
+ *
52
+ * GRANULARITY: the optional third argument is the explicit marker — `{ islands: false }` keeps a key
53
+ * host-native (same-root context works, nothing serializes). The default bridges: a missing key in an
54
+ * island is a broken app, extra bytes are not. Ogygia never infers readership from `getContext` call
55
+ * sites (aliased imports and wrapper modules would make any scan miss reads — the fatal direction).
56
+ *
57
+ * This is the FLAT page root: every island on the page inherits it. For scoped/shadowed context use
58
+ * `<Provide>`, which wraps its subtree and beats the root on the same key.
59
+ */
60
+ export declare function setContext<T>(key: unknown, value: T, opts?: SetContextOptions): T;
61
+ /**
62
+ * Kept for ABI: the build still emits a registration call for each `createContext(...)` export (that
63
+ * used to tag keyless handles by `module#export`). Keys are explicit now, so this is a no-op.
64
+ */
65
+ export declare function __tag_context(): void;
@@ -0,0 +1,217 @@
1
+ import { batch } from "./ref-watch.js";
2
+ import { REF_WIRE_KEY, ref_reducer, ref_reviver } from "./ref.js";
3
+ import { register_wire_kind } from "./live-transport.js";
4
+ import { register_derived_kind, register_store_kind } from "./store-transport.js";
5
+ import { register_snippet_kind } from "./region-snippet.js";
6
+ import { is_branded_fn, register_fn_kind } from "./fn-transport.js";
7
+ import { boundary_problems, format_boundary_finding } from "./boundary.js";
8
+ import { PAGE_CTX_MARKER, record_ctx } from "./context-registry.js";
9
+ import { escape_script_text } from "./escape.js";
10
+ import { getContext, setContext as setContext$1 } from "svelte";
11
+ import { DEV } from "esm-env";
12
+ import { parse, stringify } from "devalue";
13
+ // src/context-bridge.ts
14
+ /**
15
+ * Cross-island context — one bridge, plain `getContext`.
16
+ *
17
+ * Component trees break at every island boundary; the DOM tree does not. A `<Provide values={…}>`
18
+ * writes its values into the DOM (serialized with the SAME codec as island props), and ogygia seeds
19
+ * each island's `hydrate({ context })` from the providers above it — so a child island's own
20
+ * `getContext('key')`, unchanged, reads a (csr=false) layout's context across the island-root split.
21
+ * A `[ogygia.wire]` value resolves to the one live instance (shared + reactive); a plain value is a
22
+ * per-consumer snapshot.
23
+ *
24
+ * `createContext(key)` is optional TYPED sugar over the same string key — callable to make a
25
+ * `<Provide>` entry, `.get()` to read (typed). Nothing DOM-specific on the consumer side.
26
+ */
27
+ function ensure_ctx_kinds() {
28
+ register_wire_kind();
29
+ register_store_kind();
30
+ register_snippet_kind();
31
+ register_fn_kind();
32
+ register_derived_kind();
33
+ }
34
+ /** The `<Provide>` seam carries classes, stores AND snippets (a snippet freezes/travels live). */
35
+ const PROVIDE_FAMILIES = /* @__PURE__ */ new Set([
36
+ "wire",
37
+ "store",
38
+ "snippet",
39
+ "fn",
40
+ "derived"
41
+ ]);
42
+ /** The drop-in page-marker seam deliberately EXCLUDES snippets: there, a bare function must
43
+ * THROW (and be dropped with a dev explanation) rather than be silently frozen as one. */
44
+ const BRIDGE_FAMILIES = /* @__PURE__ */ new Set([
45
+ "wire",
46
+ "store",
47
+ "fn",
48
+ "derived"
49
+ ]);
50
+ /** Serialize a context value for the DOM — same codec as island props (one hub key). */
51
+ function serialize_context(value) {
52
+ ensure_ctx_kinds();
53
+ return escape_script_text(stringify(value, { [REF_WIRE_KEY]: ref_reducer(PROVIDE_FAMILIES) }));
54
+ }
55
+ /**
56
+ * Serialize for the drop-in `setContext` page marker WITHOUT the region-snippet reducer. That reducer
57
+ * treats every function as a snippet (snippets are unbranded functions), which would silently turn a
58
+ * `setContext('trackPageView', fn)` — or a class method — into a bogus snippet instead of failing.
59
+ * Here a function must THROW so the offending value gets dropped (see below). Transportables
60
+ * (`[ogygia.wire]`) and stores (auto-wired: value crosses, islands reunite to one live instance)
61
+ * cross. A snippet in context is a `<Provide>` concern, not this drop-in path.
62
+ */
63
+ function stringify_bridgeable(value) {
64
+ ensure_ctx_kinds();
65
+ return escape_script_text(stringify(value, { [REF_WIRE_KEY]: ref_reducer(BRIDGE_FAMILIES) }));
66
+ }
67
+ /**
68
+ * Serialize the drop-in `setContext` page-root bag for the DOM marker. A layout may `setContext` a
69
+ * FUNCTION (e.g. `trackPageView`) or a DOM-holding object — values that genuinely can't cross an
70
+ * island boundary. Rather than crash the page (or bridge a broken value), drop the offenders
71
+ * key-by-key and bridge the rest; in DEV each drop is explained by the boundary classifier (key +
72
+ * path + what to do), so a missing context inside an island is never a mystery. Returns null if
73
+ * nothing serializable remains. The happy path (all serializable) is a single `stringify`.
74
+ */
75
+ /** DEV threshold for the page-marker payload — islands ship context into every page's HTML. */
76
+ const CTX_SIZE_WARN_BYTES = 32768;
77
+ function serialize_provided_context(map) {
78
+ const obj = {};
79
+ for (const [k, v] of map) obj[k] = v;
80
+ try {
81
+ const payload = stringify_bridgeable(obj);
82
+ if (DEV && payload.length > CTX_SIZE_WARN_BYTES) warn_ctx_size(map, payload.length);
83
+ return payload;
84
+ } catch {
85
+ const safe = {};
86
+ for (const k in obj) try {
87
+ stringify_bridgeable({ [k]: obj[k] });
88
+ safe[k] = obj[k];
89
+ if (DEV) warn_boundary(k, obj[k], false);
90
+ } catch {
91
+ if (DEV) warn_boundary(k, obj[k], true);
92
+ }
93
+ return Object.keys(safe).length ? stringify_bridgeable(safe) : null;
94
+ }
95
+ }
96
+ /** DEV: the page marker is heavy — name the biggest keys so the fix is obvious (mark them
97
+ * { islands: false }, or slim the value). Sizes are per-key serialized lengths. */
98
+ function warn_ctx_size(map, total) {
99
+ const sizes = [];
100
+ for (const [k, v] of map) try {
101
+ sizes.push([k, stringify_bridgeable({ [k]: v }).length]);
102
+ } catch {}
103
+ sizes.sort((a, b) => b[1] - a[1]);
104
+ const top = sizes.slice(0, 3).map(([k, n]) => `'${k}' ~${(n / 1024).toFixed(1)}kB`).join(", ");
105
+ console.warn(`[ogygia] the island context marker is ${(total / 1024).toFixed(1)}kB — it ships in every page's HTML. Biggest keys: ${top}. Slim the values, or mark host-only keys with setContext(key, value, { islands: false }).`);
106
+ }
107
+ /** DEV: explain a dropped (or degraded-but-bridged) context key via the classifier. */
108
+ function warn_boundary(key, value, dropped) {
109
+ const problems = boundary_problems(value, key);
110
+ if (dropped && problems.length === 0) {
111
+ console.warn(`[ogygia] context '${key}' could not be serialized for islands and was dropped.`);
112
+ return;
113
+ }
114
+ for (const f of problems) if (dropped || f.kind === "warn") console.warn(format_boundary_finding(key, f));
115
+ }
116
+ /** Decode one serialized provider payload; a corrupt payload yields nothing (never breaks hydration). */
117
+ function parse_ctx(text) {
118
+ if (!text) return void 0;
119
+ ensure_ctx_kinds();
120
+ try {
121
+ return batch(() => parse(text, { [REF_WIRE_KEY]: ref_reviver(true) }));
122
+ } catch {
123
+ return;
124
+ }
125
+ }
126
+ /**
127
+ * Walk up from an island being hydrated, collecting every `<ogygia-provide>` above it (nearest wins)
128
+ * into one Map, then fold in the single page-level `<script data-ogygia-provide-page>` marker as the
129
+ * ROOT (lowest priority). ogygia seeds `hydrate(…, { context })` with the Map, so a child island's own
130
+ * `getContext('key')` — unchanged — reads a layout's context across the island-root split on a
131
+ * csr=false page.
132
+ *
133
+ * Two providers feed it: a `<Provide>` component (scoped, walked up — nesting/shadowing correct), and
134
+ * the drop-in `setContext` (page marker — one flat root the whole page shares, for existing layouts
135
+ * that just import `setContext` from `ogygia`). Scoped beats root on the same key. Undefined when
136
+ * neither exists (the common case: nothing to seed, no cost). Same decode codec as island props (a
137
+ * `[ogygia.wire]` value revives to its one live instance).
138
+ */
139
+ function collect_provided_context(start) {
140
+ let el = start;
141
+ let map;
142
+ const fold = (values) => {
143
+ if (!values) return;
144
+ map ??= /* @__PURE__ */ new Map();
145
+ for (const k in values) if (!map.has(k)) map.set(k, values[k]);
146
+ };
147
+ while (el) {
148
+ if (el.tagName === "OGYGIA-PROVIDE") fold(parse_ctx(el.querySelector(":scope > script[data-ogygia-provide]")?.textContent));
149
+ el = el.parentElement;
150
+ }
151
+ if (typeof document !== "undefined") fold(page_ctx());
152
+ return map;
153
+ }
154
+ /** The page's context root, found and parsed ONCE per document (every island's hydrate asks; a
155
+ * search of the whole DOM each time grew with the page). A router swap brings the next page's. */
156
+ let page_ctx_cache = null;
157
+ let page_ctx_reset = false;
158
+ function page_ctx() {
159
+ if (!page_ctx_reset) {
160
+ page_ctx_reset = true;
161
+ document.addEventListener("og:after-swap", () => page_ctx_cache = null);
162
+ }
163
+ return (page_ctx_cache ??= { value: parse_ctx(document.querySelector(`script[${PAGE_CTX_MARKER}]`)?.textContent) }).value;
164
+ }
165
+ /**
166
+ * Typed sugar over a string context key, shared with plain `getContext`. Callable to produce a
167
+ * `<Provide>` entry, `.get()` to read (typed). The key is the same string plain `getContext` uses, so
168
+ * typed and untyped code read the same context. An optional default is returned when nothing is
169
+ * provided above.
170
+ *
171
+ * ```ts
172
+ * export const theme = createContext<'light' | 'dark'>('theme', 'light');
173
+ * // provide: <Provide values={[ theme('dark') ]}>…</Provide>
174
+ * // read: theme.get() // typed
175
+ * // getContext('theme') // untyped — same key, same value
176
+ * ```
177
+ */
178
+ function createContext(key, defaultValue) {
179
+ const ctx = ((value) => ({ [key]: value }));
180
+ Object.defineProperty(ctx, "key", {
181
+ value: key,
182
+ enumerable: true
183
+ });
184
+ ctx.get = () => {
185
+ const v = getContext(key);
186
+ return v !== void 0 ? v : defaultValue;
187
+ };
188
+ return ctx;
189
+ }
190
+ /**
191
+ * Drop-in `setContext` — swap `import { setContext } from 'svelte'` for `from 'ogygia'` and an
192
+ * existing csr=false layout's context reaches child islands with NO other change.
193
+ *
194
+ * It does exactly what Svelte's does (sets context for same-root descendants + the SSR-nested tree),
195
+ * AND on the server records the value so the handle can emit one page-level marker every island seeds
196
+ * from — closing the gap where a plain `setContext` shows up on the server but is gone on the client
197
+ * (child islands are separate hydration roots). Only string keys bridge (they must serialize and be
198
+ * read by `getContext('key')`); a symbol key is Svelte-only, same-root, no bridge.
199
+ *
200
+ * GRANULARITY: the optional third argument is the explicit marker — `{ islands: false }` keeps a key
201
+ * host-native (same-root context works, nothing serializes). The default bridges: a missing key in an
202
+ * island is a broken app, extra bytes are not. Ogygia never infers readership from `getContext` call
203
+ * sites (aliased imports and wrapper modules would make any scan miss reads — the fatal direction).
204
+ *
205
+ * This is the FLAT page root: every island on the page inherits it. For scoped/shadowed context use
206
+ * `<Provide>`, which wraps its subtree and beats the root on the same key.
207
+ */
208
+ function setContext(key, value, opts) {
209
+ if (typeof key === "string" && (typeof value !== "function" || is_branded_fn(value))) record_ctx(key, value, opts);
210
+ return setContext$1(key, value);
211
+ }
212
+ /**
213
+ * Kept for ABI: the build still emits a registration call for each `createContext(...)` export (that
214
+ * used to tag keyless handles by `module#export`). Keys are explicit now, so this is a no-op.
215
+ */
216
+ function __tag_context() {}
217
+ export { __tag_context, collect_provided_context, createContext, serialize_context, serialize_provided_context, setContext };
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Server-side capture for ogygia's drop-in `setContext` (see `./set-context.ts`). A layout that calls
3
+ * `setContext('key', value)` (import swapped from `svelte` to `ogygia`) records the value HERE during
4
+ * SSR; the server handle reads the per-request bag and emits ONE page-level `<script
5
+ * data-ogygia-provide-page>` marker, which every island seeds its own `getContext('key')` from at
6
+ * hydrate. That's how a plain `setContext` in a csr=false layout reaches child islands (separate
7
+ * hydration roots) without a `<Provide>` in the template.
8
+ *
9
+ * Universal-safe by design: the recorder is a slot the SERVER installs (backed by an
10
+ * `AsyncLocalStorage` in `hooks.ts`), so `node:async_hooks` never enters the client bundle — on the
11
+ * client `record_ctx` is a no-op.
12
+ */
13
+ type Recorder = (key: string, value: unknown) => void;
14
+ /** Server (`hooks.ts`) installs a request-scoped recorder. */
15
+ export declare function set_ctx_recorder(fn: Recorder | null): void;
16
+ /**
17
+ * Options a drop-in `setContext` may carry as its third argument. Svelte's own signature is
18
+ * two-arg, so existing code is untouched — the marker is strictly additive.
19
+ */
20
+ export interface SetContextOptions {
21
+ /**
22
+ * GRANULARITY MARKER. `false` = this key is host-native: serve it to the same-root tree
23
+ * (Svelte context, unchanged) but never serialize it into the island page marker. Use it
24
+ * for values islands never read — a DOM-ref bag, a host-only callback, a large config
25
+ * object — so they cost nothing on the wire.
26
+ *
27
+ * DEFAULT is `true` (bridge): the safe direction. A missing key inside an island is a
28
+ * broken app; an extra bridged key is just bytes. Ogygia deliberately does NOT infer this
29
+ * from `getContext` call-sites — import aliasing (`import { getContext as x }`), wrapper
30
+ * modules, and custom context layers make any scan under-inclusive, and under-inclusion
31
+ * is the fatal direction. You mark; ogygia never guesses.
32
+ */
33
+ islands?: boolean;
34
+ }
35
+ /** The drop-in `setContext` calls this — server records for the page bridge, client is a no-op.
36
+ * `opts.islands === false` skips recording: the key stays native-only (never serialized). */
37
+ export declare function record_ctx(key: string, value: unknown, opts?: SetContextOptions): void;
38
+ /** DOM marker the server emits (before `</body>`) and `collect_provided_context` reads. */
39
+ export declare const PAGE_CTX_MARKER = "data-ogygia-provide-page";
40
+ export {};
@@ -0,0 +1,15 @@
1
+ // src/context-registry.ts
2
+ let recorder = null;
3
+ /** Server (`hooks.ts`) installs a request-scoped recorder. */
4
+ function set_ctx_recorder(fn) {
5
+ recorder = fn;
6
+ }
7
+ /** The drop-in `setContext` calls this — server records for the page bridge, client is a no-op.
8
+ * `opts.islands === false` skips recording: the key stays native-only (never serialized). */
9
+ function record_ctx(key, value, opts) {
10
+ if (opts?.islands === false) return;
11
+ recorder?.(key, value);
12
+ }
13
+ /** DOM marker the server emits (before `</body>`) and `collect_provided_context` reads. */
14
+ const PAGE_CTX_MARKER = "data-ogygia-provide-page";
15
+ export { PAGE_CTX_MARKER, record_ctx, set_ctx_recorder };
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Mark the current subtree's hydration state. `true` = inside a hydrated island (nested islands
3
+ * degrade). `false` = a LAKE resets its subtree to "dead", so an island inside the lake self-
4
+ * hydrates again (the nearest-boundary rule — DESIGN.md).
5
+ */
6
+ export declare function setNested(value?: boolean): void;
7
+ /**
8
+ * True when an ancestor island wrapper already marked the subtree. `getContext` returns `undefined`
9
+ * when no ancestor set it (a top-level island) — that absence is exactly "not nested".
10
+ */
11
+ export declare function isNested(): boolean;
12
+ /** Mark the current subtree as opaque to Kit — a lake's inside (LakeBoundary). */
13
+ export declare function setInLake(): void;
14
+ /** True when the subtree is opaque to Kit (a lake's inside, or a held region's render). */
15
+ export declare function isInLake(): boolean;
16
+ /** Reset the live-snippet mark for the current subtree (an inline island inside a snippet). */
17
+ export declare function setInLiveSnippet(value: boolean): void;
18
+ /** True inside a live snippet's body (and not under an island it renders inline). */
19
+ export declare function isInLiveSnippet(): boolean;
20
+ /** Region.svelte marks the subtree of a server island it is rendering inline (nested). */
21
+ export declare function setHoleInline(): void;
22
+ /** Is this render a server island's component rendering INLINE (nested in an island)? */
23
+ export declare function isHoleInline(): boolean;
24
+ /**
25
+ * Does Kit hydrate THIS WHOLE DOCUMENT? The leaf page's effective csr is the single fact that decides
26
+ * it, so a `<Region>` reads it directly — no per-host context cascade. When true, every island (a
27
+ * csr=true page's own, a csr=false layout's chrome, a shared component's) degrades to a plain inline
28
+ * component that Kit hydrates. Server: the route is in the build-time csr=true set. Client: Kit
29
+ * shipped its bootstrap. Same fact on both legs → the inline/island choice can never desync at
30
+ * hydrate. (Replaces the old `CSR_TRUE_KEY` marker + `csr=false` reset, which only re-derived this
31
+ * number indirectly through the context cascade.)
32
+ */
33
+ export declare function documentIsCsrTrue(error_render?: boolean): boolean;
34
+ /**
35
+ * PUBLIC: is the current page an ogygia page (csr=false), as opposed to a csr=true page Kit hydrates
36
+ * whole? The inverse of {@link documentIsCsrTrue}, so it answers on BOTH legs with no requestEvent
37
+ * handling on the caller's side — server reads the request's route against the build-time csr set,
38
+ * client reads Kit's bootstrap. Meant for shared code (a store, a helper) that must branch on which
39
+ * world it runs in. Off-request on the server (a module init, a prerender helper with no page) there
40
+ * is no document to speak of, so it returns `false`.
41
+ */
42
+ export declare function isOgygiaPage(): boolean;
43
+ /** The same fact from a route id in hand (the handle has the event): is this route's leaf page
44
+ * csr=true? A build-time answer — never a scan of the rendered document. */
45
+ export declare function route_is_csr_true(id: string | null | undefined): boolean;
46
+ /** The ERROR-page twin: does Kit hydrate this route's `+error.svelte`? Kit renders an error page
47
+ * with the layout branch only (the page node — and its `csr = false` — is dropped), so this reads
48
+ * the layouts' answer; a routeless response (no route matched) is the root layout's. */
49
+ export declare function error_route_is_csr_true(id: string | null | undefined): boolean;
50
+ /**
51
+ * Claim an INLINE-rendered island's entry for this SSR request — true the first time, so the page
52
+ * stamps one `<meta name="ogygia-kit-island" content="<entry>">` per rendered island, however many
53
+ * instances render. The client wrapper's lazy component module reads the stamp before Kit hydrates
54
+ * (emit.ts `lazy_entry_source`): a stamped island's entry is imported, an unstamped one costs
55
+ * nothing. Client / no-request → false (nothing to stamp there).
56
+ */
57
+ export declare function claim_kit_island(entry: string): boolean;
58
+ /**
59
+ * Claim stylesheet hrefs for this SSR request, returning only the not-yet-claimed ones. A held
60
+ * region's component is server-picked, so its CSS is on no page stylesheet (Kit links CSS from the
61
+ * route's STATIC import graph — it never reads the rendered page). The region wrapper links it from
62
+ * the render pass instead, via `<svelte:head>`; claiming here dedupes so five `Feature` blocks on a
63
+ * page link their shared sheet once. Client / no-request → [] (SSR already linked them).
64
+ */
65
+ export declare function claim_region_css(hrefs: string[]): string[];
66
+ /**
67
+ * Claim the single runtime-script slot for this SSR request. An island/server placement emits the
68
+ * runtime bootstrap so it hydrates even with the router off; when the router is on, the handle
69
+ * injects the same script into `<head>` (presence-checked) on pages that have no island to emit it.
70
+ * Client / no-request → false (SSR already emitted).
71
+ */
72
+ export declare function claimRuntimeEmit(): boolean;
@@ -0,0 +1,158 @@
1
+ import { kit_hydrates_page } from "./runtime/kit-boot.js";
2
+ import { getContext, setContext } from "svelte";
3
+ import { BROWSER } from "esm-env";
4
+ import { getRequestEvent } from "virtual:ogygia/request-event";
5
+ import { csr_true_routes, error_csr_true_routes, root_layout_csr_true } from "virtual:ogygia/route-csr";
6
+ // src/context.ts
7
+ const NESTED_KEY = Symbol.for("ogygia.nested-island");
8
+ /**
9
+ * Mark the current subtree's hydration state. `true` = inside a hydrated island (nested islands
10
+ * degrade). `false` = a LAKE resets its subtree to "dead", so an island inside the lake self-
11
+ * hydrates again (the nearest-boundary rule — DESIGN.md).
12
+ */
13
+ function setNested(value = true) {
14
+ setContext(NESTED_KEY, value);
15
+ }
16
+ /**
17
+ * True when an ancestor island wrapper already marked the subtree. `getContext` returns `undefined`
18
+ * when no ancestor set it (a top-level island) — that absence is exactly "not nested".
19
+ */
20
+ function isNested() {
21
+ return getContext(NESTED_KEY) === true;
22
+ }
23
+ const LAKE_KEY = Symbol.for("ogygia.lake-subtree");
24
+ /** Mark the current subtree as opaque to Kit — a lake's inside (LakeBoundary). */
25
+ function setInLake() {
26
+ setContext(LAKE_KEY, true);
27
+ }
28
+ /** True when the subtree is opaque to Kit (a lake's inside, or a held region's render). */
29
+ function isInLake() {
30
+ return getContext(LAKE_KEY) === true;
31
+ }
32
+ const LIVE_SNIPPET_KEY = Symbol.for("ogygia.live-snippet");
33
+ /** Reset the live-snippet mark for the current subtree (an inline island inside a snippet). */
34
+ function setInLiveSnippet(value) {
35
+ setContext(LIVE_SNIPPET_KEY, value);
36
+ }
37
+ /** True inside a live snippet's body (and not under an island it renders inline). */
38
+ function isInLiveSnippet() {
39
+ return getContext(LIVE_SNIPPET_KEY) === true;
40
+ }
41
+ const HOLE_INLINE_KEY = Symbol.for("ogygia.hole-inline");
42
+ /** Region.svelte marks the subtree of a server island it is rendering inline (nested). */
43
+ function setHoleInline() {
44
+ setContext(HOLE_INLINE_KEY, true);
45
+ }
46
+ /** Is this render a server island's component rendering INLINE (nested in an island)? */
47
+ function isHoleInline() {
48
+ return getContext(HOLE_INLINE_KEY) === true;
49
+ }
50
+ /** Kit `route.id`, GROUP segments (`(app)`) stripped — mirrors the compiler's `normalize_route_id`
51
+ * so both sides match whether or not Kit keeps groups in `route.id`. Root → `/`. */
52
+ function normalize_route_id(id) {
53
+ return "/" + id.split("/").filter(Boolean).filter((s) => !(s.startsWith("(") && s.endsWith(")"))).join("/");
54
+ }
55
+ /**
56
+ * Does Kit hydrate THIS WHOLE DOCUMENT? The leaf page's effective csr is the single fact that decides
57
+ * it, so a `<Region>` reads it directly — no per-host context cascade. When true, every island (a
58
+ * csr=true page's own, a csr=false layout's chrome, a shared component's) degrades to a plain inline
59
+ * component that Kit hydrates. Server: the route is in the build-time csr=true set. Client: Kit
60
+ * shipped its bootstrap. Same fact on both legs → the inline/island choice can never desync at
61
+ * hydrate. (Replaces the old `CSR_TRUE_KEY` marker + `csr=false` reset, which only re-derived this
62
+ * number indirectly through the context cascade.)
63
+ */
64
+ function documentIsCsrTrue(error_render = false) {
65
+ if (BROWSER) return kit_hydrates_page();
66
+ try {
67
+ const event = getRequestEvent();
68
+ return error_render ? error_route_is_csr_true(event.route?.id) : route_is_csr_true(event.route?.id);
69
+ } catch {
70
+ return false;
71
+ }
72
+ }
73
+ /**
74
+ * PUBLIC: is the current page an ogygia page (csr=false), as opposed to a csr=true page Kit hydrates
75
+ * whole? The inverse of {@link documentIsCsrTrue}, so it answers on BOTH legs with no requestEvent
76
+ * handling on the caller's side — server reads the request's route against the build-time csr set,
77
+ * client reads Kit's bootstrap. Meant for shared code (a store, a helper) that must branch on which
78
+ * world it runs in. Off-request on the server (a module init, a prerender helper with no page) there
79
+ * is no document to speak of, so it returns `false`.
80
+ */
81
+ function isOgygiaPage() {
82
+ return !documentIsCsrTrue();
83
+ }
84
+ /** The same fact from a route id in hand (the handle has the event): is this route's leaf page
85
+ * csr=true? A build-time answer — never a scan of the rendered document. */
86
+ function route_is_csr_true(id) {
87
+ return id != null && csr_true_routes.has(normalize_route_id(id));
88
+ }
89
+ /** The ERROR-page twin: does Kit hydrate this route's `+error.svelte`? Kit renders an error page
90
+ * with the layout branch only (the page node — and its `csr = false` — is dropped), so this reads
91
+ * the layouts' answer; a routeless response (no route matched) is the root layout's. */
92
+ function error_route_is_csr_true(id) {
93
+ if (id == null) return root_layout_csr_true;
94
+ return error_csr_true_routes.has(normalize_route_id(id));
95
+ }
96
+ /** Per-request: only one `data-ogygia-runtime` script should be emitted (the first island). */
97
+ const runtime_claimed = /* @__PURE__ */ new WeakMap();
98
+ /** Per-request: stylesheet hrefs already linked for held regions rendered in this SSR pass. */
99
+ const region_css_claimed = /* @__PURE__ */ new WeakMap();
100
+ /** Per-request: island entries already stamped `<meta name="ogygia-kit-island">` in this pass. */
101
+ const kit_island_claimed = /* @__PURE__ */ new WeakMap();
102
+ /**
103
+ * Claim an INLINE-rendered island's entry for this SSR request — true the first time, so the page
104
+ * stamps one `<meta name="ogygia-kit-island" content="<entry>">` per rendered island, however many
105
+ * instances render. The client wrapper's lazy component module reads the stamp before Kit hydrates
106
+ * (emit.ts `lazy_entry_source`): a stamped island's entry is imported, an unstamped one costs
107
+ * nothing. Client / no-request → false (nothing to stamp there).
108
+ */
109
+ function claim_kit_island(entry) {
110
+ if (!entry) return false;
111
+ try {
112
+ const event = getRequestEvent();
113
+ let seen = kit_island_claimed.get(event);
114
+ if (!seen) kit_island_claimed.set(event, seen = /* @__PURE__ */ new Set());
115
+ if (seen.has(entry)) return false;
116
+ seen.add(entry);
117
+ return true;
118
+ } catch {
119
+ return false;
120
+ }
121
+ }
122
+ /**
123
+ * Claim stylesheet hrefs for this SSR request, returning only the not-yet-claimed ones. A held
124
+ * region's component is server-picked, so its CSS is on no page stylesheet (Kit links CSS from the
125
+ * route's STATIC import graph — it never reads the rendered page). The region wrapper links it from
126
+ * the render pass instead, via `<svelte:head>`; claiming here dedupes so five `Feature` blocks on a
127
+ * page link their shared sheet once. Client / no-request → [] (SSR already linked them).
128
+ */
129
+ function claim_region_css(hrefs) {
130
+ if (!hrefs.length) return [];
131
+ try {
132
+ const event = getRequestEvent();
133
+ let seen = region_css_claimed.get(event);
134
+ if (!seen) region_css_claimed.set(event, seen = /* @__PURE__ */ new Set());
135
+ const fresh = hrefs.filter((h) => !seen.has(h));
136
+ for (const h of fresh) seen.add(h);
137
+ return fresh;
138
+ } catch {
139
+ return [];
140
+ }
141
+ }
142
+ /**
143
+ * Claim the single runtime-script slot for this SSR request. An island/server placement emits the
144
+ * runtime bootstrap so it hydrates even with the router off; when the router is on, the handle
145
+ * injects the same script into `<head>` (presence-checked) on pages that have no island to emit it.
146
+ * Client / no-request → false (SSR already emitted).
147
+ */
148
+ function claimRuntimeEmit() {
149
+ try {
150
+ const event = getRequestEvent();
151
+ if (runtime_claimed.has(event)) return false;
152
+ runtime_claimed.set(event, true);
153
+ return true;
154
+ } catch {
155
+ return false;
156
+ }
157
+ }
158
+ export { claimRuntimeEmit, claim_kit_island, claim_region_css, documentIsCsrTrue, error_route_is_csr_true, isHoleInline, isInLake, isInLiveSnippet, isNested, isOgygiaPage, route_is_csr_true, setHoleInline, setInLake, setInLiveSnippet, setNested };
@@ -0,0 +1,14 @@
1
+ /** Runtime sets the region it is about to hydrate so a nested `get()` knows where to start walking. */
2
+ export declare function set_current_region(el: Element | null): void;
3
+ /** The region currently being hydrated (or null) — read by the context feature's client DOM walk. */
4
+ export declare function current_region(): Element | null;
5
+ export interface ForeignHydrate {
6
+ /** The MFE origin the island's entry was loaded from. */
7
+ origin: string;
8
+ /** The absolute entry URL — the island's identity for once-per-island warnings. */
9
+ entry: string;
10
+ }
11
+ /** Runtime marks the foreign island it is about to delegate-hydrate (null when done). */
12
+ export declare function set_foreign_hydrate(info: ForeignHydrate | null): void;
13
+ /** The foreign island currently hydrating (or null) — read by the page shims' dev warning. */
14
+ export declare function foreign_hydrate(): ForeignHydrate | null;