@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,45 @@
1
+ /** This package's root (the plugin runs from `dist/vite/`, so `../..` is the package root). A NATIVE
2
+ * path (backslashes on Windows): for the file system, never to compare against a module id. */
3
+ export declare const PKG_ROOT: string;
4
+ /** A native path as Vite writes module ids: symlinks resolved (pnpm), forward slashes (Windows). */
5
+ export declare function real_posix(p: string): string;
6
+ /** A native directory as the PREFIX of the module ids inside it: `real_posix` + one trailing `/`, so a
7
+ * `startsWith` never matches a sibling (`ogygia-x/`) and holds on Windows, where the native path has
8
+ * backslashes and Vite's ids do not. */
9
+ export declare function id_dir(p: string): string;
10
+ /** THE own-package test: every module id inside this package starts with this. Every check of "is
11
+ * this id ogygia's own file" compares against it, never against PKG_ROOT. */
12
+ export declare const PKG_ROOT_ID: string;
13
+ /** An island file as an `optimizeDeps.entries` pattern, or null for one of ogygia's OWN islands (the
14
+ * profiler UI): ogygia is in `optimizeDeps.exclude`, so the scanner can't resolve inside it, and one
15
+ * unresolved import fails the whole scan (nothing pre-bundles). Its client deps are named up front
16
+ * instead (the plugin's `dev_island_deps`). */
17
+ export declare function scan_entry_pattern(file: string, own_root?: string): string | null;
18
+ /** The two ogygia self-imports the transform injects into hosts / generated island modules. */
19
+ export declare const OGYGIA_INJECTED_IMPORTS: Set<string>;
20
+ /** ogygia's `Region.svelte` — either copy, as the POSIX id Vite hands the transform hook (a workspace
21
+ * can load the src one and the dist one both): its LateIsland import is the awaiting one where the
22
+ * app runs Svelte's async mode (late-island.ts). */
23
+ export declare const OGYGIA_REGION_MODULES: ReadonlySet<string>;
24
+ export declare const OGYGIA_INJECTED_FILES: Record<string, string>;
25
+ /** Client-side shims aliased for island modules (Kit's client runtime is absent under csr=false). */
26
+ export declare const APP_SHIMS: {
27
+ "$app/state": string;
28
+ "$app/stores": string;
29
+ "$app/navigation": string;
30
+ };
31
+ /** On-disk stub for `virtual:ogygia/client-binding-stub` (csr=false client hosts). */
32
+ export declare const CLIENT_BINDING_STUB_FILE: string;
33
+ export declare const STUB_CLIENT: string;
34
+ export declare const STUB_STATE: string;
35
+ export declare const STUB_PATHS: string;
36
+ export declare const KIT_REMOTE_CLIENT: RegExp;
37
+ export declare const KIT_REMOTE_STATE: RegExp;
38
+ /** Absolute path to real HMAC (SSR-only via `virtual:ogygia/sign`). */
39
+ export declare const HMAC_MODULE: string;
40
+ /** The prebuilt runtime dir the runtime chunk bundles (for `generateRuntimeEntrySource`). */
41
+ export declare const RUNTIME_DIR: string;
42
+ /** Absolute path to SSR region-endpoint helper (signed capability URLs). */
43
+ export declare const REGION_ENDPOINT_MODULE: string;
44
+ /** The runtime chunk's source-content hash (the immutable-filename base; feature hash rides on top). */
45
+ export declare const RUNTIME_HASH: string;
@@ -0,0 +1,112 @@
1
+ import crypto from "node:crypto";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ // src/vite/paths.ts
6
+ /**
7
+ * Package-internal path resolution for the Vite adapter — ogygia's OWN files, addressed head-on
8
+ * (never via `this.resolve`, which isn't portable off a synthetic importer). Split out of index.ts so
9
+ * the plugin file stays lean. Every path resolves relative to THIS module's URL; paths.js and index.js
10
+ * ship in the same `dist/vite/` directory, so `../…` resolves identically from either.
11
+ */
12
+ /** This package's root (the plugin runs from `dist/vite/`, so `../..` is the package root). A NATIVE
13
+ * path (backslashes on Windows): for the file system, never to compare against a module id. */
14
+ const PKG_ROOT = fileURLToPath(new URL("../..", import.meta.url));
15
+ /** Windows separators → posix. */
16
+ const WIN_SEP_RE = /\\/g;
17
+ /** A native path as Vite writes module ids: symlinks resolved (pnpm), forward slashes (Windows). */
18
+ function real_posix(p) {
19
+ try {
20
+ p = fs.realpathSync(p);
21
+ } catch {}
22
+ return p.replace(WIN_SEP_RE, "/");
23
+ }
24
+ /** A native directory as the PREFIX of the module ids inside it: `real_posix` + one trailing `/`, so a
25
+ * `startsWith` never matches a sibling (`ogygia-x/`) and holds on Windows, where the native path has
26
+ * backslashes and Vite's ids do not. */
27
+ function id_dir(p) {
28
+ const posix = real_posix(p);
29
+ return posix.endsWith("/") ? posix : posix + "/";
30
+ }
31
+ /** THE own-package test: every module id inside this package starts with this. Every check of "is
32
+ * this id ogygia's own file" compares against it, never against PKG_ROOT. */
33
+ const PKG_ROOT_ID = id_dir(PKG_ROOT);
34
+ const GLOB_META_RE = /[()[\]{}*?!]/g;
35
+ /** An island file as an `optimizeDeps.entries` pattern, or null for one of ogygia's OWN islands (the
36
+ * profiler UI): ogygia is in `optimizeDeps.exclude`, so the scanner can't resolve inside it, and one
37
+ * unresolved import fails the whole scan (nothing pre-bundles). Its client deps are named up front
38
+ * instead (the plugin's `dev_island_deps`). */
39
+ function scan_entry_pattern(file, own_root = PKG_ROOT_ID) {
40
+ const posix = real_posix(file);
41
+ return posix.startsWith(own_root) ? null : posix.replace(GLOB_META_RE, "\\$&");
42
+ }
43
+ /** The two ogygia self-imports the transform injects into hosts / generated island modules. */
44
+ const OGYGIA_INJECTED_IMPORTS = /* @__PURE__ */ new Set(["ogygia/internal", "ogygia/internal/server"]);
45
+ /**
46
+ * DIRECT paths to ogygia's OWN injected runtime entries, resolved WITHOUT `this.resolve`. The
47
+ * transform writes `ogygia/internal` / `ogygia/internal/server` into a host or a generated island
48
+ * module, and a host in a monorepo sub-package that doesn't depend on ogygia must still resolve them.
49
+ * `this.resolve` off a synthetic importer is NOT portable across bundler versions (returns null in
50
+ * vite@8, can THROW in rolldown-vite@7 — which aborts the whole hook), and `config.root` can be
51
+ * undefined on a throwaway Kit plugin instance — so we address ogygia's own files head-on instead.
52
+ *
53
+ * A published install ships only `dist` → `dist/internal.js`. ogygia's OWN source checkout has `src/`,
54
+ * and the rest of the app resolves ogygia through the `svelte` export condition (→ `src`), so there we
55
+ * point at `src/internal.ts` too — same module, no Region/brand identity fork.
56
+ */
57
+ const OG_HAS_SRC = fs.existsSync(path.join(PKG_ROOT, "src/internal.ts"));
58
+ /** ogygia's `Region.svelte` — either copy, as the POSIX id Vite hands the transform hook (a workspace
59
+ * can load the src one and the dist one both): its LateIsland import is the awaiting one where the
60
+ * app runs Svelte's async mode (late-island.ts). */
61
+ const OGYGIA_REGION_MODULES = /* @__PURE__ */ new Set([PKG_ROOT_ID + "src/Region.svelte", PKG_ROOT_ID + "dist/Region.svelte"]);
62
+ const OGYGIA_INJECTED_FILES = OG_HAS_SRC ? {
63
+ "ogygia/internal": path.join(PKG_ROOT, "src/internal.ts"),
64
+ "ogygia/internal/server": path.join(PKG_ROOT, "src/internal-server.ts")
65
+ } : {
66
+ "ogygia/internal": path.join(PKG_ROOT, "dist/internal.js"),
67
+ "ogygia/internal/server": path.join(PKG_ROOT, "dist/internal-server.js")
68
+ };
69
+ /** Client-side shims aliased for island modules (Kit's client runtime is absent under csr=false). */
70
+ const APP_SHIMS = {
71
+ "$app/state": fileURLToPath(new URL("../shims/app-state.svelte.js", import.meta.url)),
72
+ "$app/stores": fileURLToPath(new URL("../shims/app-stores.js", import.meta.url)),
73
+ "$app/navigation": fileURLToPath(new URL("../shims/app-navigation.js", import.meta.url))
74
+ };
75
+ /** On-disk stub for `virtual:ogygia/client-binding-stub` (csr=false client hosts). */
76
+ const CLIENT_BINDING_STUB_FILE = fileURLToPath(new URL("../ClientBindingStub.svelte", import.meta.url));
77
+ const STUB_CLIENT = fileURLToPath(new URL("../shims/kit-remote/client-stub.js", import.meta.url));
78
+ const STUB_STATE = fileURLToPath(new URL("../shims/kit-remote/state-stub.js", import.meta.url));
79
+ const STUB_PATHS = fileURLToPath(new URL("../shims/kit-remote/paths-internal-stub.js", import.meta.url));
80
+ const KIT_REMOTE_CLIENT = /(^|\/)client\.js$/;
81
+ const KIT_REMOTE_STATE = /state\.svelte\.js$/;
82
+ /** Absolute path to real HMAC (SSR-only via `virtual:ogygia/sign`). */
83
+ const HMAC_MODULE = fileURLToPath(new URL("../server/hmac.js", import.meta.url));
84
+ /** The prebuilt runtime dir the runtime chunk bundles (for `generateRuntimeEntrySource`). */
85
+ const RUNTIME_DIR = fileURLToPath(new URL("../runtime", import.meta.url));
86
+ /** Absolute path to SSR region-endpoint helper (signed capability URLs). */
87
+ const REGION_ENDPOINT_MODULE = fileURLToPath(new URL("../server/region-endpoint.js", import.meta.url));
88
+ function runtime_content_hash() {
89
+ const inputs = [
90
+ fileURLToPath(new URL("../compiler/link/runtime-entry.js", import.meta.url)),
91
+ fileURLToPath(new URL("../live-transport.js", import.meta.url)),
92
+ fileURLToPath(new URL("../context-bridge.js", import.meta.url)),
93
+ fileURLToPath(new URL("../keep-fallback-marker.js", import.meta.url)),
94
+ fileURLToPath(new URL("../shims/page-store.svelte.js", import.meta.url)),
95
+ fileURLToPath(new URL("../shims/kit-remote/client-stub.js", import.meta.url)),
96
+ fileURLToPath(new URL("../NestedProvider.svelte", import.meta.url)),
97
+ fileURLToPath(new URL("../LiveHost.svelte", import.meta.url)),
98
+ fileURLToPath(new URL("../KeepHost.svelte", import.meta.url))
99
+ ];
100
+ try {
101
+ const rt_dir = fileURLToPath(new URL("../runtime", import.meta.url));
102
+ for (const name of fs.readdirSync(rt_dir)) if (name.endsWith(".js")) inputs.push(path.join(rt_dir, name));
103
+ } catch {}
104
+ const h = crypto.createHash("sha256");
105
+ for (const f of inputs) try {
106
+ h.update(fs.readFileSync(f));
107
+ } catch {}
108
+ return h.digest("hex").slice(0, 12);
109
+ }
110
+ /** The runtime chunk's source-content hash (the immutable-filename base; feature hash rides on top). */
111
+ const RUNTIME_HASH = runtime_content_hash();
112
+ export { APP_SHIMS, CLIENT_BINDING_STUB_FILE, HMAC_MODULE, KIT_REMOTE_CLIENT, KIT_REMOTE_STATE, OGYGIA_INJECTED_FILES, OGYGIA_INJECTED_IMPORTS, OGYGIA_REGION_MODULES, PKG_ROOT, PKG_ROOT_ID, REGION_ENDPOINT_MODULE, RUNTIME_DIR, RUNTIME_HASH, STUB_CLIENT, STUB_PATHS, STUB_STATE, id_dir, real_posix, scan_entry_pattern };
@@ -0,0 +1,166 @@
1
+ import { ServerRealm } from "../compiler/link/caps.js";
2
+ import { Plugin } from "vite";
3
+ /** Where `definePlugin` puts the definition on the Vite plugin it returns. A registered symbol, so a
4
+ * second copy of ogygia in one app still recognizes the first's plugins. */
5
+ export declare const PLUGIN: unique symbol;
6
+ /** The value a plugin's factory returns: a Vite plugin carrying its definition. */
7
+ export interface OgygiaPlugin<Options = unknown> extends Plugin {
8
+ readonly [PLUGIN]: PluginDefinition<Options>;
9
+ }
10
+ /** What a plugin is: the argument to `definePlugin`. */
11
+ export interface PluginDefinition<Options = unknown> {
12
+ /** The plugin's package name (`'@ogygia/postrender'`): its identity. */
13
+ name: string;
14
+ /** The SERVER realm: a module whose default export is `defineServer({…})` (`ogygia/plugin`), as a
15
+ * `file:` URL or an absolute path — `import.meta.resolve('./server.ts')`. */
16
+ server?: string;
17
+ /** The BROWSER realm: a module whose default export is `defineClient({…})` (`ogygia/plugin/client`),
18
+ * booted on every page — same form as `server`. */
19
+ client?: string;
20
+ /** Settings for every realm (JSON: no functions, no clients — live objects are configured at
21
+ * runtime, in hooks.server.ts). */
22
+ options?: Options;
23
+ /** Run before (`'pre'`) or after (`'post'`) the other plugins, in every realm. */
24
+ enforce?: "pre" | "post";
25
+ /** Build-time contributions, with the build context. */
26
+ build?(b: BuildContext): void;
27
+ }
28
+ /** A `import.meta.og.<name>` macro: rewrites a module that contains the marker (it is called only
29
+ * then), before the island transform or region minting see it. Returns the new code (the same
30
+ * string when nothing changed). */
31
+ export type MacroHandler = (code: string, m: MacroContext) => string | Promise<string>;
32
+ /** What a macro knows about the module it rewrites. */
33
+ export interface MacroContext {
34
+ /** The module id, query stripped. */
35
+ readonly id: string;
36
+ /** The id relative to the app root, POSIX (a stable identity for stamps). */
37
+ readonly rel: string;
38
+ readonly root: string;
39
+ /** Markup extensions whose `<script>` blocks hold the macro calls (`.svelte`). */
40
+ readonly markupExts: readonly string[];
41
+ }
42
+ /** A source format that becomes Svelte only through a preprocessor (markdown → Svelte): how its
43
+ * islands and its modules' own scoped CSS reach the build. */
44
+ export interface MarkupSource {
45
+ /** The format's file extensions (`['.svx', '.md']`). */
46
+ extensions: readonly string[];
47
+ /** Discover the format's islands up front (build start, dev included): read each file, turn it
48
+ * into Svelte, and hand that to `transform` so its islands are registered before chunks emit. */
49
+ scan?(ctx: {
50
+ root: string;
51
+ readFile(abs: string): string | null;
52
+ }): void | Promise<void>;
53
+ /** Modules that carry their OWN scoped `<style>`, absolute path → their post-preprocess Svelte
54
+ * source: the build compiles each one's CSS and ships it as a client asset (the module itself
55
+ * only ever renders on the server). The plugin keeps filling this map; the build reads it late. */
56
+ styles?: ReadonlyMap<string, string>;
57
+ }
58
+ /** What the build hands back for a markup source: run the region transform on preprocessed Svelte. */
59
+ export interface MarkupRegions {
60
+ /** Rewrite the marked imports in already-preprocessed Svelte and register its regions. The code,
61
+ * or null when nothing changed. */
62
+ transform(source: string, filename: string): string | null;
63
+ }
64
+ /** The build, as one plugin sees it (handed to `build`). */
65
+ export interface BuildContext {
66
+ /** The app's root directory. */
67
+ readonly root: string;
68
+ /** `vite dev` (true) or `vite build` (false). */
69
+ readonly dev: boolean;
70
+ /** A key this plugin reads inside Kit's own `config` page option (`export const config = { <key>:
71
+ * false }` in a `+page` / `+layout` module, `.server` included). Read at build time, merged the
72
+ * way Kit merges `config` (layouts, then the page; later wins), and answered on the server by
73
+ * `ctx.routeConfig(key)`. Literal values only (a boolean, number, string or null); nothing is
74
+ * stripped, because Kit accepts any key inside `config`. */
75
+ routeConfig(key: string): void;
76
+ /** Keep the foreign-hydrate exports on this app's island entries: another app's page may host
77
+ * them and wake them through its own runtime (fragment federation). Off by default — they cost
78
+ * every island ~185 B gz and a preload. */
79
+ foreignHydrate(): void;
80
+ /** An `import.meta.og.<name>(…)` construct this plugin compiles (`'code'`, `'loader'`). Plugin
81
+ * macros run after core's own (`wire`, `$`, `source`, `store`) and before `bake`, in plugin order. */
82
+ macro(name: string, handler: MacroHandler): void;
83
+ /** A source format that becomes Svelte through a preprocessor (markdown): register it, get the
84
+ * island transform to call from that preprocessor. */
85
+ markup(source: MarkupSource): MarkupRegions;
86
+ /** Compile core's EVENT emits in, browser and server (`ogygia/events`: island wakes, server renders,
87
+ * hub mints, navigations) — off, every emit folds away. `lazy`: measure only once a viewer opens a
88
+ * tool (the page carries a launcher; a preview build). */
89
+ events(options?: {
90
+ lazy?: boolean;
91
+ }): void;
92
+ /** Record the build's MEASUREMENT data: per-island detail, chunk contents, server source maps, the
93
+ * module map, the embedded maps, the request stats' detail — what a profiler reads. */
94
+ measure(): void;
95
+ /** Compile a package's files as app source (their islands, router-css roots): `dirs` / `files`
96
+ * absolute, under `root` (the package's directory). For a plugin's own pages (a UI it serves). */
97
+ files(scan: {
98
+ root: string;
99
+ dirs?: string[];
100
+ files?: string[];
101
+ }): void;
102
+ /** Modules that render pages outside Kit's routes (a programmatic router): every component they
103
+ * import gets its whole-tree CSS linked when it renders (`componentCssHead()` from
104
+ * `ogygia/plugin/css`). `importers`: any compiled module importing one of these specifiers is a
105
+ * page module; `files`: absolute paths that are page modules themselves (compiled ones: app source,
106
+ * or a `files()` / `ogygia.files` surface). */
107
+ pageModules(modules: {
108
+ importers?: string[];
109
+ files?: string[];
110
+ }): void;
111
+ }
112
+ /** A plugin, as the Vite plugin the app lists beside `ogygia()`. */
113
+ export declare function definePlugin<Options = undefined>(definition: PluginDefinition<Options>): OgygiaPlugin<Options>;
114
+ /** The plugin definitions in the app's Vite plugin list (nested arrays and promises included), in
115
+ * list order, shape-checked. `ogygia()` and its plugins come before `sveltekit()`: Vite runs
116
+ * same-stage hooks in list order, and theirs (the content pre-transforms, the config ogygia hands
117
+ * Kit) must see a module before Kit's do. */
118
+ export declare function find_plugins(list: unknown): Promise<PluginDefinition[]>;
119
+ /** What the build takes from the app's plugins. */
120
+ export interface ResolvedPlugins {
121
+ /** each server realm, in plugin order (`enforce` applied) */
122
+ servers: ServerRealm[];
123
+ /** each browser realm (an absolute path), in plugin order */
124
+ clients: string[];
125
+ /** every key any plugin claims inside Kit's `config` page option */
126
+ route_config: string[];
127
+ /** a plugin asked for island entries' foreign-hydrate exports */
128
+ foreign_hydrate: boolean;
129
+ /** plugin macros, in plugin order */
130
+ macros: {
131
+ name: string;
132
+ handler: MacroHandler;
133
+ }[];
134
+ /** markup sources (a preprocessor format with islands) */
135
+ markup: MarkupSource[];
136
+ /** a plugin asked for core's events (`lazy`: measure once a tool opens), or false */
137
+ events: false | {
138
+ lazy: boolean;
139
+ };
140
+ /** a plugin asked for the build's measurement data */
141
+ measure: boolean;
142
+ /** package files compiled as app source, per plugin */
143
+ files: {
144
+ name: string;
145
+ root: string;
146
+ dirs: string[];
147
+ files: string[];
148
+ }[];
149
+ /** page modules (`b.pageModules()`): the specifiers whose importers are page modules, and files
150
+ * that are page modules themselves */
151
+ page_modules: {
152
+ importers: string[];
153
+ files: string[];
154
+ };
155
+ }
156
+ /**
157
+ * Config-time shape check of the definitions found: each named once, its realms locations, its
158
+ * options JSON.
159
+ */
160
+ export declare function check_plugins(plugins: readonly unknown[]): PluginDefinition[];
161
+ /**
162
+ * When the app's root and mode are known (the `config` hook): order the plugins (`enforce`), check their
163
+ * realms, run their `build` hooks. `markup_transform` is the configured compiler's island
164
+ * transform for preprocessed markup (what `b.markup()` hands back).
165
+ */
166
+ export declare function resolve_plugins(plugins: readonly PluginDefinition[], root: string, dev: boolean, markup_transform?: MarkupRegions["transform"]): ResolvedPlugins;
@@ -0,0 +1,212 @@
1
+ import { createRequire } from "node:module";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ // src/vite/plugin-api.ts
6
+ /**
7
+ * The BUILD side of a plugin (design: internal/notes/packages.md, plugin API v2): `definePlugin` and
8
+ * the build context. Loads in plain node — vite.config imports it before any bundler runs.
9
+ *
10
+ * export const postrender = (options: PostrenderOptions = {}) =>
11
+ * definePlugin({
12
+ * name: '@ogygia/postrender', // the package name: the plugin's identity
13
+ * options, // JSON; reaches the server realm as `app.options`
14
+ * server: import.meta.resolve('./server.ts'), // the server realm (`defineServer`)
15
+ * build(b) { b.routeConfig('postrender'); }
16
+ * });
17
+ *
18
+ * A plugin IS a Vite plugin: the app lists it beside `ogygia()` (`plugins: [ogygia(), postrender(),
19
+ * sveltekit()]`), and `ogygia()` finds it there by the definition it carries under {@link PLUGIN} —
20
+ * never by its name. A factory that needs Vite hooks of its own returns them beside it, as an array.
21
+ *
22
+ * REALMS are named by the plugin: `server` and `client` point at the modules themselves, resolved
23
+ * next to the factory (`import.meta.resolve`), so they are the same files the package's own imports
24
+ * reach and a plugin's modules exist once. A package's export names stay its own.
25
+ */
26
+ /** Where `definePlugin` puts the definition on the Vite plugin it returns. A registered symbol, so a
27
+ * second copy of ogygia in one app still recognizes the first's plugins. */
28
+ const PLUGIN = Symbol.for("ogygia.plugin");
29
+ /** The name of `ogygia()`'s own Vite plugin: what a listed plugin looks for beside it. */
30
+ const OGYGIA_VITE_PLUGIN = "ogygia";
31
+ /** A plugin, as the Vite plugin the app lists beside `ogygia()`. */
32
+ function definePlugin(definition) {
33
+ return {
34
+ name: definition.name,
35
+ [PLUGIN]: definition,
36
+ configResolved(config) {
37
+ if (!config.plugins.some((p) => p.name === OGYGIA_VITE_PLUGIN)) throw new Error(`[ogygia] \`${definition.name}\` is listed in vite.config but \`ogygia()\` is not — add \`ogygia()\` from \`ogygia/vite\` to \`plugins\`.`);
38
+ }
39
+ };
40
+ }
41
+ /** The prefix of SvelteKit's own Vite plugins' names (`sveltekit()` returns several). */
42
+ const KIT_VITE_PLUGIN_PREFIX = "vite-plugin-sveltekit";
43
+ /** The plugin definitions in the app's Vite plugin list (nested arrays and promises included), in
44
+ * list order, shape-checked. `ogygia()` and its plugins come before `sveltekit()`: Vite runs
45
+ * same-stage hooks in list order, and theirs (the content pre-transforms, the config ogygia hands
46
+ * Kit) must see a module before Kit's do. */
47
+ async function find_plugins(list) {
48
+ const found = [];
49
+ let kit_seen = false;
50
+ const walk = async (entry) => {
51
+ const value = await entry;
52
+ if (Array.isArray(value)) {
53
+ for (const item of value) await walk(item);
54
+ return;
55
+ }
56
+ if (typeof value === "function") throw new Error("[ogygia] a function is listed in vite.config `plugins` — call the factory: `flags()`, not `flags`.");
57
+ const plugin = value;
58
+ const name = typeof plugin?.name === "string" ? plugin.name : "";
59
+ const definition = plugin?.[PLUGIN];
60
+ if (name.startsWith(KIT_VITE_PLUGIN_PREFIX)) kit_seen = true;
61
+ const own = name === OGYGIA_VITE_PLUGIN;
62
+ if ((own || definition) && kit_seen) throw new Error(`[ogygia] \`${own ? "ogygia()" : String(definition?.name)}\` is listed after \`sveltekit()\` in vite.config — list \`ogygia()\` and its plugins first: \`plugins: [ogygia(), flags(), sveltekit()]\`.`);
63
+ if (definition) found.push(definition);
64
+ };
65
+ await walk(list);
66
+ return check_plugins(found);
67
+ }
68
+ const MACRO_NAME_RE = /^[a-z][A-Za-z0-9]*$/;
69
+ /** core's own `import.meta.og.*` constructs: a plugin may never claim one */
70
+ const CORE_MACROS = /* @__PURE__ */ new Set([
71
+ "wire",
72
+ "$",
73
+ "source",
74
+ "store",
75
+ "bake"
76
+ ]);
77
+ function order(plugins) {
78
+ return [
79
+ ...plugins.filter((p) => p.enforce === "pre"),
80
+ ...plugins.filter((p) => p.enforce !== "pre" && p.enforce !== "post"),
81
+ ...plugins.filter((p) => p.enforce === "post")
82
+ ];
83
+ }
84
+ const ROUTE_CONFIG_KEY_RE = /^[a-z][A-Za-z0-9]*$/;
85
+ /**
86
+ * Config-time shape check of the definitions found: each named once, its realms locations, its
87
+ * options JSON.
88
+ */
89
+ function check_plugins(plugins) {
90
+ const seen = /* @__PURE__ */ new Set();
91
+ for (const p of plugins) {
92
+ const plugin = p;
93
+ if (!plugin || typeof plugin !== "object" || typeof plugin.name !== "string" || plugin.name === "") throw new Error("[ogygia] a plugin definition needs a `name` (its package name).");
94
+ if (seen.has(plugin.name)) throw new Error(`[ogygia] plugin \`${plugin.name}\` is listed twice.`);
95
+ seen.add(plugin.name);
96
+ for (const realm of ["server", "client"]) if (plugin[realm] !== void 0 && typeof plugin[realm] !== "string") throw new Error(`[ogygia] plugin \`${plugin.name}\`: \`${realm}\` is a module location — \`import.meta.resolve('./${realm}.ts')\`.`);
97
+ if (plugin.options !== void 0) try {
98
+ JSON.stringify(plugin.options);
99
+ } catch {
100
+ throw new Error(`[ogygia] plugin \`${plugin.name}\`: \`options\` must be plain JSON (configure live objects in hooks.server.ts).`);
101
+ }
102
+ }
103
+ return plugins;
104
+ }
105
+ /** A realm's module as an absolute POSIX path (what the generated imports name), or null when the
106
+ * plugin has none. A location that is not a file is a mistake, said loudly. */
107
+ function realm_path(plugin, realm) {
108
+ const where = plugin[realm];
109
+ if (where === void 0) return null;
110
+ const abs = where.startsWith("file:") ? fileURLToPath(where) : where;
111
+ if (!path.isAbsolute(abs) || !fs.existsSync(abs)) throw new Error(`[ogygia] plugin \`${plugin.name}\`: its \`${realm}\` realm \`${where}\` is not a file — resolve it next to the factory: \`import.meta.resolve('./${realm}.ts')\`.`);
112
+ return abs.split(path.sep).join("/");
113
+ }
114
+ function package_resolves(req, name) {
115
+ try {
116
+ req.resolve(`${name}/package.json`);
117
+ return true;
118
+ } catch (e) {
119
+ return e.code === "ERR_PACKAGE_PATH_NOT_EXPORTED";
120
+ }
121
+ }
122
+ /**
123
+ * When the app's root and mode are known (the `config` hook): order the plugins (`enforce`), check their
124
+ * realms, run their `build` hooks. `markup_transform` is the configured compiler's island
125
+ * transform for preprocessed markup (what `b.markup()` hands back).
126
+ */
127
+ function resolve_plugins(plugins, root, dev, markup_transform = () => null) {
128
+ const ordered = order(plugins);
129
+ const req = createRequire(path.join(root, "package.json"));
130
+ const out = {
131
+ servers: [],
132
+ clients: [],
133
+ route_config: [],
134
+ foreign_hydrate: false,
135
+ macros: [],
136
+ markup: [],
137
+ events: false,
138
+ measure: false,
139
+ files: [],
140
+ page_modules: {
141
+ importers: [],
142
+ files: []
143
+ }
144
+ };
145
+ const config_owner = /* @__PURE__ */ new Map();
146
+ const macro_owner = /* @__PURE__ */ new Map();
147
+ for (const plugin of ordered) {
148
+ if (!package_resolves(req, plugin.name)) throw new Error(`[ogygia] plugin \`${plugin.name}\`: no package by that name resolves from ${root} — its name must be its package name.`);
149
+ const server = realm_path(plugin, "server");
150
+ if (server) out.servers.push({
151
+ name: plugin.name,
152
+ module: server,
153
+ options: plugin.options ?? {}
154
+ });
155
+ const client = realm_path(plugin, "client");
156
+ if (client) out.clients.push(client);
157
+ plugin.build?.({
158
+ root,
159
+ dev,
160
+ routeConfig(key) {
161
+ if (!ROUTE_CONFIG_KEY_RE.test(key)) throw new Error(`[ogygia] plugin \`${plugin.name}\`: route config key \`${key}\` must be a camelCase identifier.`);
162
+ const owner = config_owner.get(key);
163
+ if (owner && owner !== plugin.name) throw new Error(`[ogygia] route config key \`${key}\` is claimed by both \`${owner}\` and \`${plugin.name}\`.`);
164
+ if (!owner) {
165
+ config_owner.set(key, plugin.name);
166
+ out.route_config.push(key);
167
+ }
168
+ },
169
+ foreignHydrate() {
170
+ out.foreign_hydrate = true;
171
+ },
172
+ macro(name, handler) {
173
+ if (!MACRO_NAME_RE.test(name) || CORE_MACROS.has(name)) throw new Error(`[ogygia] plugin \`${plugin.name}\`: macro \`import.meta.og.${name}\` must be a camelCase name core does not own.`);
174
+ const owner = macro_owner.get(name);
175
+ if (owner) throw new Error(`[ogygia] macro \`import.meta.og.${name}\` is claimed by both \`${owner}\` and \`${plugin.name}\`.`);
176
+ macro_owner.set(name, plugin.name);
177
+ out.macros.push({
178
+ name,
179
+ handler
180
+ });
181
+ },
182
+ markup(source) {
183
+ out.markup.push(source);
184
+ return { transform: markup_transform };
185
+ },
186
+ events(options) {
187
+ const lazy = options?.lazy === true;
188
+ out.events = out.events ? { lazy: out.events.lazy && lazy } : { lazy };
189
+ },
190
+ measure() {
191
+ out.measure = true;
192
+ },
193
+ files(scan) {
194
+ out.files.push({
195
+ name: plugin.name,
196
+ root: scan.root,
197
+ dirs: scan.dirs ?? [],
198
+ files: scan.files ?? []
199
+ });
200
+ },
201
+ pageModules(modules) {
202
+ for (const spec of modules.importers ?? []) if (!out.page_modules.importers.includes(spec)) out.page_modules.importers.push(spec);
203
+ for (const file of modules.files ?? []) {
204
+ if (!path.isAbsolute(file)) throw new Error(`[ogygia] plugin \`${plugin.name}\`: \`pageModules({ files })\` takes absolute paths (got \`${file}\`).`);
205
+ if (!out.page_modules.files.includes(file)) out.page_modules.files.push(file);
206
+ }
207
+ }
208
+ });
209
+ }
210
+ return out;
211
+ }
212
+ export { PLUGIN, check_plugins, definePlugin, find_plugins, resolve_plugins };
@@ -0,0 +1,23 @@
1
+ /** the payload the profiler reads (profiler/embedded-maps.ts) */
2
+ export interface ProfilerMaps {
3
+ v: 1;
4
+ /** chunk file (relative to the server output) → [first line, last line, module id] */
5
+ modules: Record<string, [number, number, string][]>;
6
+ /** chunk file → its sourcemap, as the JSON text the build wrote */
7
+ maps: Record<string, string>;
8
+ /** a build WITHOUT maps: the app's own source files at the lines of its chunks, by module id
9
+ * (`src/lib/x.ts`) — what the profiler matches the chunks' lines to by text on a host without
10
+ * `src/` */
11
+ sources?: Record<string, string>;
12
+ /** ...and those chunks' own text, by chunk file */
13
+ chunks?: Record<string, string>;
14
+ }
15
+ export declare function fill_profiler_maps(dir: string, bundle: Record<string, unknown>, root: string): boolean;
16
+ /**
17
+ * A CHUNK'S MAP, CUT TO WHAT THE PROFILER READS: the mappings and names whole (every frame's line
18
+ * and name), the source TEXT only for the app's own code files — what the source checks read on a
19
+ * host without `src/` (a load line by line, a component's `{#each}`, a late island's data). A
20
+ * package's text and imported data (`.json`: no function runs on its lines) are the bulk of a real
21
+ * app's maps and never read there. Undefined for a map of data alone (nothing to name).
22
+ */
23
+ export declare function slim_map(raw: string, chunk_dir: string, src: string): string | undefined;