@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,7 @@
1
+ import { KitDirs } from "../compiler/kit.js";
2
+ /** The plugin list as a Vite config holds it: plugins, arrays of them, promises of either, falsy. */
3
+ type PluginOption = unknown;
4
+ /** Resolve `{ routes_dir, out_dir }` for `root` from its Kit config (defaults when absent or
5
+ * unreadable) and cache it for the compiler. `plugins`: the Vite config's plugin list. */
6
+ export declare function load_kit_dirs(root: string, plugins?: PluginOption): Promise<KitDirs>;
7
+ export {};
@@ -0,0 +1,67 @@
1
+ import { DEFAULT_KIT_DIRS, set_kit_dirs, set_kit_inline_style_threshold } from "../compiler/kit.js";
2
+ import { existsSync } from "node:fs";
3
+ import path from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ // src/vite/kit-dirs.ts
6
+ /**
7
+ * Kit's two configurable directories, read from the app's Kit config: `files.routes` (default
8
+ * `src/routes`) and `outDir` (default `.svelte-kit`). ogygia scans the routes tree (csr worlds, the
9
+ * client-build keepalive, route options) and writes/reads its island-deps handoff under Kit's output
10
+ * dir — every one of those must follow the app's configuration, not the defaults (an app building
11
+ * two route trees from one source, `PES_MODE=v2 → src/routes-v2` + `.svelte-kit-v2`, had its
12
+ * all-csr=false tree read as "no routes": Kit skipped the client build, the runtime chunk was never
13
+ * emitted, every island 404'd).
14
+ *
15
+ * WHERE THE CONFIG IS. Kit's own plugin carries its validated config (`vite-plugin-sveltekit-setup`'s
16
+ * `api.options`): on Kit 2 the svelte config, Kit's options under `kit`; on Kit 3, which takes its
17
+ * config in `vite.config.js` only (a `svelte.config.js` is an error there), Kit's options at the top.
18
+ * Read from there first; a Kit 2 app's `svelte.config.js` file is the fallback.
19
+ *
20
+ * Loaded once per root in the plugin's `config` hook (before Kit reads the routes); the compiler
21
+ * reads the cached answer through `kit_dirs(root)` in compiler/kit.ts. Node-only (imports the
22
+ * config module) — that is why it lives on the Vite side, not in the host-neutral compiler.
23
+ */
24
+ const CONFIG_FILES = ["svelte.config.js", "svelte.config.mjs"];
25
+ /** Every plugin in `option`, flattened (arrays nest; `sveltekit()` is a promise on Kit 3). */
26
+ async function flatten_plugins(option) {
27
+ const out = [];
28
+ const walk = async (p) => {
29
+ const v = await p;
30
+ if (!v) return;
31
+ if (Array.isArray(v)) for (const x of v) await walk(x);
32
+ else if (typeof v === "object") out.push(v);
33
+ };
34
+ await walk(option);
35
+ return out;
36
+ }
37
+ /** Kit's options off its setup plugin: Kit 3's at the top of its config, Kit 2's under `kit`. */
38
+ async function kit_options_from_plugins(plugins) {
39
+ const options = ((await flatten_plugins(plugins)).find((p) => p.name === "vite-plugin-sveltekit-setup")?.api)?.options;
40
+ if (!options) return null;
41
+ return options.kit ?? options;
42
+ }
43
+ /** Kit's options from a Kit 2 app's `svelte.config.js` (null when there is none). */
44
+ async function kit_options_from_file(root) {
45
+ const file = CONFIG_FILES.map((f) => path.join(root, f)).find((f) => existsSync(f));
46
+ if (!file) return null;
47
+ try {
48
+ return (await import(pathToFileURL(file).href)).default?.kit ?? {};
49
+ } catch (e) {
50
+ console.warn(`[ogygia] could not read ${path.relative(root, file)} for kit.files.routes / kit.outDir — using the defaults (${DEFAULT_KIT_DIRS.routes}, ${DEFAULT_KIT_DIRS.out}). ${e instanceof Error ? e.message : String(e)}`);
51
+ return null;
52
+ }
53
+ }
54
+ /** Resolve `{ routes_dir, out_dir }` for `root` from its Kit config (defaults when absent or
55
+ * unreadable) and cache it for the compiler. `plugins`: the Vite config's plugin list. */
56
+ async function load_kit_dirs(root, plugins) {
57
+ const kit = await kit_options_from_plugins(plugins) ?? await kit_options_from_file(root) ?? {};
58
+ const dirs = {
59
+ routes_dir: path.resolve(root, kit.files?.routes ?? DEFAULT_KIT_DIRS.routes),
60
+ out_dir: path.resolve(root, kit.outDir ?? DEFAULT_KIT_DIRS.out)
61
+ };
62
+ set_kit_dirs(root, dirs);
63
+ const threshold = kit.inlineStyleThreshold;
64
+ set_kit_inline_style_threshold(root, typeof threshold === "number" && Number.isFinite(threshold) && threshold > 0 ? threshold : 0);
65
+ return dirs;
66
+ }
67
+ export { load_kit_dirs };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * ASYNC TWINS: what Region imports where the app runs Svelte's async mode. A render that can WAIT does
3
+ * better than one that cannot, and only async mode lets a component `await` — without it an `await`
4
+ * does not compile. So each such component ships as a pair: the file Region imports (works anywhere)
5
+ * and its awaiting twin, which the plugin points that import at for an app with async mode on.
6
+ *
7
+ * - LateIsland → LateIslandAwait: an inline island a Kit client navigation created has no component
8
+ * yet; the twin awaits its load, so the navigation's update batch waits and Kit keeps the old page
9
+ * until the whole new one is in (without it: an empty place, then the island).
10
+ * - PromiseRegion → PromiseRegionAwait: a `<Region of={promise}>` — the twin awaits the promise IN the
11
+ * server render (Kit seeds a remote query's result, hydration awaits the same value), so the page
12
+ * arrives with the region in it; without it the server renders the placeholder and the browser
13
+ * resolves the promise after hydration.
14
+ */
15
+ /** Region's twin imports: the file it imports → its awaiting twin (beside it). */
16
+ export declare const ASYNC_TWINS: Readonly<Record<string, string>>;
17
+ /** Does the app compile with Svelte's async mode? Read off vite-plugin-svelte's resolved options (its
18
+ * config plugin publishes them as `api.options`, resolved before any plugin's own configResolved). */
19
+ export declare function svelte_async_enabled(plugins: readonly {
20
+ name?: string;
21
+ api?: unknown;
22
+ }[] | undefined): boolean;
23
+ /** The awaiting twin a Region twin import resolves to in an app with async mode on (beside Region,
24
+ * whichever copy imported it), or null for any other import. */
25
+ export declare function async_twin_redirect(source: string, importer: string | undefined, region_modules: ReadonlySet<string>): string | null;
@@ -0,0 +1,33 @@
1
+ // src/vite/late-island.ts
2
+ /**
3
+ * ASYNC TWINS: what Region imports where the app runs Svelte's async mode. A render that can WAIT does
4
+ * better than one that cannot, and only async mode lets a component `await` — without it an `await`
5
+ * does not compile. So each such component ships as a pair: the file Region imports (works anywhere)
6
+ * and its awaiting twin, which the plugin points that import at for an app with async mode on.
7
+ *
8
+ * - LateIsland → LateIslandAwait: an inline island a Kit client navigation created has no component
9
+ * yet; the twin awaits its load, so the navigation's update batch waits and Kit keeps the old page
10
+ * until the whole new one is in (without it: an empty place, then the island).
11
+ * - PromiseRegion → PromiseRegionAwait: a `<Region of={promise}>` — the twin awaits the promise IN the
12
+ * server render (Kit seeds a remote query's result, hydration awaits the same value), so the page
13
+ * arrives with the region in it; without it the server renders the placeholder and the browser
14
+ * resolves the promise after hydration.
15
+ */
16
+ /** Region's twin imports: the file it imports → its awaiting twin (beside it). */
17
+ const ASYNC_TWINS = {
18
+ "./LateIsland.svelte": "LateIslandAwait.svelte",
19
+ "./PromiseRegion.svelte": "PromiseRegionAwait.svelte"
20
+ };
21
+ /** Does the app compile with Svelte's async mode? Read off vite-plugin-svelte's resolved options (its
22
+ * config plugin publishes them as `api.options`, resolved before any plugin's own configResolved). */
23
+ function svelte_async_enabled(plugins) {
24
+ return (plugins?.find((p) => p.name === "vite-plugin-svelte:config")?.api)?.options?.compilerOptions?.experimental?.async === true;
25
+ }
26
+ /** The awaiting twin a Region twin import resolves to in an app with async mode on (beside Region,
27
+ * whichever copy imported it), or null for any other import. */
28
+ function async_twin_redirect(source, importer, region_modules) {
29
+ const twin = ASYNC_TWINS[source];
30
+ if (!twin || !importer || !region_modules.has(importer)) return null;
31
+ return importer.slice(0, importer.lastIndexOf("/") + 1) + twin;
32
+ }
33
+ export { ASYNC_TWINS, async_twin_redirect, svelte_async_enabled };
@@ -0,0 +1,8 @@
1
+ export declare const MODULE_MAP_FILE = "ogygia-modules.json";
2
+ /** chunk file (relative to the output dir) → [first line, last line, module id relative to root] */
3
+ export type ModuleMap = {
4
+ v: 1;
5
+ chunks: Record<string, [number, number, string][]>;
6
+ };
7
+ export declare function build_module_map(bundle: Record<string, unknown>, root: string): ModuleMap;
8
+ export declare function write_module_map(dir: string, bundle: Record<string, unknown>, root: string): void;
@@ -0,0 +1,144 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ // src/vite/module-map.ts
4
+ /**
5
+ * THE MODULE MAP: for each server chunk, which source module's code sits at which lines — written
6
+ * once per server build, beside the chunks (`ogygia-modules.json`), so it travels with them to
7
+ * whatever host runs the build. A build without sourcemaps (the normal one) leaves the profiler
8
+ * only chunk names; with this it still tells its own code, ogygia's runtime and a bundled package's
9
+ * from the app's (profiler/module-map.ts reads it).
10
+ */
11
+ const MODULE_MAP_FILE = "ogygia-modules.json";
12
+ function count_lines(s, from, to) {
13
+ let n = 0;
14
+ for (let i = from; i < to; i++) if (s.charCodeAt(i) === 10) n++;
15
+ return n;
16
+ }
17
+ /** where a module's code starts in the chunk, found by its first line of real code (24+ characters,
18
+ * not an import / export-from / comment) and counted back to the module's first line: the chunk
19
+ * offset of that start, or -1. Lines before the anchor that the bundler dropped (the imports) make
20
+ * the start land a little early, never inside the previous module's own code by more than those */
21
+ function by_solid_line(chunk, code, cursor) {
22
+ const lines = code.split("\n");
23
+ const dropped_line = (t) => t.startsWith("import ") || t.startsWith("export ") && t.includes(" from ");
24
+ for (let i = 0; i < lines.length && i < 80; i++) {
25
+ const l = lines[i].trim();
26
+ if (l.length < 24 || dropped_line(l) || l.startsWith("//") || l.startsWith("/*") || l.startsWith("*")) continue;
27
+ let at = chunk.indexOf(l, cursor);
28
+ if (at === -1) at = chunk.indexOf(l);
29
+ if (at === -1) continue;
30
+ let start = chunk.lastIndexOf("\n", at - 1) + 1;
31
+ let kept = 0;
32
+ let dropped = 0;
33
+ for (let j = 0; j < i; j++) if (dropped_line(lines[j].trim())) dropped++;
34
+ else kept++;
35
+ for (let k = 0; k < kept && start > 0; k++) start = chunk.lastIndexOf("\n", start - 2) + 1;
36
+ for (let j = i + 1; j < lines.length; j++) if (dropped_line(lines[j].trim())) dropped++;
37
+ return {
38
+ at: start,
39
+ dropped
40
+ };
41
+ }
42
+ }
43
+ /** a module id as the map keeps it: relative to the root, a package from its `node_modules/` */
44
+ function clean_id(id, root) {
45
+ const q = id.indexOf("?");
46
+ const clean = (q === -1 ? id : id.slice(0, q)).replace(/^\0/, "");
47
+ const rel = path.isAbsolute(clean) ? path.relative(root, clean).split(path.sep).join("/") : clean;
48
+ const nm = rel.lastIndexOf("node_modules/");
49
+ return nm === -1 ? rel : rel.slice(nm);
50
+ }
51
+ /** THE BUNDLER'S OWN MARKERS: rolldown writes `//#region <module>` … `//#endregion` around each
52
+ * module's code — exact lines, no guessing. Undefined when the chunk has none (another bundler) */
53
+ function by_regions(code, root) {
54
+ if (!code.includes("\n//#region ") && !code.startsWith("//#region ")) return void 0;
55
+ const out = [];
56
+ let line = 1;
57
+ const open = [];
58
+ const names_module = (id) => id.includes("/") || id.includes("\\") || id.includes(":") || /\.[a-z]+$/i.test(id);
59
+ for (let i = 0; i <= code.length;) {
60
+ const nl = code.indexOf("\n", i);
61
+ const end = nl === -1 ? code.length : nl;
62
+ if (code.startsWith("//#region ", i)) {
63
+ const id = code.slice(i + 10, end).trim();
64
+ open.push({
65
+ start: line + 1,
66
+ id,
67
+ module: names_module(id)
68
+ });
69
+ } else if (code.startsWith("//#endregion", i) && open.length) {
70
+ const top = open.pop();
71
+ if (top.module) {
72
+ let id = top.id;
73
+ while (id.startsWith("../")) id = id.slice(3);
74
+ if (line - 1 >= top.start) out.push([
75
+ top.start,
76
+ line - 1,
77
+ clean_id(id, root)
78
+ ]);
79
+ }
80
+ }
81
+ if (nl === -1) break;
82
+ i = nl + 1;
83
+ line++;
84
+ }
85
+ return out.length ? out : void 0;
86
+ }
87
+ function build_module_map(bundle, root) {
88
+ const chunks = {};
89
+ for (const item of Object.values(bundle)) {
90
+ const c = item;
91
+ if (c.type !== "chunk" || !c.fileName || !c.code || !c.modules) continue;
92
+ const marked = by_regions(c.code, root);
93
+ if (marked) {
94
+ chunks[c.fileName] = marked;
95
+ continue;
96
+ }
97
+ const out = [];
98
+ let cursor = 0;
99
+ let line = 1;
100
+ for (const [id, m] of Object.entries(c.modules)) {
101
+ if (!m.code) continue;
102
+ const head = m.code.slice(0, Math.min(m.code.length, 120));
103
+ let at = c.code.indexOf(head, cursor);
104
+ if (at === -1) at = c.code.indexOf(head);
105
+ let dropped = 0;
106
+ if (at === -1) {
107
+ const found = by_solid_line(c.code, m.code, cursor);
108
+ if (!found) continue;
109
+ at = found.at;
110
+ dropped = found.dropped;
111
+ }
112
+ const start = at >= cursor ? line + count_lines(c.code, cursor, at) : 1 + count_lines(c.code, 0, at);
113
+ const span = Math.max(1, count_lines(m.code, 0, m.code.length) - dropped);
114
+ const end = start + span - (m.code.endsWith("\n") ? 1 : 0);
115
+ const q = id.indexOf("?");
116
+ const clean = (q === -1 ? id : id.slice(0, q)).replace(/^\0/, "");
117
+ const rel = path.isAbsolute(clean) ? path.relative(root, clean).split(path.sep).join("/") : clean;
118
+ const nm = rel.lastIndexOf("node_modules/");
119
+ out.push([
120
+ start,
121
+ end,
122
+ nm === -1 ? rel : rel.slice(nm)
123
+ ]);
124
+ if (at >= cursor) {
125
+ line = start + span;
126
+ let p = at - 1;
127
+ for (let k = 0; k < span && p !== -1; k++) p = c.code.indexOf("\n", p + 1);
128
+ cursor = p === -1 ? c.code.length : p + 1;
129
+ }
130
+ }
131
+ out.sort((x, y) => x[0] - y[0]);
132
+ for (let i = 0; i + 1 < out.length; i++) if (out[i][1] >= out[i + 1][0]) out[i][1] = out[i + 1][0] - 1;
133
+ if (out.length) chunks[c.fileName] = out;
134
+ }
135
+ return {
136
+ v: 1,
137
+ chunks
138
+ };
139
+ }
140
+ function write_module_map(dir, bundle, root) {
141
+ const map = build_module_map(bundle, root);
142
+ if (Object.keys(map.chunks).length) fs.writeFileSync(path.join(dir, MODULE_MAP_FILE), JSON.stringify(map));
143
+ }
144
+ export { MODULE_MAP_FILE, build_module_map, write_module_map };
@@ -0,0 +1,208 @@
1
+ import { ImportKeys } from "../compiler/region/transform.js";
2
+ import { DebarrelOptions } from "../compiler/debarrel/options.js";
3
+ /**
4
+ * Named strategy bundle referenced from source via `with { preset: 'name' }`
5
+ * (or the renamed `importKeys.preset` key).
6
+ *
7
+ * A preset speaks the SAME grammar as an inline import: a `render` mode with its timing (`fetch` for
8
+ * a `deferred` hole, `wake` for an island), plus the tuning options that aren't allowed inline
9
+ * (`margin`, `maxAge`, …).
10
+ */
11
+ export interface OgygiaPreset {
12
+ /**
13
+ * Delivery mode (the `render` import attribute): `'static'` (default — an island that hydrates)
14
+ * | `'deferred'` (a hole whose HTML is fetched, on its `fetch` timing) | `'live'` (a hole that
15
+ * revalidates).
16
+ */
17
+ render?: "static" | "deferred" | "live";
18
+ /**
19
+ * When an island's JS runs (the `wake` import attribute): `'load'` | `'idle'` | `'visible'` |
20
+ * `'interaction'` | a CSS media query | `'none'` (a frozen lake). With `render: 'live'`, the
21
+ * revalidate schedule. Never a `deferred` hole's timing — that is `fetch`.
22
+ */
23
+ wake?: string;
24
+ /**
25
+ * A `render: 'deferred'` hole's timing — when its HTML arrives (the `fetch` import attribute):
26
+ * `'load'` (default) | `'idle'` | `'visible'` | `'interaction'` | a CSS media query.
27
+ */
28
+ fetch?: string;
29
+ /** `IntersectionObserver` `rootMargin` when the schedule is `'visible'`. */
30
+ margin?: string;
31
+ /**
32
+ * A hole (`fetch`) — response cache max-age for the hole's HTML: seconds (number) or a
33
+ * duration string (`'30s'` | `'5m'` | `'1h'`). Absent or `0` → `no-store`: the hole is dynamic,
34
+ * re-rendered on every request. A positive value opts into a `private, max-age` browser cache.
35
+ * Signed into the hole's endpoint so a harvested URL can't be re-pointed at a longer cache.
36
+ *
37
+ * With `render: 'live'` this is instead the client revalidate staleness — use a duration string
38
+ * to stay unit-explicit across both.
39
+ */
40
+ maxAge?: number | string;
41
+ /** `render: 'live'` — past `maxAge`, whether to clear the hole (`'empty'`) or refetch (`'fetch'`). */
42
+ onExpire?: "empty" | "fetch";
43
+ /**
44
+ * A hole (`fetch`) — warm the hole's HTML into the frame store on this schedule (`'load'` |
45
+ * `'idle'` | `'visible'` | a media query) while `fetch` still decides when it swaps in. An
46
+ * on-demand hole (`fetch: 'interaction'`) then has its bytes before the first hover: the gesture
47
+ * joins the warm frame instead of paying the origin round trip. Never `'interaction'` — that is
48
+ * the swap schedule, `fetch`'s job.
49
+ */
50
+ prefetch?: string;
51
+ /** `render: 'live'` — the revalidate schedule (`false` disables). Defaults to `wake`. */
52
+ revalidate?: false | string;
53
+ /** Continuity name (the `keep` import attribute): the live island relocates across SPA
54
+ * navigation instead of remounting when the next page carries the same name. */
55
+ keep?: string;
56
+ }
57
+ /** Per-IP budget for the signed deferred-region / lake-remount endpoint. */
58
+ export interface OgygiaRateLimit {
59
+ /** Max requests per window (default `60`). `0` disables allowing any. */
60
+ max?: number;
61
+ /** Sliding window length in milliseconds (default `60_000`). */
62
+ windowMs?: number;
63
+ }
64
+ /**
65
+ * Options for the {@link ogygia} Vite plugin. The root is the region system itself — its defaults
66
+ * (`visible`), its named presets (referenced from a use site by a LITERAL `preset: 'name'`:
67
+ * `import X from '…' with { preset: 'name' }`), its holes' capability lifetimes — beside the client
68
+ * router. Feature packages are Vite plugins listed beside it (`plugins: [ogygia(), flags(), sveltekit()]`).
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * import { ogygia } from 'ogygia/vite';
73
+ * export default defineConfig({
74
+ * plugins: [
75
+ * ogygia({
76
+ * visible: { margin: '200px' },
77
+ * presets: { chart: { wake: 'visible', margin: '200px' } },
78
+ * ttl: 3600
79
+ * }),
80
+ * sveltekit()
81
+ * ]
82
+ * });
83
+ * ```
84
+ */
85
+ export interface OgygiaOptions {
86
+ /**
87
+ * Defaults for regions that wake `'visible'` (`wake: 'visible'` / `render` + `wake: 'visible'`)
88
+ * without their own `margin` (via a preset).
89
+ */
90
+ visible?: {
91
+ /** Default `IntersectionObserver` `rootMargin` (e.g. `'200px'`). */
92
+ margin?: string;
93
+ };
94
+ /**
95
+ * Named strategy bundles. Reference one from an import:
96
+ * `import Chart from '$lib/Chart.svelte' with { preset: 'chart' };`
97
+ */
98
+ presets?: Record<string, OgygiaPreset>;
99
+ /**
100
+ * How long a deferred/live hole's signed capability URL stays valid, in seconds (default `3600`).
101
+ * Clamped to `[60, 86400]`. Keep short for harvested-URL risk. Holes outlive this automatically
102
+ * where they must: on prerendered and postrendered pages, and on a page a load marks shared-cacheable
103
+ * (`setHeaders({ 'cache-control': 'public, s-maxage=…' })`), where an anonymous hole is signed for
104
+ * the page's cache life; a hole on an older cached copy renews itself when it wakes.
105
+ */
106
+ ttl?: number;
107
+ /**
108
+ * The oldest a cached copy of a page can be and still get its holes, in seconds (default
109
+ * `691200`, 8 days). An anonymous hole whose capability expired while a cache kept its page
110
+ * renews itself for up to this long after that expiry; past it, the hole keeps its fallback.
111
+ * Raise it to the longest your CDN may serve a page when the page does not say so in its
112
+ * `cache-control`. `0` turns renewal off. Unlike `ttl` it never lengthens a hole URL's life (a
113
+ * renewed URL lives `ttl`), and a hole bound to a session never renews. A renewable URL replays its
114
+ * props: keep hole props to routing keys (a locale, a page), and read anything sensitive at render.
115
+ */
116
+ maxPageAge?: number;
117
+ /**
118
+ * Client-side SPA router — app-wide, on by default. It intercepts same-origin links, swaps
119
+ * `<body>`, merges `<head>`, and keeps `data-ogygia-keep` chrome across navigations. No component
120
+ * to place: the server handle injects the runtime + the `ogygia-router` meta into every page.
121
+ *
122
+ * - `true` (default) — router on, View Transitions on, form continuity on.
123
+ * - `false` — router off (the whole feature is tree-shaken out; same-origin links do full MPA
124
+ * loads, and form continuity — which rides SPA navigation — goes with it).
125
+ * - `{ viewTransitions: false }` — router on, but no View Transitions API on navigation.
126
+ * - `{ forms: false }` — router on, but an island's half-filled form fields are NOT carried
127
+ * across SPA navigation (continuity off).
128
+ * - `{ serverDelta: true }` — opt IN to server-delta nav: an SPA nav tells the server (via an
129
+ * `x-ogygia-known` header) which islands it already has live, so the server SKIPS re-rendering
130
+ * the unchanged ones and the client keeps them running. OFF by default (it is a new client↔server
131
+ * protocol); when off the client never sends the header and the server always full-renders.
132
+ *
133
+ * Per-page escape hatch (no second config): a page opts *itself* out of View Transitions by
134
+ * emitting `<svelte:head><meta name="ogygia-router" content="plain" /></svelte:head>` — the handle
135
+ * injects the app default but a page that sets its own meta wins.
136
+ */
137
+ router?: boolean | {
138
+ viewTransitions?: boolean;
139
+ forms?: boolean;
140
+ serverDelta?: boolean;
141
+ };
142
+ /**
143
+ * Rename the import-attribute keys claimed by the transform.
144
+ * Defaults stay `hydrate` / `defer` / `preset`. Escape hatch if another tool already
145
+ * uses those names on the same imports.
146
+ *
147
+ * Preset **definitions** ({@link OgygiaOptions.presets}) still use canonical `hydrate` /
148
+ * `defer` / `margin` / `remount` — only the `with { … }` spellings in source change.
149
+ */
150
+ importKeys?: Partial<ImportKeys>;
151
+ /**
152
+ * Per-IP budget for the signed island endpoint served by `ogygiaHandle()`.
153
+ * Default `{ max: 60, windowMs: 60_000 }`. Pass `false` to disable.
154
+ */
155
+ rateLimit?: false | OgygiaRateLimit;
156
+ /**
157
+ * Cookie name to seal into the region MAC (opt-in). Empty/prerender stays unbound.
158
+ * Harvested capability URLs then fail verification without that cookie.
159
+ * Default `false` (unbound).
160
+ */
161
+ sessionCookie?: false | string;
162
+ /**
163
+ * Barrel imports become leaf imports at transform time — `import { Button } from '$lib'` (an
164
+ * `index.ts` that re-exports forty files) becomes `import Button from '…/Button.svelte'`, so the
165
+ * module graph (dev) and the chunk graph (build) hold only the leaves a file uses.
166
+ *
167
+ * - `true` — every PURE barrel in the project (outside `node_modules`) is bypassed.
168
+ * - `{ packages, force, keep, … }` — opt dependencies in, force impure barrels, keep some.
169
+ *
170
+ * Independent of islands: an import that carries region marks (`with { wake }` …) is never
171
+ * rewritten — a barrel binding is marked through `asRegion` or a mark in the barrel, as before.
172
+ * The same plugin is `debarrel()` from `'ogygia/vite'` for any Vite app.
173
+ */
174
+ barrels?: boolean | DebarrelOptions;
175
+ /**
176
+ * @internal Recreate this plugin instance inside the standalone client build.
177
+ * App authors should not set this.
178
+ */
179
+ standalone?: boolean;
180
+ }
181
+ /** The rename map: a legacy key errors with its new spelling, never silently no-ops. */
182
+ export declare function assert_no_legacy_options(options: OgygiaOptions): void;
183
+ /**
184
+ * Config-time region-preset validation — the transform re-checks on USE (with file/line context), but
185
+ * a broken preset nobody references yet should still fail the build, not lurk.
186
+ */
187
+ export declare function validate_region_presets(presets: Record<string, unknown>): void;
188
+ /** The router/capability config resolved from `OgygiaOptions` — pure derivation the factory reads. */
189
+ export interface ResolvedOgygiaConfig {
190
+ rate_limit: {
191
+ max: number;
192
+ windowMs: number;
193
+ };
194
+ session_cookie: string;
195
+ region_ttl: number;
196
+ renew_window: number;
197
+ router_enabled: boolean;
198
+ router_view_transitions: boolean;
199
+ continuity_forms: boolean;
200
+ server_delta: boolean;
201
+ }
202
+ /**
203
+ * Normalize the router / rate-limit / session / ttl / continuity / server-delta options into the flat
204
+ * config the factory threads into `CompileCtx` + `Program`. Pure — no defaults leak back into `options`.
205
+ * `defaultRegionTtl` / `defaultRenewWindow` are passed in (the endpoint's DEFAULT_REGION_TTL_SEC,
206
+ * shared-cache's RENEW_WINDOW_SEC) to keep this Vite-free.
207
+ */
208
+ export declare function resolve_options(options: OgygiaOptions, defaultRegionTtl: number, defaultRenewWindow?: number): ResolvedOgygiaConfig;
@@ -0,0 +1,74 @@
1
+ // src/vite/options.ts
2
+ /**
3
+ * Retired option spellings. Detected at config load and answered with the exact new spelling — a
4
+ * rename map, never silent aliasing (a legacy key that silently did nothing would un-tune real apps).
5
+ */
6
+ const LEGACY_OPTION_RENAMES = {
7
+ regions: "`regions` is gone — its keys sit at the root now: write `visible`, `presets`, `ttl` and `maxPageAge` directly in `ogygia({ … })`.",
8
+ continuity: "`continuity` is gone — form continuity rides the router. Write `router: { forms: false }` to disable it.",
9
+ regionTtl: "`regionTtl` is `ttl` now — write `ogygia({ ttl: … })`.",
10
+ preload: "`preload` is gone — there is nothing to choose any more. The page carries each island’s chunk list as data, and the runtime preloads an island’s whole graph when it wakes (after the page has painted), so no island code moves before its wake and none waits on a waterfall after it. Remove the key.",
11
+ plugins: "`plugins` is gone — ogygia plugins are Vite plugins: list them beside `ogygia()` in vite.config, `plugins: [ogygia(), flags(), sveltekit()]`.",
12
+ freeze: "`freeze` is a plugin now, named postrender — install `@ogygia/postrender` and list `postrender({ ttl, default })` (from `@ogygia/postrender/vite`) beside `ogygia()` in vite.config `plugins`.",
13
+ content: "`content` is a plugin now — install `@ogygia/content` and list `content({ markdown, presets })` (from `@ogygia/content/vite`) beside `ogygia()` in vite.config `plugins`; the svelte config takes `preprocess()` / `extensions()` from there too.",
14
+ devtools: "`devtools` is a plugin now — install `@ogygia/devtools` and list `devtools()` (from `@ogygia/devtools/vite`) beside `ogygia()` in vite.config `plugins`; only where you want it, e.g. `...(mode !== 'production' ? [devtools()] : [])`.",
15
+ profiler: "`profiler` is part of the devtools plugin now — install `@ogygia/devtools` and list `devtools({ profiler: { … } })` (from `@ogygia/devtools/vite`) beside `ogygia()` in vite.config `plugins`."
16
+ };
17
+ /** The rename map: a legacy key errors with its new spelling, never silently no-ops. */
18
+ function assert_no_legacy_options(options) {
19
+ for (const key of Object.keys(LEGACY_OPTION_RENAMES)) if (key in options) throw new Error(`[ogygia] ${LEGACY_OPTION_RENAMES[key]}`);
20
+ }
21
+ const REGION_PRESET_KEYS = /* @__PURE__ */ new Set([
22
+ "render",
23
+ "wake",
24
+ "fetch",
25
+ "margin",
26
+ "maxAge",
27
+ "onExpire",
28
+ "revalidate",
29
+ "keep",
30
+ "stitch",
31
+ "prefetch"
32
+ ]);
33
+ /**
34
+ * Config-time region-preset validation — the transform re-checks on USE (with file/line context), but
35
+ * a broken preset nobody references yet should still fail the build, not lurk.
36
+ */
37
+ function validate_region_presets(presets) {
38
+ for (const [name, bag] of Object.entries(presets)) {
39
+ if (!bag || typeof bag !== "object" || Object.keys(bag).length === 0) throw new Error(`[ogygia] presets.${name} is empty — a preset with nothing is a mistake.`);
40
+ for (const k of Object.keys(bag)) if (!REGION_PRESET_KEYS.has(k)) throw new Error(`[ogygia] presets.${name}: unknown key \`${k}\`. A preset takes ${[...REGION_PRESET_KEYS].join(", ")}.`);
41
+ }
42
+ }
43
+ /**
44
+ * Normalize the router / rate-limit / session / ttl / continuity / server-delta options into the flat
45
+ * config the factory threads into `CompileCtx` + `Program`. Pure — no defaults leak back into `options`.
46
+ * `defaultRegionTtl` / `defaultRenewWindow` are passed in (the endpoint's DEFAULT_REGION_TTL_SEC,
47
+ * shared-cache's RENEW_WINDOW_SEC) to keep this Vite-free.
48
+ */
49
+ function resolve_options(options, defaultRegionTtl, defaultRenewWindow = 691200) {
50
+ const rate_limit = options.rateLimit === false ? {
51
+ max: 0,
52
+ windowMs: 6e4
53
+ } : {
54
+ max: Math.max(0, options.rateLimit?.max ?? 60),
55
+ windowMs: Math.max(1, options.rateLimit?.windowMs ?? 6e4)
56
+ };
57
+ const session_cookie = typeof options.sessionCookie === "string" && options.sessionCookie.length > 0 ? options.sessionCookie : "";
58
+ const region_ttl = Math.min(86400, Math.max(60, Math.floor(options.ttl ?? defaultRegionTtl)));
59
+ const renew_raw = options.maxPageAge;
60
+ if (renew_raw !== void 0 && !(typeof renew_raw === "number" && Number.isFinite(renew_raw) && renew_raw >= 0)) throw new Error(`[ogygia] maxPageAge must be a number of seconds ≥ 0 (got ${String(renew_raw)}). Write e.g. \`30 * 24 * 3600\` for 30 days, or \`0\` to turn renewal off.`);
61
+ const renew_window = Math.min(31536e4, Math.floor(renew_raw ?? defaultRenewWindow));
62
+ const router_enabled = options.router !== false;
63
+ return {
64
+ rate_limit,
65
+ session_cookie,
66
+ region_ttl,
67
+ renew_window,
68
+ router_enabled,
69
+ router_view_transitions: options.router === false ? false : typeof options.router === "object" ? options.router.viewTransitions !== false : true,
70
+ continuity_forms: router_enabled && (typeof options.router === "object" ? options.router.forms !== false : true),
71
+ server_delta: router_enabled && typeof options.router === "object" && options.router.serverDelta === true
72
+ };
73
+ }
74
+ export { assert_no_legacy_options, resolve_options, validate_region_presets };
@@ -0,0 +1,3 @@
1
+ import { PackageScan } from "../compiler/ctx.js";
2
+ export declare function discover_package_files(app_root: string): PackageScan[];
3
+ export type { PackageScan };
@@ -0,0 +1,84 @@
1
+ import { OWN_PACKAGE_NAMES } from "../own-package.js";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { globSync } from "tinyglobby";
5
+ // src/vite/package-files.ts
6
+ /**
7
+ * `ogygia.files` — a dependency package DECLARES its ogygia compile surface in its OWN
8
+ * package.json, npm-`files`-style (bare dirs recurse, globs allowed):
9
+ *
10
+ * { "ogygia": { "files": ["./src/components", "./src/admin-routes.ts", "./dist/**\/*.js"] } }
11
+ *
12
+ * Only declared packages are ever scanned — walking every dependency would be slow AND wrong —
13
+ * and only their declared paths. The consumer configures NOTHING: discovery reads the app's
14
+ * direct dependencies' manifests (a handful of tiny file reads), and the plugin turns each
15
+ * declaration into ssr.noExternal + optimizeDeps.exclude + prescan roots + transform gates.
16
+ *
17
+ * Everything is realpath'd: Vite resolves module ids through symlinks (pnpm), so gate matching
18
+ * must speak real paths or every check silently misses.
19
+ */
20
+ const posix = (p) => p.split(path.sep).join("/");
21
+ /** npm-glob magic — a bare path is stat'd, anything magic goes through the glob expander. */
22
+ const GLOB_MAGIC_RE = /[*?{}[\]!]/;
23
+ function read_manifest(dir) {
24
+ try {
25
+ return JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8"));
26
+ } catch {
27
+ return null;
28
+ }
29
+ }
30
+ function discover_package_files(app_root) {
31
+ const app = read_manifest(app_root);
32
+ if (!app) return [];
33
+ const deps = [...Object.keys(app.dependencies ?? {}), ...Object.keys(app.devDependencies ?? {})];
34
+ const found = [];
35
+ for (const name of deps) {
36
+ if (OWN_PACKAGE_NAMES.includes(name)) continue;
37
+ const pkg_dir = path.join(app_root, "node_modules", ...name.split("/"));
38
+ const declared = (read_manifest(pkg_dir)?.ogygia)?.files;
39
+ if (declared == null) continue;
40
+ if (!Array.isArray(declared) || !declared.every((p) => typeof p === "string")) throw new Error(`[ogygia] ${name}: \`"ogygia": { "files": […] }\` must be an array of package-relative paths/globs (like npm's "files") — got ${JSON.stringify(declared)}.`);
41
+ let root;
42
+ try {
43
+ root = fs.realpathSync(pkg_dir);
44
+ } catch {
45
+ continue;
46
+ }
47
+ const dirs = [];
48
+ const files = /* @__PURE__ */ new Set();
49
+ for (const entry of declared) {
50
+ if (GLOB_MAGIC_RE.test(entry)) {
51
+ for (const m of globSync(entry, {
52
+ cwd: root,
53
+ absolute: true,
54
+ dot: false
55
+ })) {
56
+ if (!posix(m).startsWith(posix(root) + "/")) continue;
57
+ try {
58
+ files.add(posix(fs.realpathSync(m)));
59
+ } catch {}
60
+ }
61
+ continue;
62
+ }
63
+ const abs = path.resolve(root, entry);
64
+ if (abs !== root && !abs.startsWith(root + path.sep)) throw new Error(`[ogygia] ${name}: ogygia.files entry '${entry}' escapes the package.`);
65
+ let stat;
66
+ try {
67
+ stat = fs.statSync(abs);
68
+ } catch {
69
+ console.warn(`[ogygia] ${name}: ogygia.files entry '${entry}' does not exist — skipped.`);
70
+ continue;
71
+ }
72
+ if (stat.isDirectory()) dirs.push(posix(fs.realpathSync(abs)));
73
+ else files.add(posix(fs.realpathSync(abs)));
74
+ }
75
+ if (dirs.length || files.size) found.push({
76
+ name,
77
+ root: posix(root),
78
+ dirs,
79
+ files: [...files]
80
+ });
81
+ }
82
+ return found;
83
+ }
84
+ export { discover_package_files };