@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,113 @@
1
+ import { SeedIndex } from "../seed-refs.js";
2
+ import { WireText } from "./props-wire.js";
3
+ import { HoleStat, IslandInteractivity, IslandStat } from "./request-stats.js";
4
+ /** What the tail needs of a props plan (server/props-wire.ts `PropsWire`, or a test's stand-in). */
5
+ export interface SidecarWire {
6
+ wire(seed: SeedIndex | null): WireText;
7
+ readonly json?: boolean;
8
+ readonly canonical?: string;
9
+ readonly refs?: {
10
+ count: number;
11
+ keys: readonly string[];
12
+ };
13
+ culprit?(): string | null;
14
+ /** the transportable classes the props carry (stamped on the sidecar for the browser) */
15
+ readonly wire_modules?: readonly string[];
16
+ }
17
+ /** The island facts a region hands over with its plan, for the profiler's Islands table. */
18
+ /** A short, safe preview of a hole's props for the profiler (`{"forProduct":"P1"}`), so two holes
19
+ * of one component read apart; empty for no props, truncated past 80 chars. */
20
+ export declare function props_preview(props: unknown, max?: number): string;
21
+ export interface IslandMeta {
22
+ entry: string;
23
+ /** the component's SSR function name (Svelte names it after the file); '' when unknown */
24
+ name?: string;
25
+ module_url: string;
26
+ wake: string;
27
+ interactivity?: IslandInteractivity | null;
28
+ }
29
+ /**
30
+ * THE module-preload hint for one island chunk. EVERY hint is `fetchpriority="low"`: a hint's job
31
+ * is discovery (no parse-then-import waterfall), not priority — nothing an island downloads is
32
+ * needed for first paint, the server painted the content — so island code must never outrank the
33
+ * CSS and the LCP image (Region.svelte has the measured story). Regions hand the tail hrefs, not
34
+ * tags: one string per hint, built once here, never parsed back out of markup.
35
+ */
36
+ export declare function modulepreload_tag(href: string): string;
37
+ /**
38
+ * The runtime bootstrap: its module script, then a `modulepreload` for each of its static imports
39
+ * (the build's handoff — the few chunks the runtime shares with the rest of the app, e.g. Vite's
40
+ * preload helper and the modules Kit's client transport also uses). The browser only discovers a
41
+ * module's imports after downloading and parsing it; hinted here, they download ALONGSIDE the
42
+ * runtime instead of one round trip after it. Normal priority — the runtime cannot run without
43
+ * them. `data-ogygia-runtime-dep` keeps them attached to the script when the handle moves it
44
+ * (head-presence.ts `runtime_first`).
45
+ */
46
+ export declare function runtime_bootstrap_tags(src: string, deps: readonly string[]): string;
47
+ /**
48
+ * The island graph (island-graph.ts) as one inert JSON script: entry → the chunks its code needs.
49
+ * The runtime turns an entry's list into modulepreload links when that island wakes. Empty map →
50
+ * no script.
51
+ */
52
+ export declare function island_graph_script(graph: ReadonlyMap<string, readonly string[]>, locations?: ReadonlyMap<string, string> | null): string;
53
+ /** What the server minted for one deferred hole on a Kit-hydrated document (see `hole()`). */
54
+ export type HoleRecord = {
55
+ /** The signed capability URL the hole's `endpoint` attribute carries. */
56
+ endpoint: string;
57
+ /** The adjacent props sidecar HTML of a hydrating hole, or `''` for a static one. */
58
+ sidecar: string;
59
+ };
60
+ export declare class DocumentTail {
61
+ #private;
62
+ /** Add a region's module-preload hrefs; each href is hinted once (first wins). With `fp`, the
63
+ * hrefs are also remembered as that island's JS closure. */
64
+ hints(hrefs: readonly string[], fp?: string): void;
65
+ /** The list already recorded for an entry, if any — a second instance of an island reuses it. */
66
+ graph_of(entry: string): readonly string[] | undefined;
67
+ /** Record the chunks an island entry's code needs (the island graph — data, not hints: the
68
+ * runtime preloads them when the island wakes). One list per entry — its identity — (first wins).
69
+ * With `fp`, the list is also remembered as that island's JS closure for the profiler, led by the
70
+ * file the island actually loads: `src`, its location (the identity when it has none). */
71
+ graph(entry: string, hrefs: readonly string[], fp?: string, src?: string): void;
72
+ /** Record where an entry no element carries is served from (the graph script's `s`). */
73
+ locate(identity: string, src: string): void;
74
+ /** Register an island's props sidecar under its fingerprint; identical islands share one (the
75
+ * count still says how many). `meta` is what the profiler's Islands table shows. */
76
+ props(fp: string, wire: SidecarWire, meta?: IslandMeta | null): void;
77
+ /** Note a deferred hole the page rendered (every document, not only Kit-hydrated ones): its
78
+ * schedule and cache policy, for the profiler's hole economics. */
79
+ note_hole(id: string, when: string, hydrate: string | null, ttl: number, name?: string, props?: unknown, copy?: string): void;
80
+ /** The holes noted on this page. */
81
+ hole_rows(): HoleStat[];
82
+ /** The per-island facts of the last `render()` — `null` before it ran. */
83
+ island_rows(): IslandStat[] | null;
84
+ /**
85
+ * Record a deferred hole's server-minted facts under its identity (`data-og-hole`), for a
86
+ * KIT-HYDRATED document only. Kit can give up hydrating such a document (a component threw, the
87
+ * markup mismatched): Svelte clears Kit's root and mounts it fresh, and every hole is rendered
88
+ * again by the client leg — with no address, since only the server can mint one. The tail sits
89
+ * OUTSIDE Kit's root, so this record survives that rebuild, and the runtime hands each rebuilt
90
+ * hole its address (and a hydrating hole its props sidecar) back by identity — never by
91
+ * position. Identical holes (same id + props → same identity) share one record.
92
+ */
93
+ hole(identity: string, endpoint: string, sidecar: string): void;
94
+ get empty(): boolean;
95
+ /** Hint count + graph entry count + sidecar count + hole-record count, for tests and devtools. */
96
+ get size(): {
97
+ hints: number;
98
+ graph: number;
99
+ props: number;
100
+ holes: number;
101
+ };
102
+ /** The tail's HTML: hints, the island graph, then props (each rendered now, against `seed`), then
103
+ * the holes record (one script, JSON, `<`-escaped). Empty string when nothing was recorded. With
104
+ * `detail`, the per-island rows (bytes, lane, references, the devalue culprit) are kept for
105
+ * the profiler — a little extra work, only while it records. */
106
+ render(seed?: SeedIndex | null, detail?: boolean): string;
107
+ }
108
+ type TailReader = () => DocumentTail | null;
109
+ /** Server (`hooks.ts`) installs a request-scoped reader; `null` uninstalls. */
110
+ export declare function set_tail_reader(fn: TailReader | null): void;
111
+ /** The current request's tail, or `null` when this render has none (client, endpoint, test). */
112
+ export declare function document_tail(): DocumentTail | null;
113
+ export {};
@@ -0,0 +1,208 @@
1
+ import { escape_script_text } from "../escape.js";
2
+ import { HOLES_SCRIPT_TYPE } from "../holes-record.js";
3
+ import { ISLAND_GRAPH_ATTR, encode_island_graph } from "../island-graph.js";
4
+ import { props_sidecar } from "./props-wire.js";
5
+ // src/server/document-tail.ts
6
+ /** The island facts a region hands over with its plan, for the profiler's Islands table. */
7
+ /** A short, safe preview of a hole's props for the profiler (`{"forProduct":"P1"}`), so two holes
8
+ * of one component read apart; empty for no props, truncated past 80 chars. */
9
+ function props_preview(props, max = 80) {
10
+ if (!props || typeof props !== "object") return "";
11
+ try {
12
+ const s = JSON.stringify(props, (_k, v) => typeof v === "bigint" ? String(v) : v);
13
+ if (!s || s === "{}" || s === "[]") return "";
14
+ return s.length > max ? s.slice(0, max - 1) + "…" : s;
15
+ } catch {
16
+ return "";
17
+ }
18
+ }
19
+ /**
20
+ * THE module-preload hint for one island chunk. EVERY hint is `fetchpriority="low"`: a hint's job
21
+ * is discovery (no parse-then-import waterfall), not priority — nothing an island downloads is
22
+ * needed for first paint, the server painted the content — so island code must never outrank the
23
+ * CSS and the LCP image (Region.svelte has the measured story). Regions hand the tail hrefs, not
24
+ * tags: one string per hint, built once here, never parsed back out of markup.
25
+ */
26
+ function modulepreload_tag(href) {
27
+ return "<link rel=\"modulepreload\" href=\"" + href + "\" fetchpriority=\"low\">";
28
+ }
29
+ /**
30
+ * The runtime bootstrap: its module script, then a `modulepreload` for each of its static imports
31
+ * (the build's handoff — the few chunks the runtime shares with the rest of the app, e.g. Vite's
32
+ * preload helper and the modules Kit's client transport also uses). The browser only discovers a
33
+ * module's imports after downloading and parsing it; hinted here, they download ALONGSIDE the
34
+ * runtime instead of one round trip after it. Normal priority — the runtime cannot run without
35
+ * them. `data-ogygia-runtime-dep` keeps them attached to the script when the handle moves it
36
+ * (head-presence.ts `runtime_first`).
37
+ */
38
+ function runtime_bootstrap_tags(src, deps) {
39
+ let html = "<script type=\"module\" data-ogygia-runtime src=\"" + src + "\"><\/script>";
40
+ for (const dep of deps) html += "<link rel=\"modulepreload\" href=\"" + dep + "\" data-ogygia-runtime-dep>";
41
+ return html;
42
+ }
43
+ /**
44
+ * The island graph (island-graph.ts) as one inert JSON script: entry → the chunks its code needs.
45
+ * The runtime turns an entry's list into modulepreload links when that island wakes. Empty map →
46
+ * no script.
47
+ */
48
+ function island_graph_script(graph, locations) {
49
+ if (graph.size === 0 && !locations?.size) return "";
50
+ return "<script type=\"application/json\" " + ISLAND_GRAPH_ATTR + ">" + escape_script_text(encode_island_graph(graph, locations ?? void 0)) + "<\/script>";
51
+ }
52
+ /** The holes record (`hole()`), read by runtime/hole-facts.ts. */
53
+ const HOLES_SCRIPT_OPEN = `<script type="${HOLES_SCRIPT_TYPE}" data-ogygia-holes>`;
54
+ const HOLES_SCRIPT_CLOSE = "<\/script>";
55
+ var DocumentTail = class {
56
+ #hints = /* @__PURE__ */ new Set();
57
+ #graph = /* @__PURE__ */ new Map();
58
+ /** entry identity → location, for entries no element carries (a portable snippet's live entry) */
59
+ #locations = /* @__PURE__ */ new Map();
60
+ #props = /* @__PURE__ */ new Map();
61
+ #holes = /* @__PURE__ */ new Map();
62
+ #hole_notes = /* @__PURE__ */ new Map();
63
+ /** per-fingerprint facts of the last `render()` (the profiler's Islands table) */
64
+ #island_rows = null;
65
+ /** Add a region's module-preload hrefs; each href is hinted once (first wins). With `fp`, the
66
+ * hrefs are also remembered as that island's JS closure. */
67
+ hints(hrefs, fp) {
68
+ for (const href of hrefs) this.#hints.add(href);
69
+ if (fp) {
70
+ const s = this.#props.get(fp);
71
+ if (s && s.hints.length === 0) s.hints = [...hrefs];
72
+ }
73
+ }
74
+ /** The list already recorded for an entry, if any — a second instance of an island reuses it. */
75
+ graph_of(entry) {
76
+ return this.#graph.get(entry);
77
+ }
78
+ /** Record the chunks an island entry's code needs (the island graph — data, not hints: the
79
+ * runtime preloads them when the island wakes). One list per entry — its identity — (first wins).
80
+ * With `fp`, the list is also remembered as that island's JS closure for the profiler, led by the
81
+ * file the island actually loads: `src`, its location (the identity when it has none). */
82
+ graph(entry, hrefs, fp, src) {
83
+ if (!this.#graph.has(entry)) this.#graph.set(entry, hrefs);
84
+ if (fp) {
85
+ const s = this.#props.get(fp);
86
+ if (s && s.hints.length === 0) s.hints = [src || entry, ...hrefs];
87
+ }
88
+ }
89
+ /** Record where an entry no element carries is served from (the graph script's `s`). */
90
+ locate(identity, src) {
91
+ if (!this.#locations.has(identity)) this.#locations.set(identity, src);
92
+ }
93
+ /** Register an island's props sidecar under its fingerprint; identical islands share one (the
94
+ * count still says how many). `meta` is what the profiler's Islands table shows. */
95
+ props(fp, wire, meta = null) {
96
+ const have = this.#props.get(fp);
97
+ if (have) have.count++;
98
+ else this.#props.set(fp, {
99
+ wire,
100
+ meta,
101
+ count: 1,
102
+ hints: []
103
+ });
104
+ }
105
+ /** Note a deferred hole the page rendered (every document, not only Kit-hydrated ones): its
106
+ * schedule and cache policy, for the profiler's hole economics. */
107
+ note_hole(id, when, hydrate, ttl, name = "", props = void 0, copy = "") {
108
+ const key = `${id}\0${when}\0${hydrate ?? ""}\0${ttl}`;
109
+ let have = this.#hole_notes.get(key);
110
+ if (have) have.count++;
111
+ else this.#hole_notes.set(key, have = {
112
+ id,
113
+ name,
114
+ props: props_preview(props),
115
+ when,
116
+ hydrate,
117
+ ttl,
118
+ count: 1
119
+ });
120
+ if (copy && (have.copies?.length ?? 0) < 12 && !have.copies?.some((c) => c.p === copy)) (have.copies ??= []).push({
121
+ p: copy,
122
+ props: have.count === 1 ? have.props : props_preview(props)
123
+ });
124
+ }
125
+ /** The holes noted on this page. */
126
+ hole_rows() {
127
+ return [...this.#hole_notes.values()];
128
+ }
129
+ /** The per-island facts of the last `render()` — `null` before it ran. */
130
+ island_rows() {
131
+ return this.#island_rows;
132
+ }
133
+ /**
134
+ * Record a deferred hole's server-minted facts under its identity (`data-og-hole`), for a
135
+ * KIT-HYDRATED document only. Kit can give up hydrating such a document (a component threw, the
136
+ * markup mismatched): Svelte clears Kit's root and mounts it fresh, and every hole is rendered
137
+ * again by the client leg — with no address, since only the server can mint one. The tail sits
138
+ * OUTSIDE Kit's root, so this record survives that rebuild, and the runtime hands each rebuilt
139
+ * hole its address (and a hydrating hole its props sidecar) back by identity — never by
140
+ * position. Identical holes (same id + props → same identity) share one record.
141
+ */
142
+ hole(identity, endpoint, sidecar) {
143
+ if (identity && endpoint && !this.#holes.has(identity)) this.#holes.set(identity, {
144
+ endpoint,
145
+ sidecar
146
+ });
147
+ }
148
+ get empty() {
149
+ return this.#hints.size === 0 && this.#graph.size === 0 && this.#locations.size === 0 && this.#props.size === 0 && this.#holes.size === 0;
150
+ }
151
+ /** Hint count + graph entry count + sidecar count + hole-record count, for tests and devtools. */
152
+ get size() {
153
+ return {
154
+ hints: this.#hints.size,
155
+ graph: this.#graph.size,
156
+ props: this.#props.size,
157
+ holes: this.#holes.size
158
+ };
159
+ }
160
+ /** The tail's HTML: hints, the island graph, then props (each rendered now, against `seed`), then
161
+ * the holes record (one script, JSON, `<`-escaped). Empty string when nothing was recorded. With
162
+ * `detail`, the per-island rows (bytes, lane, references, the devalue culprit) are kept for
163
+ * the profiler — a little extra work, only while it records. */
164
+ render(seed = null, detail = false) {
165
+ let out = "";
166
+ for (const href of this.#hints) out += modulepreload_tag(href);
167
+ out += island_graph_script(this.#graph, this.#locations);
168
+ const rows = detail ? [] : null;
169
+ for (const [fp, s] of this.#props) {
170
+ const w = s.wire.wire(seed);
171
+ out += props_sidecar(fp, w, "tail", s.wire.wire_modules);
172
+ if (rows) rows.push({
173
+ fp,
174
+ entry: s.meta?.entry ?? "",
175
+ name: s.meta?.name ?? "",
176
+ module_url: s.meta?.module_url ?? "",
177
+ wake: s.meta?.wake ?? "",
178
+ props_bytes: w.text.length,
179
+ canonical_bytes: s.wire.canonical?.length ?? w.text.length,
180
+ ...s.wire.canonical !== void 0 && s.wire.canonical.length <= 4096 ? { canonical: s.wire.canonical } : {},
181
+ json: w.json,
182
+ culprit: w.json ? null : s.wire.culprit?.() ?? null,
183
+ refs: s.wire.refs?.count ?? 0,
184
+ ref_keys: [...s.wire.refs?.keys ?? []],
185
+ hints: s.hints,
186
+ interactivity: s.meta?.interactivity ?? null,
187
+ count: s.count
188
+ });
189
+ }
190
+ this.#island_rows = rows;
191
+ if (this.#holes.size) {
192
+ const record = {};
193
+ for (const [identity, facts] of this.#holes) record[identity] = facts;
194
+ out += HOLES_SCRIPT_OPEN + escape_script_text(JSON.stringify(record)) + HOLES_SCRIPT_CLOSE;
195
+ }
196
+ return out;
197
+ }
198
+ };
199
+ let reader = null;
200
+ /** Server (`hooks.ts`) installs a request-scoped reader; `null` uninstalls. */
201
+ function set_tail_reader(fn) {
202
+ reader = fn;
203
+ }
204
+ /** The current request's tail, or `null` when this render has none (client, endpoint, test). */
205
+ function document_tail() {
206
+ return reader ? reader() : null;
207
+ }
208
+ export { DocumentTail, document_tail, island_graph_script, modulepreload_tag, props_preview, runtime_bootstrap_tags, set_tail_reader };
@@ -0,0 +1,51 @@
1
+ export declare const DEFAULT_ISLANDS_ENDPOINT = "/__ogygia__";
2
+ /** The islands endpoint path (without the app's base: matched by suffix, minted through `resolve`). */
3
+ export declare function islands_endpoint(): string;
4
+ /** Set by the handle (`handle({ endpoint })`); the default when none is given. */
5
+ export declare function configure_islands_endpoint(path: string | undefined): void;
6
+ /** Max b64url props blob accepted by the region handle (and refused at mint time). */
7
+ export declare const MAX_REGION_PROPS_LEN = 8192;
8
+ /**
9
+ * Default capability TTL (seconds) for DYNAMIC pages. Shorter than a day so harvested URLs age
10
+ * out; override via `ogygia({ ttl })`.
11
+ */
12
+ export declare const DEFAULT_REGION_TTL_SEC = 3600;
13
+ /**
14
+ * Capability TTL for PRERENDERED pages (10 years — effectively the life of the deploy). A static
15
+ * file lives on the CDN indefinitely, so an aging capability would strand every hole on it after
16
+ * `ttl` (real PPR would silently die in an hour). Safe: the capability's props are already
17
+ * baked into the public static HTML, and the mint seals an EMPTY session at prerender — signing
18
+ * that same public tuple for longer reveals nothing new. Redeploy survival additionally needs a
19
+ * stable `OGYGIA_SECRET` (the default per-build key rotates; ServerIsland warns at build).
20
+ */
21
+ export declare const PRERENDER_REGION_TTL_SEC: number;
22
+ /**
23
+ * WHEN a capability minted now expires — aligned to a window, not `now + ttl`.
24
+ *
25
+ * Every render of the same hole (same id, props, session) in the same window mints the SAME
26
+ * `exp`, hence the SAME signature and URL: the hole's HTML is byte-identical across requests. That
27
+ * is what lets anything keyed on the page's bytes hit — a host app's post-render component cache,
28
+ * a CDN or postrender store comparing documents, an ETag. With `now + ttl` every request minted a new
29
+ * URL and a header block wrapping five holes was re-processed on every request (measured: seconds
30
+ * of server time per page on a Lambda-class host).
31
+ *
32
+ * The window is half the TTL: `exp` is the end of the window after the current one, so a
33
+ * capability is always valid for at least `ttl / 2` and at most `ttl` (harvested URLs still age
34
+ * out on the same order); consecutive windows overlap by construction, so a page rendered at the
35
+ * end of a window and fetched a moment later still verifies.
36
+ */
37
+ export declare function capability_expiry(now_sec: number, ttl_sec: number): number;
38
+ /** Region ids are always 12 lowercase hex chars from the transform. */
39
+ export declare const REGION_ID_RE: RegExp;
40
+ /**
41
+ * A hole's optional cache `ttl` (max-age seconds) as it rides in the endpoint URL: empty (no-store,
42
+ * the default) or 1–7 digits (up to ~115 days). Charset-gated before HMAC so a forged value can't
43
+ * reach the response header, though the MAC is the real guard.
44
+ */
45
+ export declare const REGION_TTL_RE: RegExp;
46
+ /** {@link REGION_ID_RE}: exactly 12 lowercase hex chars. */
47
+ export declare function is_region_id(s: string): boolean;
48
+ /** {@link REGION_TTL_RE}: empty, or 1–7 ASCII digits. */
49
+ export declare function is_region_ttl(s: string): boolean;
50
+ /** Exactly `n` chars of `[0-9a-f]`. */
51
+ export declare function is_lower_hex(s: string, n: number): boolean;
@@ -0,0 +1,90 @@
1
+ // src/server/endpoint.ts
2
+ const DEFAULT_ISLANDS_ENDPOINT = "/__ogygia__";
3
+ /**
4
+ * THE ISLANDS ENDPOINT — one path for everything that names it: the handle answers on it, every
5
+ * capability is minted against it, a render knows it is serving a hole by it, the profiler counts
6
+ * its requests by it. `handle({ endpoint })` sets it as the app's hooks load, before any render
7
+ * (Kit loads the server hooks before it renders anything, prerender included). It used to move only
8
+ * the handler: pages still minted `/__ogygia__?…`, and behind a proxy that forwards only the app's
9
+ * own prefixes every hole was empty.
10
+ *
11
+ * Process-wide on `globalThis`, not module state: this file can load under two module ids in one
12
+ * server (the plugin points the mint at the package's built file while an app's hooks import it from
13
+ * a linked package's source), and a module variable set by the handle was then never read by the mint.
14
+ */
15
+ const ENDPOINT_KEY = Symbol.for("ogygia.islands-endpoint");
16
+ const endpoint_slot = globalThis;
17
+ /** The islands endpoint path (without the app's base: matched by suffix, minted through `resolve`). */
18
+ function islands_endpoint() {
19
+ return endpoint_slot[ENDPOINT_KEY] ?? "/__ogygia__";
20
+ }
21
+ /** Set by the handle (`handle({ endpoint })`); the default when none is given. */
22
+ function configure_islands_endpoint(path) {
23
+ endpoint_slot[ENDPOINT_KEY] = !path ? DEFAULT_ISLANDS_ENDPOINT : path.startsWith("/") ? path : "/" + path;
24
+ }
25
+ /** Max b64url props blob accepted by the region handle (and refused at mint time). */
26
+ const MAX_REGION_PROPS_LEN = 8192;
27
+ /**
28
+ * Default capability TTL (seconds) for DYNAMIC pages. Shorter than a day so harvested URLs age
29
+ * out; override via `ogygia({ ttl })`.
30
+ */
31
+ const DEFAULT_REGION_TTL_SEC = 3600;
32
+ /**
33
+ * Capability TTL for PRERENDERED pages (10 years — effectively the life of the deploy). A static
34
+ * file lives on the CDN indefinitely, so an aging capability would strand every hole on it after
35
+ * `ttl` (real PPR would silently die in an hour). Safe: the capability's props are already
36
+ * baked into the public static HTML, and the mint seals an EMPTY session at prerender — signing
37
+ * that same public tuple for longer reveals nothing new. Redeploy survival additionally needs a
38
+ * stable `OGYGIA_SECRET` (the default per-build key rotates; ServerIsland warns at build).
39
+ */
40
+ const PRERENDER_REGION_TTL_SEC = 31536e4;
41
+ /**
42
+ * WHEN a capability minted now expires — aligned to a window, not `now + ttl`.
43
+ *
44
+ * Every render of the same hole (same id, props, session) in the same window mints the SAME
45
+ * `exp`, hence the SAME signature and URL: the hole's HTML is byte-identical across requests. That
46
+ * is what lets anything keyed on the page's bytes hit — a host app's post-render component cache,
47
+ * a CDN or postrender store comparing documents, an ETag. With `now + ttl` every request minted a new
48
+ * URL and a header block wrapping five holes was re-processed on every request (measured: seconds
49
+ * of server time per page on a Lambda-class host).
50
+ *
51
+ * The window is half the TTL: `exp` is the end of the window after the current one, so a
52
+ * capability is always valid for at least `ttl / 2` and at most `ttl` (harvested URLs still age
53
+ * out on the same order); consecutive windows overlap by construction, so a page rendered at the
54
+ * end of a window and fetched a moment later still verifies.
55
+ */
56
+ function capability_expiry(now_sec, ttl_sec) {
57
+ const half = Math.max(1, Math.floor(ttl_sec / 2));
58
+ return (Math.floor(now_sec / half) + 2) * half;
59
+ }
60
+ /** Region ids are always 12 lowercase hex chars from the transform. */
61
+ const REGION_ID_RE = /^[0-9a-f]{12}$/;
62
+ /**
63
+ * A hole's optional cache `ttl` (max-age seconds) as it rides in the endpoint URL: empty (no-store,
64
+ * the default) or 1–7 digits (up to ~115 days). Charset-gated before HMAC so a forged value can't
65
+ * reach the response header, though the MAC is the real guard.
66
+ */
67
+ const REGION_TTL_RE = /^(|[0-9]{1,7})$/;
68
+ /** {@link REGION_ID_RE}: exactly 12 lowercase hex chars. */
69
+ function is_region_id(s) {
70
+ return is_lower_hex(s, 12);
71
+ }
72
+ /** {@link REGION_TTL_RE}: empty, or 1–7 ASCII digits. */
73
+ function is_region_ttl(s) {
74
+ if (s.length > 7) return false;
75
+ for (let i = 0; i < s.length; i++) {
76
+ const c = s.charCodeAt(i);
77
+ if (c < 48 || c > 57) return false;
78
+ }
79
+ return true;
80
+ }
81
+ /** Exactly `n` chars of `[0-9a-f]`. */
82
+ function is_lower_hex(s, n) {
83
+ if (s.length !== n) return false;
84
+ for (let i = 0; i < n; i++) {
85
+ const c = s.charCodeAt(i);
86
+ if (!(c >= 48 && c <= 57 || c >= 97 && c <= 102)) return false;
87
+ }
88
+ return true;
89
+ }
90
+ export { DEFAULT_ISLANDS_ENDPOINT, DEFAULT_REGION_TTL_SEC, MAX_REGION_PROPS_LEN, PRERENDER_REGION_TTL_SEC, REGION_ID_RE, REGION_TTL_RE, capability_expiry, configure_islands_endpoint, is_lower_hex, is_region_id, is_region_ttl, islands_endpoint };
@@ -0,0 +1,8 @@
1
+ /** The file an entry is loaded from: its content-hashed location, else the identity itself. */
2
+ export declare function entry_src(identity: string): string;
3
+ /**
4
+ * The runtime bootstrap for a document: the runtime's script (its location) and a preload per chunk
5
+ * it statically imports, so they download with it. `resolve` applies the base / assets prefix (Kit's
6
+ * `asset()`); a routeless document passes none. Empty when no runtime is built.
7
+ */
8
+ export declare function runtime_bootstrap(resolve?: (url: string) => string): string;
@@ -0,0 +1,29 @@
1
+ import { runtime_bootstrap_tags } from "./document-tail.js";
2
+ import runtime_url from "virtual:ogygia/runtime-url";
3
+ import { entryLocation, islandDeps } from "virtual:ogygia/island-deps";
4
+ // src/server/entry-location.ts
5
+ /**
6
+ * ENTRY IDENTITY → LOCATION, on the server. A hydrate island's entry and the runtime each have an
7
+ * IDENTITY — the stable URL the compiler bakes (`/<appDir>/immutable/og-region.<iid>.js`, the
8
+ * runtime's stable name) and every map keys by — and a LOCATION: the content-hashed file the build
9
+ * emitted, the one a browser loads. A stable name served `immutable` would be kept for a year after
10
+ * its content changed; a hashed name cannot go stale. The server bundle is built before the client
11
+ * bundle, so the location is looked up at render time through the build handoff (`entryLocation`).
12
+ *
13
+ * No location (the dev server, a handoff from before hashing, an island from another app): the
14
+ * identity itself is served — in a build, the stable-name shim that re-exports the current file.
15
+ */
16
+ /** The file an entry is loaded from: its content-hashed location, else the identity itself. */
17
+ function entry_src(identity) {
18
+ return identity && entryLocation(identity) || identity;
19
+ }
20
+ /**
21
+ * The runtime bootstrap for a document: the runtime's script (its location) and a preload per chunk
22
+ * it statically imports, so they download with it. `resolve` applies the base / assets prefix (Kit's
23
+ * `asset()`); a routeless document passes none. Empty when no runtime is built.
24
+ */
25
+ function runtime_bootstrap(resolve = (url) => url) {
26
+ if (!runtime_url) return "";
27
+ return runtime_bootstrap_tags(resolve(entry_src(runtime_url)), islandDeps(runtime_url).map(resolve));
28
+ }
29
+ export { entry_src, runtime_bootstrap };
@@ -0,0 +1 @@
1
+ export declare function island_fingerprint(entry: string, canonical: string): string;
@@ -0,0 +1,25 @@
1
+ import { createHash } from "node:crypto";
2
+ // src/server/fingerprint.ts
3
+ /**
4
+ * ISLAND FINGERPRINT (`data-og-fp`) — the server's identity for one island instance: its module
5
+ * URL + the canonical text of its props (server/props-wire.ts), 64 bits as 16 hex chars.
6
+ *
7
+ * What reads it: the runtime's sidecar lookup (`id="og-props-<fp>"`), the hydration self-heal
8
+ * copy, the reconciler's data-key on a client navigation, and the server-delta skip (the client
9
+ * sends the fingerprints it holds back in `x-ogygia-known`). Every one of them READS the emitted
10
+ * attribute — the client never recomputes an island's fingerprint (runtime/reconcile.ts computes
11
+ * one only for a region that carries none) — so the server is free to hash however is cheapest
12
+ * here, as long as two servers agree on the same input: SHA-1 through Node's native digest,
13
+ * ~4× the speed of the pure-JS lane hash on a 130 KB props text, and identical on every instance
14
+ * behind a load balancer.
15
+ *
16
+ * NOT for a hole's identity (`data-og-hole`): the client leg of a Kit-hydrated document recomputes
17
+ * that one, so it stays on the universal `fingerprint_of` (runtime/hash.ts) on both legs.
18
+ *
19
+ * Server-only (`node:crypto`), reached from Region.svelte through the client-stubbed
20
+ * `virtual:ogygia/region-endpoint` — Region computes a fingerprint only on the server.
21
+ */
22
+ function island_fingerprint(entry, canonical) {
23
+ return createHash("sha1").update(entry).update(" ").update(canonical).digest("hex").slice(0, 16);
24
+ }
25
+ export { island_fingerprint };
@@ -0,0 +1,45 @@
1
+ export declare function page_declares_router_meta(html: string): boolean;
2
+ export declare function page_declares_runtime_script(html: string): boolean;
3
+ export declare function page_declares_dev_hmr_script(html: string): boolean;
4
+ export declare function page_declares_speculation_rules(html: string): boolean;
5
+ /**
6
+ * Drop duplicate `<link>` tags in the HEAD — one pass over the head slice, two families:
7
+ *
8
+ * - `rel="stylesheet"`: same href → first occurrence wins. Kit links a route's client-graph CSS
9
+ * and Region.svelte links a rendered island's CSS from the render pass; a layout island compiled
10
+ * as a real wrapper (a csr=true-capable layout host) is in both, so its sheet was linked twice —
11
+ * two render-blocking fetches of one asset. `<style>` tags are untouched.
12
+ * - `rel="modulepreload"`: same href → first occurrence wins. Each island's SSR emits its own
13
+ * dep-hint block, so islands sharing dep chunks — or one island rendered N times — repeat
14
+ * identical hints (a real page carried ~44 duplicate tags). Every hint ogygia emits is
15
+ * `fetchpriority="low"` (Region.svelte), so there is no priority to arbitrate between copies.
16
+ *
17
+ * Every other `<link>` passes through byte-identical. The handle calls this on the HEAD SLICE of
18
+ * the document only (everything before `</head>`, tens of KB): the hints and the sheets live there,
19
+ * so the 2.6 MB body is never scanned for them.
20
+ */
21
+ export declare function dedupe_head_links(head: string): string;
22
+ /**
23
+ * Put the runtime bootstrap BEFORE ALL OF THE PAGE'S JAVASCRIPT in `<head>` — immediately ahead of
24
+ * the first `<script>` or `<link rel="modulepreload">` the app's template and the page carry, and
25
+ * no earlier. `runtime` is the tag to place when the head has none yet (`null` = only reorder what
26
+ * is there; the tag an island page emits sits wherever Kit's head slot is, after the app's own
27
+ * scripts in `app.html`). With no JavaScript in the head it goes last in it. Returns `head` itself
28
+ * when there is nothing to move.
29
+ *
30
+ * Why BEFORE THE JS: module and deferred scripts run in document order once parsing ends, and the
31
+ * runtime's custom-element definition is what makes every `<ogygia-region>` connect and keep its
32
+ * server markup — the copy an island hydrates against when something edited it while it slept
33
+ * (runtime/core.ts `#ssr_html`). A design-system runtime loaded from the app template ran BEFORE the
34
+ * runtime on a customer page and stripped the whitespace nodes of every island in the header before
35
+ * the runtime ever saw them, so the "server copy" was the edited DOM and the login island still
36
+ * re-rendered client-side on its first tap. Ahead of every script, the runtime sees the document as
37
+ * the server sent it, whatever the app loads after it.
38
+ *
39
+ * Why NOT FIRST IN THE HEAD: that ordering guarantee is about execution, and only needs "before the
40
+ * other scripts". Heading the whole `<head>` also made the runtime the page's FIRST REQUEST, ahead of
41
+ * its stylesheets and its LCP image preload. Everything that is not JavaScript — the charset and
42
+ * other `<meta>`, the `<title>`, stylesheets, preconnects, image/font preloads — keeps its place in
43
+ * front of it.
44
+ */
45
+ export declare function runtime_first(head: string, runtime: string | null): string;