@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,56 @@
1
+ import { SeedIndex } from "../seed-refs.js";
2
+ /** The sidecar attribute naming a non-devalue payload format; absent = devalue. */
3
+ export declare const WIRE_FORMAT_ATTR = "data-og-format";
4
+ /** The one non-devalue format: plain JSON, read with `JSON.parse`. */
5
+ export declare const WIRE_FORMAT_JSON = "json";
6
+ /** On a props sidecar: the transportable classes its props carry (tag paths, space-separated) —
7
+ * what the browser loads before it decodes them. */
8
+ export declare const WIRE_CLASSES_ATTR = "data-og-wire";
9
+ /**
10
+ * devalue-serialize an island's props with the prop families' reducers, plus the seed-reference
11
+ * reducer when the caller has one. Throws a teaching error on a non-serializable prop.
12
+ */
13
+ export declare function stringify_props(value: unknown, entry: string, seed_refs?: ((v: unknown) => unknown) | null, wire_out?: Set<string> | null): string;
14
+ /** A sidecar's text and the lane it is in. */
15
+ export interface WireText {
16
+ text: string;
17
+ json: boolean;
18
+ }
19
+ export interface PropsWire {
20
+ /** The canonical, seed-independent text — what the fingerprint hashes. */
21
+ readonly canonical: string;
22
+ /** Whether the canonical text is plain JSON (the lane the props qualify for). */
23
+ readonly json: boolean;
24
+ /** Live region-snippet entry URLs riding in these props (the preloads they need). Only a
25
+ * devalue payload can carry one — a live snippet is a branded function, never plain JSON. */
26
+ readonly live_entries: readonly string[];
27
+ /** The transportable classes these props carry, by tag path (root-relative module): the browser
28
+ * loads just these before decoding (it no longer loads every transportable up front). */
29
+ readonly wire_modules: readonly string[];
30
+ /** The sidecar text for the wire. `seed` is the page seed's index when the seed ships (then a
31
+ * props subtree that is a seed node crosses as a reference), `null` when it does not. */
32
+ wire(seed: SeedIndex | null): WireText;
33
+ /** The references the LAST `wire()` wrote: how many, into which top-level `page.data` keys. */
34
+ readonly refs: {
35
+ count: number;
36
+ keys: readonly string[];
37
+ };
38
+ /** Why the canonical text is not JSON (the first disqualifying leaf); `null` on the JSON lane.
39
+ * A separate walk, run on demand — the profiler's explainer, never the render path. */
40
+ culprit(): string | null;
41
+ }
42
+ /**
43
+ * Plan an island's sidecar: lane, canonical text, live snippet entries — and a `wire(seed)` that
44
+ * produces the final text once the request knows about the seed (the document tail's render).
45
+ * The wire text is produced once per seed: identical islands share one plan, and a tail rendered
46
+ * twice against the same index (a test, a re-render) plans and serializes once.
47
+ */
48
+ export declare function plan_props_wire(value: unknown, entry: string): PropsWire;
49
+ /** Where a sidecar sits: the document tail (one per fingerprint for the page) or next to its region. */
50
+ export type SidecarPlace = "tail" | "adjacent";
51
+ /**
52
+ * The sidecar `<script>` for one island: keyed by fingerprint when it has one (`data-ogygia-props`
53
+ * for the reconciler; in the TAIL also `id`, for an O(1) `getElementById` lookup by the runtime),
54
+ * unkeyed otherwise; the format attribute names the JSON lane.
55
+ */
56
+ export declare function props_sidecar(fp: string, w: WireText, place?: SidecarPlace, wire_modules?: readonly string[]): string;
@@ -0,0 +1,178 @@
1
+ import { escape_script_text } from "../escape.js";
2
+ import { REF_WIRE_KEY, ref_reducer } 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 { register_fn_kind } from "../fn-transport.js";
7
+ import { SEED_REF_KEY, analyze, json_culprit, plan_seed_refs } from "../seed-refs.js";
8
+ import { stringify } from "devalue";
9
+ // src/server/props-wire.ts
10
+ /**
11
+ * PROPS ON THE WIRE — one plan per island for what its props sidecar says, and how.
12
+ *
13
+ * Two facts about an island's props decide its sidecar, and both come from ONE walk of the props
14
+ * (`analyze`, seed-refs.ts):
15
+ *
16
+ * 1. THE LANE. A payload that is plain JSON — objects, arrays, strings, finite numbers, booleans,
17
+ * null, nothing else — goes out as `JSON.stringify` output (native, ~10× cheaper than devalue's
18
+ * JavaScript flatten + per-character escape, which was the single hottest thing in a profiled
19
+ * CMS page's render) under `data-og-format="json"`, and the runtime reads it with `JSON.parse`.
20
+ * Anything devalue exists for (a Date, a Map, undefined, a bigint, a wired class, a store, a
21
+ * snippet, an og.$ fn) keeps the devalue lane with the usual reducers.
22
+ *
23
+ * 2. THE FINGERPRINT INPUT. `data-og-fp` hashes the CANONICAL text — the lane's text WITHOUT seed
24
+ * references. That makes the fingerprint a function of the props alone: the same props give the
25
+ * same fingerprint whether or not the page seed ships, and whichever island rendered first.
26
+ * (Before, an island rendered ahead of the page's first `$page` reader hashed a full copy and one
27
+ * rendered after it hashed the referenced text — two fingerprints for one island.)
28
+ *
29
+ * The wire text itself is produced LAST, when the document tail renders (server/document-tail.ts):
30
+ * by then the request knows whether the seed ships, so `wire(seed)` serializes relative to it when
31
+ * a props subtree is a seed node (seed-refs.ts) and falls back to the canonical text otherwise.
32
+ * Every island on the page gets references, first island included — the old "islands before the
33
+ * first reader ship copies" limitation is gone with the render-time decision.
34
+ *
35
+ * devalue output is `<`-safe by construction (it writes `<`); the JSON lane goes through
36
+ * `escape_script_text` once. Neither is escaped a second time.
37
+ *
38
+ * Universal module (no Node imports): Region.svelte imports it on both legs; nothing here runs on
39
+ * the client.
40
+ */
41
+ /** The sidecar attribute naming a non-devalue payload format; absent = devalue. */
42
+ const WIRE_FORMAT_ATTR = "data-og-format";
43
+ /** The one non-devalue format: plain JSON, read with `JSON.parse`. */
44
+ const WIRE_FORMAT_JSON = "json";
45
+ /** On a props sidecar: the transportable classes its props carry (tag paths, space-separated) —
46
+ * what the browser loads before it decodes them. */
47
+ const WIRE_CLASSES_ATTR = "data-og-wire";
48
+ /** Island props cross classes, stores, snippets, og.$ fns and resumable deriveds. */
49
+ const PROP_FAMILIES = /* @__PURE__ */ new Set([
50
+ "wire",
51
+ "store",
52
+ "snippet",
53
+ "fn",
54
+ "derived"
55
+ ]);
56
+ let kinds_registered = false;
57
+ function register_prop_kinds() {
58
+ if (kinds_registered) return;
59
+ kinds_registered = true;
60
+ register_wire_kind();
61
+ register_store_kind();
62
+ register_snippet_kind();
63
+ register_fn_kind();
64
+ register_derived_kind();
65
+ }
66
+ /**
67
+ * devalue-serialize an island's props with the prop families' reducers, plus the seed-reference
68
+ * reducer when the caller has one. Throws a teaching error on a non-serializable prop.
69
+ */
70
+ function stringify_props(value, entry, seed_refs = null, wire_out = null) {
71
+ register_prop_kinds();
72
+ try {
73
+ const reducers = {};
74
+ if (seed_refs) reducers[SEED_REF_KEY] = seed_refs;
75
+ const minted = ref_reducer(PROP_FAMILIES);
76
+ reducers[REF_WIRE_KEY] = wire_out ? (v) => {
77
+ const ref = minted(v);
78
+ if (ref && ref.k === "wire" && typeof ref.t === "string") {
79
+ const hash = ref.t.lastIndexOf("#");
80
+ wire_out.add(hash === -1 ? ref.t : ref.t.slice(0, hash));
81
+ }
82
+ return ref;
83
+ } : minted;
84
+ return stringify(value, reducers);
85
+ } catch (e) {
86
+ const detail = e instanceof Error ? e.message : String(e);
87
+ throw new Error(`[ogygia] island "${entry}": a captured prop is not serializable — ${detail}. Captured host values cross the boundary via devalue; functions/Promises cannot, and a class instance only can when the class declares a static [ogygia.wire] codec. Pass a serializable value, add a codec, or move that logic inside the island component.`);
88
+ }
89
+ }
90
+ /**
91
+ * Plan an island's sidecar: lane, canonical text, live snippet entries — and a `wire(seed)` that
92
+ * produces the final text once the request knows about the seed (the document tail's render).
93
+ * The wire text is produced once per seed: identical islands share one plan, and a tail rendered
94
+ * twice against the same index (a test, a re-render) plans and serializes once.
95
+ */
96
+ function plan_props_wire(value, entry) {
97
+ const shape = analyze(value);
98
+ const refs = {
99
+ count: 0,
100
+ keys: []
101
+ };
102
+ const referenced = (seed) => {
103
+ refs.count = 0;
104
+ refs.keys = [];
105
+ if (seed === null || seed.size === 0) return null;
106
+ const plan = plan_seed_refs(seed, value);
107
+ if (plan.count === 0) return null;
108
+ refs.count = plan.count;
109
+ refs.keys = [...plan.keys].sort();
110
+ return {
111
+ text: stringify_props(value, entry, plan.reducer),
112
+ json: false
113
+ };
114
+ };
115
+ let last_seed;
116
+ let last_text;
117
+ const once = (seed, plain) => {
118
+ if (seed === last_seed) return last_text;
119
+ last_seed = seed;
120
+ return last_text = referenced(seed) ?? plain();
121
+ };
122
+ if (shape.json) {
123
+ const canonical = JSON.stringify(value);
124
+ let escaped = null;
125
+ return {
126
+ canonical,
127
+ json: true,
128
+ live_entries: [],
129
+ wire_modules: [],
130
+ wire: (seed) => once(seed, () => escaped ??= {
131
+ text: escape_script_text(canonical),
132
+ json: true
133
+ }),
134
+ refs,
135
+ culprit: () => null
136
+ };
137
+ }
138
+ const wire_modules = /* @__PURE__ */ new Set();
139
+ const canonical = stringify_props(value, entry, null, wire_modules);
140
+ const plain = {
141
+ text: canonical,
142
+ json: false
143
+ };
144
+ let culprit;
145
+ return {
146
+ canonical,
147
+ json: false,
148
+ live_entries: live_entries_in(canonical),
149
+ wire_modules: [...wire_modules],
150
+ wire: (seed) => once(seed, () => plain),
151
+ refs,
152
+ culprit: () => culprit === void 0 ? culprit = json_culprit(value) : culprit
153
+ };
154
+ }
155
+ const LIVE_ENTRY_MARK = "/immutable/og-region.";
156
+ const LIVE_ENTRY_RE = /^\/[^"\s]+\/immutable\/og-region\.[0-9a-f]+\.js$/;
157
+ function live_entries_in(text) {
158
+ const out = [];
159
+ let at = text.indexOf(LIVE_ENTRY_MARK);
160
+ while (at !== -1) {
161
+ const start = text.lastIndexOf("\"", at) + 1;
162
+ const end = text.indexOf("\"", at);
163
+ if (end === -1) break;
164
+ const url = text.slice(start, end);
165
+ if (LIVE_ENTRY_RE.test(url) && !out.includes(url)) out.push(url);
166
+ at = text.indexOf(LIVE_ENTRY_MARK, end);
167
+ }
168
+ return out;
169
+ }
170
+ /**
171
+ * The sidecar `<script>` for one island: keyed by fingerprint when it has one (`data-ogygia-props`
172
+ * for the reconciler; in the TAIL also `id`, for an O(1) `getElementById` lookup by the runtime),
173
+ * unkeyed otherwise; the format attribute names the JSON lane.
174
+ */
175
+ function props_sidecar(fp, w, place = "adjacent", wire_modules = []) {
176
+ return "<script type=\"application/ogygia-props\" data-ogygia-props" + (fp ? `="${fp}"` + (place === "tail" ? ` id="og-props-${fp}"` : "") : "") + (w.json ? ` ${WIRE_FORMAT_ATTR}="${WIRE_FORMAT_JSON}"` : "") + (wire_modules.length ? ` ${WIRE_CLASSES_ATTR}="${wire_modules.join(" ").replaceAll("\"", "&quot;")}"` : "") + ">" + w.text + "<\/script>";
177
+ }
178
+ export { WIRE_CLASSES_ATTR, WIRE_FORMAT_ATTR, WIRE_FORMAT_JSON, plan_props_wire, props_sidecar, stringify_props };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Shared rate-limit bucket for the region endpoint.
3
+ * - Hard-caps map size with LRU eviction (Map insertion order).
4
+ * - Render limiter: charge AFTER a valid MAC (RATE-BURN).
5
+ * - Probe limiter: charge BEFORE HMAC (HMAC-CPU-DOS).
6
+ */
7
+ export type RateBucket = {
8
+ n: number;
9
+ t: number;
10
+ };
11
+ export declare class RateLimiter {
12
+ #private;
13
+ constructor(opts: {
14
+ max: number;
15
+ windowMs: number;
16
+ cap?: number;
17
+ });
18
+ /** @returns true if this IP is over budget (request should 429). */
19
+ limited(ip: string): boolean;
20
+ get size(): number;
21
+ clear(): void;
22
+ }
@@ -0,0 +1,63 @@
1
+ // src/server/rate-limit.ts
2
+ const DEFAULT_CAP = 4096;
3
+ var RateLimiter = class {
4
+ #buckets = /* @__PURE__ */ new Map();
5
+ #cap;
6
+ #max;
7
+ #windowMs;
8
+ #since_prune = 0;
9
+ constructor(opts) {
10
+ this.#max = opts.max;
11
+ this.#windowMs = opts.windowMs;
12
+ this.#cap = Math.max(1, opts.cap ?? DEFAULT_CAP);
13
+ }
14
+ /** Mark `ip` as most-recently used (Map: delete + set → end of iteration order). */
15
+ #touch(ip, b) {
16
+ this.#buckets.delete(ip);
17
+ this.#buckets.set(ip, b);
18
+ }
19
+ #evict_lru() {
20
+ while (this.#buckets.size > this.#cap) {
21
+ const oldest = this.#buckets.keys().next().value;
22
+ if (oldest === void 0) return;
23
+ this.#buckets.delete(oldest);
24
+ }
25
+ }
26
+ #maybe_prune(now) {
27
+ this.#since_prune++;
28
+ if (this.#since_prune >= 64) {
29
+ this.#since_prune = 0;
30
+ for (const [k, v] of this.#buckets) if (now - v.t >= this.#windowMs) this.#buckets.delete(k);
31
+ }
32
+ this.#evict_lru();
33
+ }
34
+ /** @returns true if this IP is over budget (request should 429). */
35
+ limited(ip) {
36
+ if (this.#max <= 0) return false;
37
+ const now = Date.now();
38
+ const b = this.#buckets.get(ip);
39
+ if (!b || now - b.t >= this.#windowMs) {
40
+ this.#buckets.set(ip, {
41
+ n: 1,
42
+ t: now
43
+ });
44
+ this.#maybe_prune(now);
45
+ return false;
46
+ }
47
+ if (b.n >= this.#max) {
48
+ this.#touch(ip, b);
49
+ return true;
50
+ }
51
+ b.n++;
52
+ this.#touch(ip, b);
53
+ return false;
54
+ }
55
+ get size() {
56
+ return this.#buckets.size;
57
+ }
58
+ clear() {
59
+ this.#buckets.clear();
60
+ this.#since_prune = 0;
61
+ }
62
+ };
63
+ export { RateLimiter };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param href the handoff's public href (the `islandCss()` value — the inline lookup key)
3
+ * @param resolved the same href through `asset()` (base / assets applied) — what the tag carries
4
+ */
5
+ export declare function region_css_tag(href: string, resolved: string): string;
@@ -0,0 +1,30 @@
1
+ import { escape_attr } from "../escape.js";
2
+ import { islandCssInline } from "virtual:ogygia/island-deps";
3
+ // src/server/region-css.ts
4
+ /**
5
+ * THE REGION-CSS TAG — one place that turns a region's CSS href into head markup, for every emitter
6
+ * (Region.svelte's island / held dual / content body sheets, the handle's hole-answer sheets).
7
+ *
8
+ * Two shapes, one channel: under Kit's `inlineStyleThreshold` the build kept the asset's text in
9
+ * the island-deps handoff (`islandCssInline`), and the tag is `<style data-ogygia-region-css="href">`
10
+ * — no request before first paint; otherwise it is the `<link rel="stylesheet" … data-ogygia-region-css>`
11
+ * it always was. Both carry the resolved href as the channel's identity: the runtime hoists either
12
+ * from a fetched answer into `<head>` and dedupes them against what the page already has by that
13
+ * value, and the router keys a head `<style>` on it across swaps.
14
+ */
15
+ /**
16
+ * @param href the handoff's public href (the `islandCss()` value — the inline lookup key)
17
+ * @param resolved the same href through `asset()` (base / assets applied) — what the tag carries
18
+ */
19
+ function region_css_tag(href, resolved) {
20
+ const text = islandCssInline(href);
21
+ if (text !== null) return `<style data-ogygia-region-css="${escape_attr(resolved)}">${text}</style>`;
22
+ if (!is_css_href(href)) return `<link rel="modulepreload" href="${escape_attr(resolved)}" data-ogygia-region-css>`;
23
+ return `<link rel="stylesheet" href="${escape_attr(resolved)}" data-ogygia-region-css>`;
24
+ }
25
+ /** `….css` or `….css?…` (string search: one per region CSS tag). */
26
+ function is_css_href(href) {
27
+ const q = href.indexOf("?");
28
+ return (q === -1 ? href : href.slice(0, q)).endsWith(".css");
29
+ }
30
+ export { region_css_tag };
@@ -0,0 +1,35 @@
1
+ import { CapabilityLifetime } from "./capability-lifetime.js";
2
+ import { encode_region_props } from "./region-props.js";
3
+ import { island_fingerprint } from "./fingerprint.js";
4
+ /** A hole's own stylesheet hrefs, by region id — the list its endpoint answer links (hooks.ts
5
+ * `region_css_links`), for a render that inlines the hole in the page instead (Region.svelte). */
6
+ export declare function holeCss(entry: string): string[];
7
+ /** The app's capability lifetime, bound to its settings: every hole it signs (these, and the
8
+ * plugins' `app.capability`, which the handle hands it) expires and renews by this one rule. */
9
+ export declare const app_lifetime: CapabilityLifetime;
10
+ export declare function known_region_fps(): ReadonlySet<string>;
11
+ /**
12
+ * Shared minting core for signed region capabilities — the ONE source of truth for the
13
+ * `/__ogygia__?id&props&exp&sig` URL, its MAC message, TTL policy, and session sealing. Both held regions
14
+ * (via {@link makeRegionEndpoint}) and server islands (Region.svelte's server branch) sign through this,
15
+ * each deriving/validating its own `payload` first (held regions degrade to `''` on failure, server
16
+ * islands throw). Given a valid encoded `payload`, the emitted URL/MAC/exp is identical to both.
17
+ *
18
+ * @param entry region id (server-manifest key baked into the MAC)
19
+ * @param payload b64url props blob (already encoded + size-checked by the caller)
20
+ * @param ttl response cache max-age in **seconds** (`0` = no-store, the default). Signed into the MAC
21
+ * and echoed as a `ttl` query param so the handle sets `Cache-Control` from it — a harvested URL
22
+ * can't be re-pointed at a longer browser cache.
23
+ */
24
+ export declare function mint_region_capability(entry: string, payload: string, ttl?: number): string;
25
+ /**
26
+ * Server-island mint: encode `props` (devalue + wire codec), enforce the size cap (THROW — a server
27
+ * island with oversized/non-serializable props is an author bug the handle would reject anyway), and
28
+ * sign. The one place `Region.svelte`'s `__mode: 'server'` branch signs its hole; routed through the
29
+ * `virtual:ogygia/region-endpoint` virtual so the client build stubs it to `''` (server islands never
30
+ * mint on the client — the runtime fetches the endpoint). Mirrors the old `ServerIsland.svelte`.
31
+ */
32
+ export declare function mintServerIsland(entry: string, props: Record<string, unknown>, ttl?: number): string;
33
+ /** HMAC-signed `<endpoint>?id&props&exp&sig` (`handle({ endpoint })`, default `/__ogygia__`) for re-rendering `entry` with `props`. */
34
+ export declare function makeRegionEndpoint(entry: string, props?: Record<string, unknown>): string;
35
+ export { encode_region_props, island_fingerprint as islandFingerprint };
@@ -0,0 +1,142 @@
1
+ import { signing_key } from "./signing-key.js";
2
+ import { MAX_REGION_PROPS_LEN, islands_endpoint } from "./endpoint.js";
3
+ import { capability_lifetime } from "./capability-lifetime.js";
4
+ import { encode_region_props, ensure_prop_kinds } from "./region-props.js";
5
+ import { record_server_event } from "../events/server-registry.js";
6
+ import { B64Url } from "./payload.js";
7
+ import { REF_WIRE_KEY, ref_reducer } from "../ref.js";
8
+ import { island_fingerprint } from "./fingerprint.js";
9
+ import { stringify } from "devalue";
10
+ import { getRequestEvent } from "virtual:ogygia/request-event";
11
+ import { islandCss } from "virtual:ogygia/island-deps";
12
+ import { island_render, island_url } from "virtual:ogygia/server-manifest";
13
+ import { region_mac_message, sign } from "virtual:ogygia/sign";
14
+ import { building } from "$app/env";
15
+ import { sessionCookie } from "virtual:ogygia/session-cookie";
16
+ import { resolve } from "$app/paths";
17
+ import { regionTtl, renewWindow } from "virtual:ogygia/region-ttl";
18
+ // src/server/region-endpoint.ts
19
+ /**
20
+ * Build a signed region capability URL (same shape as server-island holes).
21
+ * Used by Region's lake branch for `render: 'live'`. Client build gets a stub that returns ''.
22
+ */
23
+ const DEVTOOLS = typeof __OGYGIA_DEVTOOLS__ !== "undefined" ? __OGYGIA_DEVTOOLS__ : false;
24
+ /** A hole's own stylesheet hrefs, by region id — the list its endpoint answer links (hooks.ts
25
+ * `region_css_links`), for a render that inlines the hole in the page instead (Region.svelte). */
26
+ function holeCss(entry) {
27
+ const url = island_url[entry];
28
+ return url ? islandCss(url) : [];
29
+ }
30
+ /** Same families as encode_region_props — one seam law for island props. */
31
+ const PROP_FAMILIES = /* @__PURE__ */ new Set([
32
+ "wire",
33
+ "store",
34
+ "snippet",
35
+ "fn",
36
+ "derived"
37
+ ]);
38
+ /** The request being rendered (null off-request: prerender, a test). */
39
+ function current_request() {
40
+ try {
41
+ return getRequestEvent().request;
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+ /** The app's capability lifetime, bound to its settings: every hole it signs (these, and the
47
+ * plugins' `app.capability`, which the handle hands it) expires and renews by this one rule. */
48
+ const app_lifetime = capability_lifetime({
49
+ building,
50
+ region_ttl: regionTtl,
51
+ renew_window: renewWindow,
52
+ request: current_request
53
+ });
54
+ /** Session sealed into the MAC when `ogygia({ sessionCookie })` is set; empty at prerender. */
55
+ function region_session() {
56
+ if (!sessionCookie) return "";
57
+ try {
58
+ return getRequestEvent().cookies.get(sessionCookie) ?? "";
59
+ } catch {
60
+ return "";
61
+ }
62
+ }
63
+ /**
64
+ * SERVER-DELTA NAV (D3) — the set of region fingerprints the CLIENT already has live, sent on an
65
+ * SPA nav via `x-ogygia-known`. Region.svelte consults this to SKIP re-rendering an island the
66
+ * client is keeping. Honored ONLY on an SPA nav (`x-ogygia-spa`); a full page load has no header →
67
+ * empty set → everything renders. Memoized per request-event (parsed once). Client-stubbed to empty.
68
+ * A missing/oversized header is always the SAFE full render — this is a pure optimization signal.
69
+ */
70
+ const KNOWN_FPS = /* @__PURE__ */ new WeakMap();
71
+ const EMPTY_FPS = /* @__PURE__ */ new Set();
72
+ function known_region_fps() {
73
+ let event;
74
+ try {
75
+ event = getRequestEvent();
76
+ } catch {
77
+ return EMPTY_FPS;
78
+ }
79
+ const cached = KNOWN_FPS.get(event);
80
+ if (cached !== void 0) return cached;
81
+ let set;
82
+ try {
83
+ const known = event.request.headers.get("x-ogygia-spa") ? event.request.headers.get("x-ogygia-known") : null;
84
+ set = known ? new Set(known.split(",")) : /* @__PURE__ */ new Set();
85
+ } catch {
86
+ set = /* @__PURE__ */ new Set();
87
+ }
88
+ KNOWN_FPS.set(event, set);
89
+ return set;
90
+ }
91
+ /**
92
+ * Shared minting core for signed region capabilities — the ONE source of truth for the
93
+ * `/__ogygia__?id&props&exp&sig` URL, its MAC message, TTL policy, and session sealing. Both held regions
94
+ * (via {@link makeRegionEndpoint}) and server islands (Region.svelte's server branch) sign through this,
95
+ * each deriving/validating its own `payload` first (held regions degrade to `''` on failure, server
96
+ * islands throw). Given a valid encoded `payload`, the emitted URL/MAC/exp is identical to both.
97
+ *
98
+ * @param entry region id (server-manifest key baked into the MAC)
99
+ * @param payload b64url props blob (already encoded + size-checked by the caller)
100
+ * @param ttl response cache max-age in **seconds** (`0` = no-store, the default). Signed into the MAC
101
+ * and echoed as a `ttl` query param so the handle sets `Cache-Control` from it — a harvested URL
102
+ * can't be re-pointed at a longer browser cache.
103
+ */
104
+ function mint_region_capability(entry, payload, ttl = 0) {
105
+ const session = region_session();
106
+ const exp = app_lifetime.mint_expiry(session);
107
+ const key = signing_key();
108
+ const ttl_field = ttl > 0 ? String(Math.floor(ttl)) : "";
109
+ const render = island_render[entry] ?? "";
110
+ const sig = sign(key.secret, region_mac_message(entry, exp, payload, session, ttl_field, render));
111
+ const ttl_param = ttl_field ? `&ttl=${ttl_field}` : "";
112
+ if (DEVTOOLS) record_server_event({
113
+ domain: "server",
114
+ name: "server.capability.minted",
115
+ id: entry,
116
+ ttl
117
+ });
118
+ return `${resolve(islands_endpoint())}?id=${encodeURIComponent(entry)}${render ? `&r=${render}` : ""}&props=${payload}&exp=${exp}${ttl_param}&sig=${sig}&k=${key.fp}`;
119
+ }
120
+ /**
121
+ * Server-island mint: encode `props` (devalue + wire codec), enforce the size cap (THROW — a server
122
+ * island with oversized/non-serializable props is an author bug the handle would reject anyway), and
123
+ * sign. The one place `Region.svelte`'s `__mode: 'server'` branch signs its hole; routed through the
124
+ * `virtual:ogygia/region-endpoint` virtual so the client build stubs it to `''` (server islands never
125
+ * mint on the client — the runtime fetches the endpoint). Mirrors the old `ServerIsland.svelte`.
126
+ */
127
+ function mintServerIsland(entry, props, ttl = 0) {
128
+ ensure_prop_kinds();
129
+ const payload = B64Url.encode(stringify(props, { [REF_WIRE_KEY]: ref_reducer(PROP_FAMILIES) }));
130
+ if (payload.length > 8192) throw new Error(`[ogygia] server island "${entry}": props payload is ${payload.length} b64 chars (max ${MAX_REGION_PROPS_LEN}). Shrink what you pass into the deferred region — the handle would reject this capability anyway.`);
131
+ return mint_region_capability(entry, payload, ttl);
132
+ }
133
+ /** HMAC-signed `<endpoint>?id&props&exp&sig` (`handle({ endpoint })`, default `/__ogygia__`) for re-rendering `entry` with `props`. */
134
+ function makeRegionEndpoint(entry, props = {}) {
135
+ const payload = encode_region_props(props);
136
+ if (payload == null) {
137
+ console.warn(`[ogygia] render:'live' region ${entry} has props that cannot cross the wire (non-serializable or >${MAX_REGION_PROPS_LEN} b64 chars) — no revalidate endpoint minted (behaves like a static lake).`);
138
+ return "";
139
+ }
140
+ return mint_region_capability(entry, payload);
141
+ }
142
+ export { app_lifetime, encode_region_props, holeCss, island_fingerprint as islandFingerprint, known_region_fps, makeRegionEndpoint, mintServerIsland, mint_region_capability };
@@ -0,0 +1,6 @@
1
+ /** Ensure the island-prop kinds are registered (called per encode; Map.has-cheap). */
2
+ export declare function ensure_prop_kinds(): void;
3
+ /**
4
+ * @returns b64url payload, or null when props cannot cross the wire (non-devalue or oversized).
5
+ */
6
+ export declare function encode_region_props(props: Record<string, unknown>): string | null;
@@ -0,0 +1,44 @@
1
+ import { B64Url } from "./payload.js";
2
+ import "./endpoint.js";
3
+ import { REF_WIRE_KEY, ref_reducer } from "../ref.js";
4
+ import { register_wire_kind } from "../live-transport.js";
5
+ import { register_derived_kind, register_store_kind } from "../store-transport.js";
6
+ import { register_snippet_kind } from "../region-snippet.js";
7
+ import { register_fn_kind } from "../fn-transport.js";
8
+ import { stringify } from "devalue";
9
+ // src/server/region-props.ts
10
+ /**
11
+ * Encode region capability props (devalue → b64url) with the same size bound the handle enforces.
12
+ * No virtual imports — safe to unit-test and share between mint paths.
13
+ */
14
+ /** Ensure the island-prop kinds are registered (called per encode; Map.has-cheap). */
15
+ function ensure_prop_kinds() {
16
+ register_wire_kind();
17
+ register_store_kind();
18
+ register_snippet_kind();
19
+ register_fn_kind();
20
+ register_derived_kind();
21
+ }
22
+ /** Island props carry classes, stores, snippets, og.$ fns and resumable deriveds. */
23
+ const PROP_FAMILIES = /* @__PURE__ */ new Set([
24
+ "wire",
25
+ "store",
26
+ "snippet",
27
+ "fn",
28
+ "derived"
29
+ ]);
30
+ /**
31
+ * @returns b64url payload, or null when props cannot cross the wire (non-devalue or oversized).
32
+ */
33
+ function encode_region_props(props) {
34
+ ensure_prop_kinds();
35
+ let payload;
36
+ try {
37
+ payload = B64Url.encode(stringify(props, { [REF_WIRE_KEY]: ref_reducer(PROP_FAMILIES) }));
38
+ } catch {
39
+ return null;
40
+ }
41
+ if (payload.length > 8192) return null;
42
+ return payload;
43
+ }
44
+ export { encode_region_props, ensure_prop_kinds };
@@ -0,0 +1,50 @@
1
+ /**
2
+ * REMOTE SEED ONLY WHEN REACHABLE — the handle's per-remote decision when it builds the
3
+ * `application/ogygia-remote` seed: does any region rendered on this page have client code that
4
+ * can call this remote? The seed exists so a hydrating island that re-runs the same query resolves
5
+ * it from the document (zero-flash, no re-fetch). A remote no island on the page imports — a lake
6
+ * or a page script awaiting a query for its own server render — has no such reader, and its
7
+ * result is pure download weight (a CMS footer entry: 12.5 KB, measured).
8
+ *
9
+ * `wanted` is the union of every rendered region's `islandRemotes(entry)` (Region.svelte →
10
+ * page-seed-registry → the request bag): Kit id-hashes, the prefix of a remote's `internals.id`
11
+ * (`${hash}/${name}`). `null` = some region answered fail-open ("may call anything": a promise `of`,
12
+ * an entry the build handoff does not know, dev) → every remote seeds, exactly as before the gate.
13
+ * Pure, so it is unit-tested on its own.
14
+ */
15
+ export declare function remote_seed_wanted(remote_id: string, wanted: ReadonlySet<string> | null): boolean;
16
+ /** Kit's `RequestState.remote.implicit` entry: the remote's internals + its per-payload results. */
17
+ export interface ImplicitRemote {
18
+ id?: string;
19
+ type: string;
20
+ }
21
+ export type ImplicitMap = Iterable<[ImplicitRemote, Record<string, () => unknown>]>;
22
+ export type SeedBuckets = Record<"q" | "p" | "l" | "f", Record<string, {
23
+ v: unknown;
24
+ }>>;
25
+ /**
26
+ * Mirror Kit's OWN seed bucketing (server/remote.js) over the side-channel — Kit only serializes
27
+ * remote data inline when csr===true, so on csr=false pages the handle does it here. Buckets every
28
+ * implicit remote by type: q(query) / p(prerender) / l(query.live) / f(form). Seeding PRERENDER
29
+ * remotes (not only queries) is the fix for the async-island FOUC: a prerender remote awaited inside
30
+ * an island otherwise re-fetches on hydrate, so the component re-renders and Svelte RE-MOUNTS the
31
+ * subtree — a frame of unstyled DOM. With the seed in `prerender_responses`, the client resolves it
32
+ * synchronously and never re-fetches. Keys use `create_remote_key`, exactly like Kit's client.
33
+ *
34
+ * Skips, in order: a PRIVATE remote (no id — must never be serialized), a remote NO REGION'S
35
+ * CLIENT CAN CALL (`wanted`, above), an ERRORED or still-PENDING result (the client fetches it
36
+ * itself; an entry without `v` would hydrate as `undefined`), and a value carrying a BAKED region
37
+ * (`skip_value`: SSR HTML in the ticket — a page body from a `doc`-style remote is a page-sized
38
+ * RENDER the page already rendered; seeding it ships the body twice, ~130 KB/page measured).
39
+ *
40
+ * Pure over what it is handed (the implicit map, the request's memo of results, the two
41
+ * predicates); the handle serializes what comes back. Unit-tested across every permutation.
42
+ */
43
+ export declare function collect_remote_seed(implicit: ImplicitMap, wanted: ReadonlySet<string> | null, opts: {
44
+ /** Kit's per-request memo of results already awaited (`state.remote.data`); a miss re-invokes. */
45
+ memo?: (internals: ImplicitRemote) => Record<string, unknown> | undefined;
46
+ /** A resolved value that must NOT seed (a baked region). */
47
+ skip_value?: (v: unknown) => boolean;
48
+ /** Kit's `create_remote_key(id, payload)`. */
49
+ key: (id: string, payload: string) => string;
50
+ }): Promise<SeedBuckets>;