@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,147 @@
1
+ import { dir_entries, fs, path } from "../host.js";
2
+ import { islandDepsHandoffPath } from "./island-deps.js";
3
+ // src/compiler/link/build-output.ts
4
+ /**
5
+ * Whole-program build-output side effects — the work the adapter's `writeBundle` does AFTER the
6
+ * client bundle is on disk: the content-leak guardrail, and writing / inlining the island-deps
7
+ * handoff so SSR can `modulepreload` a hydrate island's chunks and style a server-picked hole. Pure
8
+ * over the finished bundle + the app root (fs is the only side effect); the adapter owns only the
9
+ * Vite `this.getFileName` resolution and the trigger.
10
+ */
11
+ const CORPUS_RE = /\.(svx|md)(\?|$)/;
12
+ /** A `?…type=style…` / `lang.css` sub-import id — a CSS face, never a corpus JS leak. */
13
+ const CONTENT_STYLE_QUERY_RE = /[?&](?:type=style|lang\.css)/;
14
+ const BACKSLASH_G = /\\/g;
15
+ const SINGLE_QUOTE_G = /'/g;
16
+ const DOUBLE_QUOTE_G = /"/g;
17
+ const LINE_SEPARATOR_G = /\u2028/g;
18
+ const PARAGRAPH_SEPARATOR_G = /\u2029/g;
19
+ /**
20
+ * Guardrail: a content collection must never reach a CLIENT chunk. Ground truth is the finished
21
+ * bundle. A compiled corpus module (.svx/.md) in a client chunk means a `content()` collection was
22
+ * imported into client-shipped code (usually an island), which drags its eager `import.meta.glob` —
23
+ * every doc — into the browser. On a csr=false site the corpus renders server-side and should never
24
+ * appear here, so any hit is a real leak. A warning, not a throw: the guardrail must never break a build.
25
+ */
26
+ function warn_content_leaks(bundle, root, is_island_path) {
27
+ try {
28
+ const leaks = [];
29
+ for (const [key, chunk] of Object.entries(bundle)) {
30
+ if (chunk.type !== "chunk") continue;
31
+ const corpus = (chunk.moduleIds ?? Object.keys(chunk.modules ?? {})).filter((id) => CORPUS_RE.test(id) && !is_island_path(id) && !CONTENT_STYLE_QUERY_RE.test(id));
32
+ if (corpus.length) leaks.push({
33
+ chunk: chunk.fileName ?? key,
34
+ modules: corpus
35
+ });
36
+ }
37
+ if (leaks.length) {
38
+ const all = [...new Set(leaks.flatMap((l) => l.modules))];
39
+ const sample = all.slice(0, 5).map((m) => " " + path.relative(root, m.split("?")[0])).join("\n");
40
+ console.warn(`[ogygia] content leaked into the CLIENT bundle: ${all.length} corpus module(s) (.svx/.md) shipped to the browser (in chunk '${leaks[0].chunk}').\n A content() collection was imported into client-shipped code — usually an island — which drags its eager import.meta.glob (every doc) in.\n Fix: keep the collection in a server-only module (or a .remote.ts) and feed islands DATA (refs) via props or a remote, never the collection itself.\n${sample}${all.length > 5 ? "\n …" : ""}`);
41
+ }
42
+ } catch {}
43
+ }
44
+ /**
45
+ * Write the island-deps handoff JSON (the map SSR reads at render): the stable path under Kit's
46
+ * `outDir` (`.svelte-kit` unless the app configured `kit.outDir`), an adapter-friendly copy next
47
+ * to the server bundle, AND an in-place inline into every server chunk that carries the token slot
48
+ * — inlining is what makes it survive serverless tracing (@vercel/nft only bundles *imported*
49
+ * files, not runtime fs reads, so the co-located JSON is dropped there; that is why held/dual
50
+ * regions that cross the wire rendered unstyled on Vercel/Netlify). Unpatched builds keep the fs
51
+ * fallback (adapter-node, dev-preview).
52
+ */
53
+ function emit_island_deps_handoff(root, json, out_dir) {
54
+ const handoff = islandDepsHandoffPath(out_dir);
55
+ fs.mkdirSync(path.dirname(handoff), { recursive: true });
56
+ fs.writeFileSync(handoff, json);
57
+ const server_copy = path.join(out_dir, "output", "server", "og-region-deps.json");
58
+ try {
59
+ fs.mkdirSync(path.dirname(server_copy), { recursive: true });
60
+ fs.writeFileSync(server_copy, json);
61
+ } catch {}
62
+ try {
63
+ const server_dir = path.join(out_dir, "output", "server");
64
+ const token = "__OGYGIA_ISLAND_DEPS_INLINE__";
65
+ const inline = json.replace(BACKSLASH_G, "\\\\").replace(SINGLE_QUOTE_G, "\\'").replace(DOUBLE_QUOTE_G, "\\\"").replace(LINE_SEPARATOR_G, "\\u2028").replace(PARAGRAPH_SEPARATOR_G, "\\u2029");
66
+ const patch_server = (dir) => {
67
+ let entries;
68
+ try {
69
+ entries = dir_entries(dir);
70
+ } catch {
71
+ return;
72
+ }
73
+ for (const e of entries) {
74
+ const full = path.join(dir, e.name);
75
+ if (e.isDirectory()) {
76
+ patch_server(full);
77
+ continue;
78
+ }
79
+ if (!e.name.endsWith(".js")) continue;
80
+ let code;
81
+ try {
82
+ code = fs.readFileSync(full, "utf8");
83
+ } catch {
84
+ continue;
85
+ }
86
+ if (!code.includes(token)) continue;
87
+ fs.writeFileSync(full, code.split(token).join(inline));
88
+ }
89
+ };
90
+ patch_server(server_dir);
91
+ } catch {}
92
+ }
93
+ /**
94
+ * SEED SHAPING report (client `writeBundle`): which islands read `page.data` through the shim, how
95
+ * many keys they were pinned to, and — the actionable part — the modules whose reads could not be
96
+ * pinned, each with its line and why, since one such module makes every page carrying that island
97
+ * ship its whole `page.data`. Same shape as the barrels report: a few lines, a count for the rest.
98
+ */
99
+ function report_seed_shaping(map, bundle, program, root, file_of = (identity) => identity) {
100
+ /** per island entry that ships all: the modules in its closure whose reads could not be pinned */
101
+ const why_of = {};
102
+ const readers = Object.keys(map.page).filter((e) => map.page[e]);
103
+ if (!readers.length) return why_of;
104
+ const pinned = readers.filter((e) => Array.isArray(map.page_keys[e]));
105
+ const unpinned = readers.filter((e) => !Array.isArray(map.page_keys[e]));
106
+ const key_count = new Set(pinned.flatMap((e) => map.page_keys[e] ?? [])).size;
107
+ const rel = (p) => p.startsWith(root) ? p.slice(root.length).replace(/^\//, "") : p;
108
+ const lines = [];
109
+ lines.push(`[ogygia] page seed: ${readers.length} island${readers.length === 1 ? "" : "s"} read page.data — ${pinned.length} pinned to ${key_count} key${key_count === 1 ? "" : "s"}, ${unpinned.length} ship all of it`);
110
+ if (unpinned.length) {
111
+ const closure = (entry) => {
112
+ const seen = /* @__PURE__ */ new Set();
113
+ const queue = [file_of(entry).replace(/^\//, "")];
114
+ while (queue.length) {
115
+ const f = queue.pop();
116
+ if (seen.has(f)) continue;
117
+ seen.add(f);
118
+ for (const i of bundle[f]?.imports ?? []) queue.push(i);
119
+ }
120
+ return seen;
121
+ };
122
+ const blamed = /* @__PURE__ */ new Map();
123
+ for (const e of unpinned) {
124
+ const own = /* @__PURE__ */ new Set();
125
+ for (const chunk of closure(e)) for (const id of bundle[chunk]?.moduleIds ?? []) {
126
+ const clean = id.split("?")[0].split("\\").join("/");
127
+ const r = program.page_key_reasons.get(clean);
128
+ if (!r) continue;
129
+ if (!blamed.has(clean)) blamed.set(clean, r);
130
+ if (own.has(clean)) continue;
131
+ own.add(clean);
132
+ (why_of[e] ??= []).push({
133
+ file: rel(clean),
134
+ line: r.line,
135
+ why: r.why
136
+ });
137
+ }
138
+ }
139
+ const rows = [...blamed].slice(0, 8);
140
+ for (const [file, r] of rows) lines.push(` ${rel(file)}${r.line === null ? "" : ":" + r.line} — ${r.why}`);
141
+ if (blamed.size > rows.length) lines.push(` … and ${blamed.size - rows.length} more module${blamed.size - rows.length === 1 ? "" : "s"}`);
142
+ if (!blamed.size) lines.push(` (read through code the build never saw — a dependency, or a foreign fragment)`);
143
+ }
144
+ console.log(lines.join("\n"));
145
+ return why_of;
146
+ }
147
+ export { emit_island_deps_handoff, report_seed_shaping, warn_content_leaks };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * `virtual:ogygia/secret` — SERVER only: the per-build random key material and whether the BUILD
3
+ * saw an `OGYGIA_SECRET` (its region ids are salted from it). CLIENT build: empty (never mint in the
4
+ * browser). Which key signs is decided at first use, not here (server/signing-key.ts): the runtime's
5
+ * `OGYGIA_SECRET` when the host sets it — read then, so an env a host fills after module eval still
6
+ * counts — else this build's key.
7
+ */
8
+ export declare function secret_module(ssr: boolean, build_secret: string, build_had_secret: boolean): string;
9
+ /**
10
+ * `virtual:ogygia/sign` — same split as secret: SSR mints with node:crypto (re-exports the real
11
+ * HMAC module); client never mints (secret is ''), but still needs `region_mac_message` for the
12
+ * length-prefixed canonical form the runtime compares against.
13
+ */
14
+ export declare function sign_module(ssr: boolean, hmac_module: string): string;
15
+ /**
16
+ * `virtual:ogygia/server-plugins` — SERVER only: each plugin's server half, one static import per
17
+ * plugin, in the order the app listed them. The handle runs their stages straight off this list; an
18
+ * app with no plugins gets an empty one (and the client always does).
19
+ */
20
+ /** One plugin's server realm, as the build wires it. */
21
+ export interface ServerRealm {
22
+ /** the plugin's (package) name */
23
+ name: string;
24
+ /** the realm module's absolute POSIX path (the plugin's `server`) */
25
+ module: string;
26
+ /** the plugin's options (JSON) */
27
+ options: unknown;
28
+ }
29
+ export declare function server_plugins_module(ssr: boolean, realms: readonly ServerRealm[]): string;
30
+ /** `virtual:ogygia/route-config` — SERVER only: every Kit page route id → the keys the plugins claim
31
+ * inside Kit's `config` page option, merged the way Kit merges it (a key no level sets is absent).
32
+ * Empty on the client, and when no plugin claims a key: the route list never ships to the browser. */
33
+ export declare function route_config_module(ssr: boolean, routesDir: string, keys: readonly string[]): string;
34
+ /** `virtual:ogygia/rate-limit` — SERVER only; the region handle is the only consumer. */
35
+ export declare function rate_limit_module(ssr: boolean, rate_limit: {
36
+ max: number;
37
+ windowMs: number;
38
+ }): string;
39
+ /** `virtual:ogygia/session-cookie` — SERVER only; sealed into the region MAC when non-empty. */
40
+ export declare function session_cookie_module(ssr: boolean, session_cookie: string): string;
41
+ /** `virtual:ogygia/region-ttl` — SERVER only; the capability expiry window for mint, and how long
42
+ * after expiry an anonymous capability still renews. */
43
+ export declare function region_ttl_module(ssr: boolean, region_ttl: number, renew_window: number): string;
44
+ /** `virtual:ogygia/route-csr` — SERVER only: the csr=true route ids, so a csr=false layout's islands
45
+ * degrade to inline when the LEAF page is csr=true (Kit hydrates the whole document). The CLIENT leg
46
+ * is an empty set — the client reads the identical signal from `kit_hydrates_page()`, and the route
47
+ * list never ships to the browser. */
48
+ export declare function route_csr_module(ssr: boolean, routesDir: string): string;
@@ -0,0 +1,64 @@
1
+ import { csrTrueRouteIds, errorCsrTrueRouteIds, page_route_config, rootLayoutCsrTrue } from "../kit.js";
2
+ // src/compiler/link/caps.ts
3
+ /**
4
+ * Capability virtual-module emitters — the leg-split sources for the signed-capability family:
5
+ * `virtual:ogygia/secret`, `/sign`, `/rate-limit`, `/session-cookie`, `/region-ttl`. Each is a pure
6
+ * `(ssr, <one resolved config value>) => string`: the SSR leg carries the real signer / baked config,
7
+ * the client leg gets an inert stub (a browser never mints). The driver's `emit` dispatch calls these.
8
+ */
9
+ /**
10
+ * `virtual:ogygia/secret` — SERVER only: the per-build random key material and whether the BUILD
11
+ * saw an `OGYGIA_SECRET` (its region ids are salted from it). CLIENT build: empty (never mint in the
12
+ * browser). Which key signs is decided at first use, not here (server/signing-key.ts): the runtime's
13
+ * `OGYGIA_SECRET` when the host sets it — read then, so an env a host fills after module eval still
14
+ * counts — else this build's key.
15
+ */
16
+ function secret_module(ssr, build_secret, build_had_secret) {
17
+ if (!ssr) return `export const buildKey = '';\nexport const buildHadSecret = false;`;
18
+ return `export const buildKey = ${JSON.stringify(build_secret)};\nexport const buildHadSecret = ${build_had_secret};`;
19
+ }
20
+ /**
21
+ * `virtual:ogygia/sign` — same split as secret: SSR mints with node:crypto (re-exports the real
22
+ * HMAC module); client never mints (secret is ''), but still needs `region_mac_message` for the
23
+ * length-prefixed canonical form the runtime compares against.
24
+ */
25
+ function sign_module(ssr, hmac_module) {
26
+ if (!ssr) return "export function sign(_secret, _message) { return ''; }\nexport function verify(_secret, _message, _sig) { return false; }\nexport function region_mac_message(id, exp, props, session = '', ttl = '', render = '') {\n const enc = new TextEncoder();\n const lp = (s) => enc.encode(String(s)).byteLength + ':' + String(s);\n const v1 = lp(id) + '|' + lp(exp) + '|' + lp(props) + '|' + lp(session) + '|' + lp(ttl);\n return render === '' ? 'v1|' + v1 : 'v2|' + v1 + '|' + lp(render);\n}\n";
27
+ return `export { sign, verify, region_mac_message } from ${JSON.stringify(hmac_module)};`;
28
+ }
29
+ function server_plugins_module(ssr, realms) {
30
+ if (!ssr || realms.length === 0) return `export const plugins = [];`;
31
+ return `${realms.map((r, i) => `import p${i} from ${JSON.stringify(r.module)};`).join("\n")}\nexport const plugins = [\n\t${realms.map((r, i) => `{ name: ${JSON.stringify(r.name)}, options: ${JSON.stringify(r.options)}, server: p${i} }`).join(",\n ")}\n];`;
32
+ }
33
+ /** `virtual:ogygia/route-config` — SERVER only: every Kit page route id → the keys the plugins claim
34
+ * inside Kit's `config` page option, merged the way Kit merges it (a key no level sets is absent).
35
+ * Empty on the client, and when no plugin claims a key: the route list never ships to the browser. */
36
+ function route_config_module(ssr, routesDir, keys) {
37
+ if (!ssr || keys.length === 0) return `export const route_config = {};`;
38
+ return `export const route_config = ${JSON.stringify(page_route_config(routesDir, keys))};`;
39
+ }
40
+ /** `virtual:ogygia/rate-limit` — SERVER only; the region handle is the only consumer. */
41
+ function rate_limit_module(ssr, rate_limit) {
42
+ if (!ssr) return `export const rateLimit = { max: 0, windowMs: 60000 };`;
43
+ return `export const rateLimit = ${JSON.stringify(rate_limit)};`;
44
+ }
45
+ /** `virtual:ogygia/session-cookie` — SERVER only; sealed into the region MAC when non-empty. */
46
+ function session_cookie_module(ssr, session_cookie) {
47
+ if (!ssr) return `export const sessionCookie = '';`;
48
+ return `export const sessionCookie = ${JSON.stringify(session_cookie)};`;
49
+ }
50
+ /** `virtual:ogygia/region-ttl` — SERVER only; the capability expiry window for mint, and how long
51
+ * after expiry an anonymous capability still renews. */
52
+ function region_ttl_module(ssr, region_ttl, renew_window) {
53
+ if (!ssr) return `export const regionTtl = 3600;\nexport const renewWindow = 0;`;
54
+ return `export const regionTtl = ${region_ttl};\nexport const renewWindow = ${renew_window};`;
55
+ }
56
+ /** `virtual:ogygia/route-csr` — SERVER only: the csr=true route ids, so a csr=false layout's islands
57
+ * degrade to inline when the LEAF page is csr=true (Kit hydrates the whole document). The CLIENT leg
58
+ * is an empty set — the client reads the identical signal from `kit_hydrates_page()`, and the route
59
+ * list never ships to the browser. */
60
+ function route_csr_module(ssr, routesDir) {
61
+ if (!ssr) return "export const csr_true_routes = new Set();\nexport const error_csr_true_routes = new Set();\nexport const root_layout_csr_true = true;";
62
+ return `export const csr_true_routes = new Set(${JSON.stringify(csrTrueRouteIds(routesDir))});\nexport const error_csr_true_routes = new Set(${JSON.stringify(errorCsrTrueRouteIds(routesDir))});\nexport const root_layout_csr_true = ${rootLayoutCsrTrue(routesDir)};`;
63
+ }
64
+ export { rate_limit_module, region_ttl_module, route_config_module, route_csr_module, secret_module, server_plugins_module, session_cookie_module, sign_module };
@@ -0,0 +1,23 @@
1
+ export declare function source_uses_ogygia_context(src: string): boolean;
2
+ /** The string-literal keys a file READS via getContext and SETS via setContext — each PROVEN, by
3
+ * following the import binding rather than matching text, to be Svelte/ogygia's. */
4
+ export interface ContextKeys {
5
+ reads: string[];
6
+ sets: string[];
7
+ }
8
+ /**
9
+ * Resolve the string-literal keys a file reads via `getContext(…)` and sets via `setContext(…)`, where
10
+ * each call is PROVEN — by following the import binding, not by matching text — to be Svelte's or
11
+ * ogygia's. Counts a `getContext as gc` alias and a namespace `ns.getContext(…)`; ignores a local
12
+ * function of the same name, a `foo.getContext(…)` on an unrelated object, and a dynamic key. ogygia's
13
+ * own bridge keys are `Symbol.for(…)` (never string literals), so they never appear.
14
+ *
15
+ * `reads` drives the WARNING: on a csr=false page the page/layout `<script>` never runs on the client,
16
+ * so a value set with Svelte's own `setContext` in a page/layout is gone by the time an island hydrates
17
+ * in isolation — the island reads `undefined`, renders a different tree, and Svelte discards its server
18
+ * DOM (a silent full re-render). `sets` is what makes the warning precise: a key an island's OWN code
19
+ * both sets and reads lives inside one hydration root (a component library using context internally) and
20
+ * needs no bridge — the caller subtracts island sets from island reads so only a key provided OUTSIDE
21
+ * the island is flagged. Empty on a file with no such call, or one that cannot be parsed.
22
+ */
23
+ export declare function context_string_keys(src: string, kind: "svelte" | "script"): ContextKeys;
@@ -0,0 +1,137 @@
1
+ import { parse_roots } from "./page-keys.js";
2
+ import { OWN_PACKAGE_NAMES, OWN_SPECIFIER_SOURCE } from "../../own-package.js";
3
+ // src/compiler/link/context-detect.ts
4
+ /**
5
+ * Detect whether a source file uses an ogygia **context provider** — `Provide`, the drop-in
6
+ * `setContext`, or `createContext` imported from `'ogygia'`. Drives the `context` runtime mark, which
7
+ * gates the ~4.7 kB cross-island context bridge OUT of apps that never provide context.
8
+ *
9
+ * WHY IMPORT-CLAUSE SCANNING IS SOUND: every entry point to the bridge is an
10
+ * `import { … } from 'ogygia'` (or a namespace import used as `og.setContext(…)`) naming one of the
11
+ * three. A read-only `getContext` needs no bridge, so it's deliberately NOT a trigger. Over-inclusion
12
+ * is the safe direction — a MISSED provider silently drops context inside islands, an extra include is
13
+ * just bytes — so the scan biases to include: any one matching file in `src/` sets the whole-app mark.
14
+ *
15
+ * Regexes are module-level (compiled once); `source_uses_ogygia_context` runs per file in the prescan
16
+ * walk. The `g` regexes are stateful, so each use resets `lastIndex`. (The READER side — `getContext`
17
+ * — instead follows the import binding through the AST, see `get_context_string_keys` below; a text
18
+ * scan there would count an unrelated `getContext`.)
19
+ */
20
+ const OGYGIA_NAMED_IMPORT = new RegExp(`import\\s+(?:type\\s+)?\\{([\\s\\S]*?)\\}\\s*from\\s*['"]${OWN_SPECIFIER_SOURCE}['"]`, "g");
21
+ const OGYGIA_NS_IMPORT = new RegExp(`import\\s*\\*\\s*as\\s+(\\w+)\\s*from\\s*['"]${OWN_SPECIFIER_SOURCE}['"]`);
22
+ const CTX_PROVIDER = /\b(?:Provide|setContext|createContext)\b/;
23
+ const NS_CTX_USAGE = /\b(\w+)\.(?:Provide|setContext|createContext)\b/g;
24
+ function source_uses_ogygia_context(src) {
25
+ OGYGIA_NAMED_IMPORT.lastIndex = 0;
26
+ let m;
27
+ while (m = OGYGIA_NAMED_IMPORT.exec(src)) if (CTX_PROVIDER.test(m[1])) return true;
28
+ const ns = OGYGIA_NS_IMPORT.exec(src);
29
+ if (!ns) return false;
30
+ NS_CTX_USAGE.lastIndex = 0;
31
+ let u;
32
+ while (u = NS_CTX_USAGE.exec(src)) if (u[1] === ns[1]) return true;
33
+ return false;
34
+ }
35
+ /** Modules whose `getContext` reads the Svelte/ogygia context map (both resolve the same map — ogygia
36
+ * re-exports Svelte's, and the drop-in is read with the unchanged `getContext`). */
37
+ const CTX_MODULES = /* @__PURE__ */ new Set(["svelte", ...OWN_PACKAGE_NAMES]);
38
+ /** AST back-references / positions the walk must not descend into. */
39
+ const NODE_SKIP = /* @__PURE__ */ new Set([
40
+ "start",
41
+ "end",
42
+ "loc",
43
+ "range",
44
+ "parent",
45
+ "metadata",
46
+ "leadingComments",
47
+ "trailingComments",
48
+ "__parent",
49
+ "__key"
50
+ ]);
51
+ /** An import/member name node → its string name (`Identifier` or a string `Literal`). */
52
+ function name_of(n) {
53
+ if (!n) return null;
54
+ if (n.type === "Identifier") return n.name ?? null;
55
+ if (n.type === "Literal" && typeof n.value === "string") return n.value;
56
+ return null;
57
+ }
58
+ /** A string-literal argument's value, else null (a dynamic key is deliberately not counted). */
59
+ function literal_string(n) {
60
+ return n && n.type === "Literal" && typeof n.value === "string" ? n.value : null;
61
+ }
62
+ /**
63
+ * Resolve the string-literal keys a file reads via `getContext(…)` and sets via `setContext(…)`, where
64
+ * each call is PROVEN — by following the import binding, not by matching text — to be Svelte's or
65
+ * ogygia's. Counts a `getContext as gc` alias and a namespace `ns.getContext(…)`; ignores a local
66
+ * function of the same name, a `foo.getContext(…)` on an unrelated object, and a dynamic key. ogygia's
67
+ * own bridge keys are `Symbol.for(…)` (never string literals), so they never appear.
68
+ *
69
+ * `reads` drives the WARNING: on a csr=false page the page/layout `<script>` never runs on the client,
70
+ * so a value set with Svelte's own `setContext` in a page/layout is gone by the time an island hydrates
71
+ * in isolation — the island reads `undefined`, renders a different tree, and Svelte discards its server
72
+ * DOM (a silent full re-render). `sets` is what makes the warning precise: a key an island's OWN code
73
+ * both sets and reads lives inside one hydration root (a component library using context internally) and
74
+ * needs no bridge — the caller subtracts island sets from island reads so only a key provided OUTSIDE
75
+ * the island is flagged. Empty on a file with no such call, or one that cannot be parsed.
76
+ */
77
+ function context_string_keys(src, kind) {
78
+ const wants_get = src.includes("getContext");
79
+ const wants_set = src.includes("setContext");
80
+ if (!wants_get && !wants_set) return {
81
+ reads: [],
82
+ sets: []
83
+ };
84
+ const roots = parse_roots(src, "ogygia:context-detect", kind);
85
+ if (!roots) return {
86
+ reads: [],
87
+ sets: []
88
+ };
89
+ const get_locals = /* @__PURE__ */ new Set();
90
+ const set_locals = /* @__PURE__ */ new Set();
91
+ const namespaces = /* @__PURE__ */ new Set();
92
+ const calls = [];
93
+ const walk = (node) => {
94
+ if (!node || typeof node !== "object") return;
95
+ if (Array.isArray(node)) {
96
+ for (const c of node) walk(c);
97
+ return;
98
+ }
99
+ if (node.type === "ImportDeclaration" && CTX_MODULES.has(String(node.source?.value ?? ""))) {
100
+ for (const s of node.specifiers ?? []) if (s.type === "ImportSpecifier" && s.local?.name) {
101
+ const imported = name_of(s.imported);
102
+ if (imported === "getContext") get_locals.add(s.local.name);
103
+ else if (imported === "setContext") set_locals.add(s.local.name);
104
+ } else if (s.type === "ImportNamespaceSpecifier" && s.local?.name) namespaces.add(s.local.name);
105
+ } else if (node.type === "CallExpression") calls.push(node);
106
+ for (const k in node) {
107
+ if (NODE_SKIP.has(k)) continue;
108
+ const v = node[k];
109
+ if (v && typeof v === "object") walk(v);
110
+ }
111
+ };
112
+ for (const root of roots) walk(root);
113
+ if (get_locals.size === 0 && set_locals.size === 0 && namespaces.size === 0) return {
114
+ reads: [],
115
+ sets: []
116
+ };
117
+ const reads = /* @__PURE__ */ new Set();
118
+ const sets = /* @__PURE__ */ new Set();
119
+ for (const call of calls) {
120
+ const key = literal_string(call.arguments?.[0]);
121
+ if (key == null) continue;
122
+ const callee = call.callee;
123
+ if (callee?.type === "Identifier") {
124
+ if (get_locals.has(callee.name)) reads.add(key);
125
+ else if (set_locals.has(callee.name)) sets.add(key);
126
+ } else if (callee?.type === "MemberExpression" && !callee.computed && callee.object?.type === "Identifier" && namespaces.has(callee.object.name)) {
127
+ const member = name_of(callee.property);
128
+ if (member === "getContext") reads.add(key);
129
+ else if (member === "setContext") sets.add(key);
130
+ }
131
+ }
132
+ return {
133
+ reads: [...reads],
134
+ sets: [...sets]
135
+ };
136
+ }
137
+ export { context_string_keys, source_uses_ogygia_context };
@@ -0,0 +1,11 @@
1
+ export declare const SSR_HOSTS_HANDOFF = "og-ssr-hosts.json";
2
+ /** `<outDir>/og-ssr-hosts.json` — written by the server leg, read by the client leg. */
3
+ export declare function ssr_hosts_handoff_path(out_dir: string): string;
4
+ /**
5
+ * Should an island whose host module is `host_path` get a client chunk? `loaded` is the server
6
+ * leg's transformed-module set (`host_key`-normalised), or `null` when there is no handoff.
7
+ * An island with no recorded host (a library island registered through a bridge) is always emitted.
8
+ */
9
+ export declare function island_host_loaded(host_path: string | null | undefined, loaded: Set<string> | null | undefined): boolean;
10
+ /** Parse the handoff file's contents into the set `island_host_loaded` consumes. */
11
+ export declare function parse_ssr_hosts(json: string): Set<string>;
@@ -0,0 +1,40 @@
1
+ import { path } from "../host.js";
2
+ import { host_key } from "../program.js";
3
+ // src/compiler/link/emit-gate.ts
4
+ /**
5
+ * Island-chunk emit gate — which prescanned islands the CLIENT leg should actually build.
6
+ *
7
+ * The prescan registers every marked import under the app's `src/` (both build legs, so ids agree),
8
+ * and the client leg used to emit a chunk for each of them. But a registered island is not an island
9
+ * the app SERVES: a host module nothing imports — a second route tree's pages built from the same
10
+ * source, a retired component — is dead weight, and worse than weight: its imports enter a client
11
+ * build whose server pass never analysed them (an island importing a `.remote.ts` there fails Kit's
12
+ * "Expected to find metadata for remote file" check and the build stops).
13
+ *
14
+ * Kit builds the SERVER bundle first. Its transform pass is the ground truth for reachability — the
15
+ * driver records every module id it transforms there (`Program.ssr_transformed`), the plugin writes
16
+ * the set under Kit's `outDir` at the end of that leg, and the client leg reads it back and emits
17
+ * only islands whose host is in it. No handoff (standalone builds, a client-only build) → emit all,
18
+ * the previous behaviour.
19
+ */
20
+ const SSR_HOSTS_HANDOFF = "og-ssr-hosts.json";
21
+ /** `<outDir>/og-ssr-hosts.json` — written by the server leg, read by the client leg. */
22
+ function ssr_hosts_handoff_path(out_dir) {
23
+ return path.join(out_dir, SSR_HOSTS_HANDOFF);
24
+ }
25
+ /**
26
+ * Should an island whose host module is `host_path` get a client chunk? `loaded` is the server
27
+ * leg's transformed-module set (`host_key`-normalised), or `null` when there is no handoff.
28
+ * An island with no recorded host (a library island registered through a bridge) is always emitted.
29
+ */
30
+ function island_host_loaded(host_path, loaded) {
31
+ if (!loaded) return true;
32
+ if (!host_path) return true;
33
+ return loaded.has(host_key(host_path));
34
+ }
35
+ /** Parse the handoff file's contents into the set `island_host_loaded` consumes. */
36
+ function parse_ssr_hosts(json) {
37
+ const arr = JSON.parse(json);
38
+ return new Set(Array.isArray(arr) ? arr.filter((x) => typeof x === "string") : []);
39
+ }
40
+ export { SSR_HOSTS_HANDOFF, island_host_loaded, parse_ssr_hosts, ssr_hosts_handoff_path };
@@ -0,0 +1,4 @@
1
+ /** An island entry's shim: every export of its hashed file (a component entry has a default). */
2
+ export declare function island_shim_source(shim_file: string, entry_file: string): string;
3
+ /** The runtime's shim: the hashed runtime, run (it has no exports; loading it boots). */
4
+ export declare function runtime_shim_source(shim_file: string, runtime_file: string): string;
@@ -0,0 +1,29 @@
1
+ import { path } from "../host.js";
2
+ // src/compiler/link/entry-shim.ts
3
+ /**
4
+ * THE STABLE-NAME SHIMS. An island entry and the runtime are content-hashed files; each one's old
5
+ * stable name is ALSO written, as a shim of the hashed file, so that a page cached before content
6
+ * hashing (whose islands import their stable names), and a load whose location failed (the runtime
7
+ * re-fetches the stable name fresh), still reach the CURRENT build.
8
+ *
9
+ * A shim is written as a plain ASSET at the bundle's end, once every hashed name is final — never as
10
+ * a bundled chunk. Its name never changes, so the bundler has nothing to hash, and a chunk would make
11
+ * the island's module the target of two entries: the bundler would split its code behind two facades
12
+ * and every island load would cost two requests. As an asset, the island has one entry, its location
13
+ * IS its code, and the shim is a static re-export by relative path.
14
+ */
15
+ /** The specifier from the shim's file to the hashed file (both output-relative paths). */
16
+ function relative_specifier(from_file, to_file) {
17
+ const rel = path.posix.relative(path.posix.dirname(from_file), to_file);
18
+ return rel.startsWith(".") ? rel : "./" + rel;
19
+ }
20
+ /** An island entry's shim: every export of its hashed file (a component entry has a default). */
21
+ function island_shim_source(shim_file, entry_file) {
22
+ const spec = JSON.stringify(relative_specifier(shim_file, entry_file));
23
+ return `export * from ${spec};\nexport { default } from ${spec};\n`;
24
+ }
25
+ /** The runtime's shim: the hashed runtime, run (it has no exports; loading it boots). */
26
+ function runtime_shim_source(shim_file, runtime_file) {
27
+ return `import ${JSON.stringify(relative_specifier(shim_file, runtime_file))};\n`;
28
+ }
29
+ export { island_shim_source, runtime_shim_source };
@@ -0,0 +1,142 @@
1
+ import { PageKeys } from "./page-keys.js";
2
+ import { IslandHazard } from "../../insights/hydration-hazards.js";
3
+ /**
4
+ * Kit's own `hash()` (`@sveltejs/kit/src/utils/hash.js`: djb2 ×33 xor, unsigned, base36) — the
5
+ * function a remote's id is minted with: `${hash(file)}/${exportName}`, `file` the module's path
6
+ * relative to `process.cwd()`, posix. Mirrored here (Kit does not export it) so the build can
7
+ * name a remote by the same id the server sees on `internals.id` at render time. Covered by a
8
+ * vector test against ids observed from a real Kit build.
9
+ */
10
+ export declare function kit_remote_hash(file: string): string;
11
+ /**
12
+ * The Kit remote id-hash of a CLIENT module id, or `null` for a module that is not a remote file.
13
+ * `cwd` is what Kit hashed the file against (`process.cwd()` at build), either separator.
14
+ *
15
+ * @internal Exported for the plugin and unit tests.
16
+ */
17
+ export declare function remote_hash_of(module_id: string, cwd: string): string | null;
18
+ /**
19
+ * From a client `generateBundle` output, collect transitive static `imports` for each
20
+ * `og-region.<id>.js` facade. Keys/values are public URLs (`/_app/immutable/…`).
21
+ * Used so SSR can `modulepreload` hashed dependency chunks for `hydrate: 'load'` islands
22
+ * (Vite’s auto graph does not apply to `@vite-ignore` `import(entry)`).
23
+ *
24
+ * @internal Exported for unit tests.
25
+ */
26
+ export declare function collectIslandDepModulepreloads(bundle: Record<string, {
27
+ type: string;
28
+ fileName?: string;
29
+ imports?: string[];
30
+ dynamicImports?: string[];
31
+ /** The source module ids bundled into this chunk (Rollup/rolldown `OutputChunk`). */
32
+ moduleIds?: string[];
33
+ /** Vite/rolldown-vite chunk metadata — `importedCss` lists the CSS assets a chunk owns. */
34
+ viteMetadata?: {
35
+ importedCss?: Set<string> | string[];
36
+ };
37
+ }>, page_reader_files?: readonly string[], remote_hash?: ((module_id: string) => string | null) | null, page_keys_of?: ((module_id: string) => PageKeys | null) | null, read_source?: ((id: string) => string | null) | null, runtime_file?: string | null, entries?: {
38
+ islands: ReadonlyMap<string, string>;
39
+ runtime: string | null;
40
+ } | null): {
41
+ js: Record<string, string[]>;
42
+ css: Record<string, string[]>;
43
+ page: Record<string, boolean>;
44
+ page_keys: Record<string, string[] | null>;
45
+ remotes: Record<string, string[]>;
46
+ interactivity: Record<string, IslandInteractivityFacts>;
47
+ /** each island's components' lines that draw differently in the browser (hydration-hazards.ts),
48
+ * by entry — the app's own and the site kit's (ogygia's content components); not other packages */
49
+ hazards: Record<string, IslandHazard[]>;
50
+ /** what is inside each chunk an island pulls: a readable source list per public href */
51
+ contents: Record<string, string[]>;
52
+ /** each chunk's heaviest named modules with their rendered bytes (a package sums its modules):
53
+ * what the report names as most of an island's code. Apart from `contents`, which stays names
54
+ * only (a chunk's identity across builds) */
55
+ heavy: Record<string, ChunkHeavy>;
56
+ /** modules the build shipped as two copies (one package file by two paths), each copy's chunk */
57
+ dupes: DuplicateModule[];
58
+ };
59
+ /** One module the build shipped as two (or more) copies: the same file of a package reached by two
60
+ * paths (its source and its build, two versions in node_modules), each copy in its chunk. */
61
+ export interface DuplicateModule {
62
+ /** the module, package-relative (`ogygia/runtime/beacon`, `svelte/internal/client/index`) */
63
+ name: string;
64
+ /** `from`: where the copy came from — the package's folder (`ogygia/src`, `ogygia/dist`) or its
65
+ * installed version (`svelte@5.56.8`) — the two paths, told apart */
66
+ copies: {
67
+ file: string;
68
+ bytes: number;
69
+ from?: string;
70
+ }[];
71
+ }
72
+ /** Where a module id's copy came from: an installed package's version (`name@1.2.3`, from a pnpm
73
+ * store path), else the package's top folder (`name/src`, `name/dist`). */
74
+ export declare function module_origin(id: string): string | undefined;
75
+ /** A module id as the file of its package, the build-or-source folder and the extension left out:
76
+ * two ids with one key are one module twice. Null for ids that are no file (virtual, `\0`). */
77
+ export declare function module_key(id: string): string | null;
78
+ /** Every module the build shipped more than once: one key, two or more ids (a single id is in one
79
+ * chunk only). The heaviest first, copies of 512 bytes or more, at most 50.
80
+ * @internal exported for the tests */
81
+ export declare function duplicate_modules(chunks: readonly {
82
+ file: string;
83
+ ids: readonly string[];
84
+ size_of?: (id: string) => number;
85
+ }[]): DuplicateModule[];
86
+ /** A chunk's rendered size and its heaviest named modules. */
87
+ export interface ChunkHeavy {
88
+ /** every module's rendered bytes in the chunk */
89
+ total: number;
90
+ /** the five heaviest, by the names `contents` uses (a package's modules summed) */
91
+ top: {
92
+ name: string;
93
+ bytes: number;
94
+ }[];
95
+ }
96
+ /** A chunk's modules as readable names (the same names `contents` uses) with their rendered bytes,
97
+ * heaviest first, the five heaviest; a package's modules summed under its name.
98
+ * @internal exported for the tests */
99
+ export declare function chunk_module_bytes(module_ids: readonly string[], size_of: (id: string) => number): ChunkHeavy;
100
+ /**
101
+ * A chunk's source modules as a short readable list: the app's own files first (relative to
102
+ * `src/`), then the packages, the framework runtimes named plainly. Capped; the tail is "+N more".
103
+ * @internal exported for the tests
104
+ */
105
+ export declare function summarize_chunk_contents(module_ids: readonly string[], max_files?: number, max_pkgs?: number, size_of?: (id: string) => number): string[];
106
+ /** What an island's components do (the wake advisor's evidence) — see `interactivity_facts`. */
107
+ export interface IslandInteractivityFacts {
108
+ handlers: number;
109
+ state: number;
110
+ effects: number;
111
+ binds: number;
112
+ actions: number;
113
+ /** remote modules its closure can call (set per island from the remotes scan) */
114
+ remotes?: number;
115
+ /** `{await …}` / `{#await …}` in its markup: a value that lands after it wakes */
116
+ awaits?: number;
117
+ /** context reads and rune-module imports: state another island can change */
118
+ shared?: number;
119
+ files: number;
120
+ }
121
+ /** Count a component source's interactivity markers. */
122
+ export declare function interactivity_facts(src: string): IslandInteractivityFacts;
123
+ /** Stable handoff path under Kit's `outDir`: client `generateBundle` writes; SSR reads at render
124
+ * (Kit is SSR-first). */
125
+ export declare function islandDepsHandoffPath(out_dir: string): string;
126
+ /**
127
+ * INLINE REGION CSS. For every region CSS asset (`hrefs`: the union of the handoff's `css` and
128
+ * `content_css` lists) whose bytes are under `threshold` — Kit's `inlineStyleThreshold`, the same
129
+ * number Kit inlines its own route sheets under — keep the asset's text, keyed by its public href.
130
+ * The render then emits `<style data-ogygia-region-css="href">` in place of a blocking `<link>`:
131
+ * a page carrying twenty-five small island sheets (42 KB on a measured home page, twenty of them
132
+ * under 3 KB) stops paying twenty-five requests before first paint. `0` = keep nothing (Kit's
133
+ * default: never inline). Above the threshold, or not an emitted asset, → not in the map → linked.
134
+ *
135
+ * @internal Exported for unit tests.
136
+ */
137
+ export declare function collect_inline_css(bundle: Record<string, {
138
+ type: string;
139
+ fileName?: string;
140
+ source?: string | Uint8Array;
141
+ }>, hrefs: Iterable<string>, threshold: number): Record<string, string>;
142
+ export declare function island_deps_module(ssr: boolean, is_dev: boolean, out_dir_rel?: string): string;