@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,144 @@
1
+ import { blank_styles } from "./blank-styles.js";
2
+ import { strip_bom } from "./bom.js";
3
+ import { HTML_PARENT_ATTR, OPAQUE_ATTR } from "../runtime/ownership.js";
4
+ import { parse } from "svelte/compiler";
5
+ import MagicString from "magic-string";
6
+ // src/compiler/ownership-stamps.ts
7
+ /**
8
+ * OWNERSHIP STAMPS — declared, not inferred (internal/notes/dom-ownership.md §4).
9
+ *
10
+ * The runtime's pre-hydration repair keeps an island's DOM in the shape Svelte's hydration walk
11
+ * binds by position, and must leave alone what the walk never reads — but the runtime cannot tell the
12
+ * two apart from the DOM: Svelte's PROD output opens an `{@html}` block with the same `<!---->` it uses
13
+ * as a separator everywhere. The compiler can. This server-leg pass stamps `data-og-opaque` on the
14
+ * element shapes whose CHILDREN Svelte's hydration never walks (svelte 5 client: `html.js`,
15
+ * `RegularElement.js`, `fragment.js` `is_static_element`):
16
+ *
17
+ * - an element whose only non-whitespace child is `{@html}` — the controlled form: the walk takes the
18
+ * element and never descends;
19
+ * - an element with `bind:innerHTML` / `bind:textContent` / `bind:innerText` — Svelte owns its
20
+ * content wholesale, by value, not by walking it;
21
+ * - a custom element whose descendants are all static (no expression, block, component, render tag,
22
+ * `{@html}` or directive, only literal attributes) — Svelte keeps a reference to the host and never
23
+ * descends its children.
24
+ *
25
+ * A web component living there can rework its own light DOM before the island wakes and the repair,
26
+ * the drift watch and the morph leave it alone (runtime/ownership.ts). The stamp is an attribute on
27
+ * the SERVER render only: hydration never compares or strips static attributes, it adds no node (a
28
+ * node would shift the positional walk), and the client template is untouched.
29
+ */
30
+ /** A cheap presence test before parsing: one of the three shapes could be in this file. */
31
+ const MAY_STAMP_RE = /\{@html|bind:(?:innerHTML|textContent|innerText)|<[a-z][\w.]*-[\w-]*[\s/>]|\sis=/;
32
+ const WHOLESALE_BINDS = /* @__PURE__ */ new Set([
33
+ "innerHTML",
34
+ "textContent",
35
+ "innerText"
36
+ ]);
37
+ /** Template node kinds that make content dynamic (anything Svelte must walk to bind). */
38
+ const DYNAMIC_KINDS = /* @__PURE__ */ new Set([
39
+ "ExpressionTag",
40
+ "HtmlTag",
41
+ "RenderTag",
42
+ "ConstTag",
43
+ "DebugTag",
44
+ "AttachTag",
45
+ "IfBlock",
46
+ "EachBlock",
47
+ "AwaitBlock",
48
+ "KeyBlock",
49
+ "SnippetBlock",
50
+ "Component",
51
+ "SvelteComponent",
52
+ "SvelteElement",
53
+ "SvelteSelf",
54
+ "SvelteFragment",
55
+ "SvelteBoundary",
56
+ "SlotElement"
57
+ ]);
58
+ const is_blank = (n) => n.type === "Text" && !String(n.data ?? "").trim();
59
+ /** Every attribute on an element is a plain literal (no `{expr}`), and it carries no directive. */
60
+ function literal_attributes(el) {
61
+ for (const a of el.attributes ?? []) {
62
+ if (a.type !== "Attribute") return false;
63
+ const v = a.value;
64
+ if (v === true) continue;
65
+ if ((Array.isArray(v) ? v : [v]).some((p) => p.type !== "Text")) return false;
66
+ }
67
+ return true;
68
+ }
69
+ /** Every descendant of `nodes` is static: plain text, comments, elements with literal attributes. */
70
+ function all_static(nodes) {
71
+ for (const n of nodes) {
72
+ if (n.type === "Text" || n.type === "Comment") continue;
73
+ if (DYNAMIC_KINDS.has(n.type)) return false;
74
+ if (n.type !== "RegularElement") return false;
75
+ if (!literal_attributes(n)) return false;
76
+ if (!all_static(n.fragment?.nodes ?? [])) return false;
77
+ }
78
+ return true;
79
+ }
80
+ function is_custom_element(el) {
81
+ return String(el.name).includes("-") || (el.attributes ?? []).some((a) => a.type === "Attribute" && a.name === "is");
82
+ }
83
+ /** Does Svelte's hydration walk never enter this element's children? */
84
+ function opaque(el) {
85
+ if ((el.attributes ?? []).some((a) => a.type === "Attribute" && a.name === "data-og-opaque")) return false;
86
+ const kids = (el.fragment?.nodes ?? []).filter((n) => !is_blank(n));
87
+ if (kids.length === 1 && kids[0].type === "HtmlTag") return true;
88
+ if ((el.attributes ?? []).some((a) => a.type === "BindDirective" && WHOLESALE_BINDS.has(a.name))) return true;
89
+ return is_custom_element(el) && all_static(el.fragment?.nodes ?? []);
90
+ }
91
+ const CHILD_KEYS = [
92
+ "fragment",
93
+ "consequent",
94
+ "alternate",
95
+ "body",
96
+ "pending",
97
+ "then",
98
+ "catch",
99
+ "fallback"
100
+ ];
101
+ /**
102
+ * `source` with every opaque element stamped, or `null` when there is nothing to stamp (or the file
103
+ * does not parse — the real compile reports that). Outermost wins: nothing is stamped inside a stamped
104
+ * element (the repair never enters it anyway).
105
+ */
106
+ function stamp_opaque(raw, filename) {
107
+ const source = strip_bom(raw);
108
+ if (!MAY_STAMP_RE.test(source)) return null;
109
+ let ast;
110
+ try {
111
+ ast = parse(blank_styles(source), {
112
+ modern: true,
113
+ filename
114
+ });
115
+ } catch {
116
+ return null;
117
+ }
118
+ const at = [];
119
+ const visit = (nodes) => {
120
+ for (const n of nodes ?? []) {
121
+ if (n.type === "RegularElement" && opaque(n)) {
122
+ at.push({
123
+ pos: n.start + 1 + String(n.name).length,
124
+ attr: OPAQUE_ATTR
125
+ });
126
+ continue;
127
+ }
128
+ if (n.type === "RegularElement" && (n.fragment?.nodes ?? []).some((c) => c.type === "HtmlTag") && !(n.attributes ?? []).some((a) => a.type === "Attribute" && (a.name === "data-og-html" || a.name === "data-og-opaque"))) at.push({
129
+ pos: n.start + 1 + String(n.name).length,
130
+ attr: HTML_PARENT_ATTR
131
+ });
132
+ for (const k of CHILD_KEYS) {
133
+ const child = n[k];
134
+ if (child && Array.isArray(child.nodes)) visit(child.nodes);
135
+ }
136
+ }
137
+ };
138
+ visit(ast.fragment?.nodes);
139
+ if (!at.length) return null;
140
+ const s = new MagicString(source);
141
+ for (const { pos, attr } of at) s.appendLeft(pos, " " + attr);
142
+ return s.toString();
143
+ }
144
+ export { stamp_opaque };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * An AST node as the compiler's passes read it: the parser seam's output (oxc's ESTree, or whatever
3
+ * parser {@link set_parser} installed) and Svelte's template AST, walked generically and read by field
4
+ * name. Kept loose on purpose: the walkers index arbitrary fields (`node[key]`), and some passes accept
5
+ * node shapes beyond oxc's (store.ts also matches Babel's `StringLiteral` / `ObjectProperty`), which a
6
+ * precise ESTree union would rule out. The one loose node type every pass shares.
7
+ */
8
+ export type AstNode = Record<string, any>;
9
+ type Node = AstNode;
10
+ export type Comment = {
11
+ start: number;
12
+ end: number;
13
+ };
14
+ export type ParseResult = {
15
+ program: Node | null;
16
+ ok: boolean;
17
+ comments: Comment[];
18
+ };
19
+ /** The raw oxc parse signature (`(id, code) → { program, errors, comments }`). */
20
+ export type RawParse = (id: string, code: string) => {
21
+ program?: Node;
22
+ errors?: unknown[];
23
+ comments?: Comment[];
24
+ };
25
+ /** Install a browser (or test) parser with the same call shape. No-arg reset restores the default. */
26
+ export declare function set_parser(fn?: RawParse): void;
27
+ /**
28
+ * Parse `code` (named by `id`, whose extension picks the dialect) to an oxc/ESTree program. Never
29
+ * throws: a syntax error (or a half-typed file mid-edit) yields `{ program: null, ok: false }`, and
30
+ * callers fall back (scanner) or skip. Offsets on the returned nodes are exact against `code`.
31
+ * `comments` carries trivia (block/line) with byte offsets — not present in the AST body.
32
+ */
33
+ export declare function parse_module(code: string, id: string): ParseResult;
34
+ export {};
@@ -0,0 +1,59 @@
1
+ import { createRequire } from "node:module";
2
+ // src/compiler/parse/oxc.ts
3
+ /**
4
+ * The one parser the `import.meta.og.*` transforms use. It must (a) parse TypeScript — the constructs
5
+ * live in `.ts`/`.svelte.ts` and `<script lang="ts">` — and (b) preserve BYTE OFFSETS against the
6
+ * original source, because every transform splices by span. That rules out `parseAst` (rollup's
7
+ * parser: no TS) and type-stripping (shifts offsets).
8
+ *
9
+ * The parser comes from the app's required `vite` peer: Vite 8 re-exports the TS-capable oxc parser
10
+ * as `parseSync` (byte-identical to `rolldown/utils`' — verified), so ogygia carries no `rolldown`
11
+ * dependency of its own for this. NOT a shaky choice: `parseAst` is the rollup-compat parser (throws
12
+ * on TS); `parseSync` is the oxc parser. One import, one decision.
13
+ */
14
+ /**
15
+ * The parser is INJECTABLE so the SAME oxc can run in the browser (the Observatory / Rung 1). Node
16
+ * uses the default `rolldown/utils` (native); a browser build installs `@rolldown/browser/utils`
17
+ * (WASM, the SAME rolldown version → byte-identical AST) via {@link set_parser}, after awaiting the
18
+ * WASM init. This is the seam, not a parser swap for Node: the default below is unchanged, so the
19
+ * production build parses exactly as before. (bake() keeps rolldown too, so this is consistency —
20
+ * same parser both realms — not a new dependency.)
21
+ */
22
+ let node_parse_sync;
23
+ function node_default_parse(id, code) {
24
+ if (!node_parse_sync) node_parse_sync = createRequire(import.meta.url)("vite").parseSync;
25
+ return node_parse_sync(id, code);
26
+ }
27
+ let raw_parse = node_default_parse;
28
+ /** Install a browser (or test) parser with the same call shape. No-arg reset restores the default. */
29
+ function set_parser(fn) {
30
+ raw_parse = fn ?? node_default_parse;
31
+ }
32
+ /**
33
+ * Parse `code` (named by `id`, whose extension picks the dialect) to an oxc/ESTree program. Never
34
+ * throws: a syntax error (or a half-typed file mid-edit) yields `{ program: null, ok: false }`, and
35
+ * callers fall back (scanner) or skip. Offsets on the returned nodes are exact against `code`.
36
+ * `comments` carries trivia (block/line) with byte offsets — not present in the AST body.
37
+ */
38
+ function parse_module(code, id) {
39
+ try {
40
+ const result = raw_parse(id, code);
41
+ if (result.errors && result.errors.length > 0) return {
42
+ program: null,
43
+ ok: false,
44
+ comments: []
45
+ };
46
+ return {
47
+ program: result.program ?? null,
48
+ ok: !!result.program,
49
+ comments: result.comments ?? []
50
+ };
51
+ } catch {
52
+ return {
53
+ program: null,
54
+ ok: false,
55
+ comments: []
56
+ };
57
+ }
58
+ }
59
+ export { parse_module, set_parser };
@@ -0,0 +1,43 @@
1
+ /** A `/` begins a regex (not division) when the previous significant char is an operator/opener —
2
+ * always the case for a regex option value (`{ page: /…/ }`, `[/…/, /…/]`). */
3
+ export declare function regex_context(prev: string): boolean;
4
+ /** Index of the `)` matching the `(` at `open`, skipping strings, comments, and regex literals
5
+ * (incl. `[…]` char classes, which may hold an unescaped `/`). -1 if unbalanced. */
6
+ export declare function match_close(src: string, open: number): number;
7
+ /** One located `import.meta.og.<method>(<args>)` call. `args` is the VERBATIM text between the
8
+ * parens; `method` is the dotted tail after the shared prefix (`loader.git`, `code`, `regions`). */
9
+ export type OgCall = {
10
+ start: number;
11
+ end: number;
12
+ method: string;
13
+ args: string;
14
+ };
15
+ /**
16
+ * Find every `<prefix><method>(…)` call in `src`. `prefix` is the literal namespace head
17
+ * (`import.meta.og.`); `method` is the dotted identifier chain that follows, up to the `(`. Skips
18
+ * strings/comments/regex so a marker in prose is never a false hit. Pure.
19
+ */
20
+ export declare function find_og_calls(src: string, prefix: string): OgCall[];
21
+ /** Split a call's argument text into the first string-literal (unquoted) and the verbatim rest.
22
+ * Throws (with `who` in the message) when the first argument is not a STATIC string literal — a
23
+ * bare identifier, or a template literal with `${…}` interpolation (not build-determinable). */
24
+ export declare function split_first_string(args: string, who: string): {
25
+ value: string;
26
+ rest: string;
27
+ };
28
+ /** A slice of JS/TS to analyze, plus where it starts in the original source (for offset mapping). */
29
+ export type JsRegion = {
30
+ code: string;
31
+ offset: number;
32
+ };
33
+ /** Does `id` (a module path, maybe with a `?query`) end in a plain JS/TS extension? */
34
+ export declare function is_js_module(id: string): boolean;
35
+ /** Does `id` end in one of the configured MARKUP extensions (`.svelte`, `.svx`, `.md`)? */
36
+ export declare function is_markup_module(id: string, markup_exts: readonly string[]): boolean;
37
+ /**
38
+ * Extract the JS regions of a module for construct analysis. Returns `null` when the extension is not
39
+ * a recognized construct host (the caller then leaves the file untouched). A JS/TS module is one
40
+ * region; a markup file is its `<script>` blocks. `.svelte.ts`/`.svelte.js` hit the JS branch first
41
+ * (they end in `.ts`/`.js`), so a `.svelte`-suffixed markup ext never shadows them.
42
+ */
43
+ export declare function og_js_regions(src: string, id: string, markup_exts: readonly string[]): JsRegion[] | null;
@@ -0,0 +1,232 @@
1
+ // src/compiler/parse/scan.ts
2
+ /**
3
+ * The string-aware macro SCANNER — the cheap-bailout front-end for `import.meta.og.*`.
4
+ *
5
+ * Two jobs, no full parse:
6
+ * • the LEXER (`find_og_calls` / `match_close` / `split_first_string`) locates
7
+ * `import.meta.og.<path>(…)` CALLS in a module's source with a single left-to-right pass that
8
+ * skips strings, comments, and regex literals, so a marker inside a doc comment or a string is
9
+ * never mistaken for a call.
10
+ * • the EXTRACTOR (`og_js_regions` / `is_js_module` / `is_markup_module`) decides where those
11
+ * constructs are recognized per file type, and yields the JS slices to analyze.
12
+ *
13
+ * Why not an AST? These rewrites run in the Vite `transform` hook on EVERY module (svelte/ts/js) —
14
+ * a parse per module per construct is the tax we refuse. The scanner is O(n), allocation-light, and
15
+ * (critically) survives partial/invalid syntax mid-edit in dev. The git loader proved it; this is
16
+ * that scanner, generalized so all constructs share one code path.
17
+ */
18
+ const REGEX_FLAG_RE = /[a-z]/i;
19
+ const WS_RE = /\s/;
20
+ const TEMPLATE_INTERPOLATION_RE = /\$\{/;
21
+ /** A `/` begins a regex (not division) when the previous significant char is an operator/opener —
22
+ * always the case for a regex option value (`{ page: /…/ }`, `[/…/, /…/]`). */
23
+ function regex_context(prev) {
24
+ return prev === "" || "([{,;:=!&|?+-~^<>*%".includes(prev);
25
+ }
26
+ /** Index of the `)` matching the `(` at `open`, skipping strings, comments, and regex literals
27
+ * (incl. `[…]` char classes, which may hold an unescaped `/`). -1 if unbalanced. */
28
+ function match_close(src, open) {
29
+ let depth = 0;
30
+ let prev = "";
31
+ for (let i = open; i < src.length; i++) {
32
+ const c = src[i];
33
+ const c2 = src[i + 1];
34
+ if (c === "'" || c === "\"" || c === "`") {
35
+ const q = c;
36
+ for (i++; i < src.length; i++) if (src[i] === "\\") i++;
37
+ else if (src[i] === q) break;
38
+ prev = c;
39
+ continue;
40
+ }
41
+ if (c === "/" && c2 === "/") {
42
+ for (i += 2; i < src.length && src[i] !== "\n"; i++);
43
+ continue;
44
+ }
45
+ if (c === "/" && c2 === "*") {
46
+ for (i += 2; i < src.length && !(src[i] === "*" && src[i + 1] === "/"); i++);
47
+ i++;
48
+ continue;
49
+ }
50
+ if (c === "/" && regex_context(prev)) {
51
+ let in_class = false;
52
+ for (i++; i < src.length; i++) {
53
+ const r = src[i];
54
+ if (r === "\\") i++;
55
+ else if (r === "[") in_class = true;
56
+ else if (r === "]") in_class = false;
57
+ else if (r === "/" && !in_class) break;
58
+ }
59
+ while (i + 1 < src.length && REGEX_FLAG_RE.test(src[i + 1])) i++;
60
+ prev = "/";
61
+ continue;
62
+ }
63
+ if (c === "(" || c === "{" || c === "[") {
64
+ depth++;
65
+ prev = c;
66
+ continue;
67
+ }
68
+ if (c === ")" || c === "}" || c === "]") {
69
+ if (--depth === 0) return i;
70
+ prev = c;
71
+ continue;
72
+ }
73
+ if (!WS_RE.test(c)) prev = c;
74
+ }
75
+ return -1;
76
+ }
77
+ const IDENT = /[A-Za-z0-9_$.]/;
78
+ /**
79
+ * Find every `<prefix><method>(…)` call in `src`. `prefix` is the literal namespace head
80
+ * (`import.meta.og.`); `method` is the dotted identifier chain that follows, up to the `(`. Skips
81
+ * strings/comments/regex so a marker in prose is never a false hit. Pure.
82
+ */
83
+ function find_og_calls(src, prefix) {
84
+ const calls = [];
85
+ const head = prefix[0];
86
+ let prev = "";
87
+ for (let i = 0; i < src.length; i++) {
88
+ const c = src[i];
89
+ const c2 = src[i + 1];
90
+ if (c === "'" || c === "\"" || c === "`") {
91
+ const q = c;
92
+ for (i++; i < src.length; i++) if (src[i] === "\\") i++;
93
+ else if (src[i] === q) break;
94
+ prev = c;
95
+ continue;
96
+ }
97
+ if (c === "/" && c2 === "/") {
98
+ for (i += 2; i < src.length && src[i] !== "\n"; i++);
99
+ continue;
100
+ }
101
+ if (c === "/" && c2 === "*") {
102
+ for (i += 2; i < src.length && !(src[i] === "*" && src[i + 1] === "/"); i++);
103
+ i++;
104
+ continue;
105
+ }
106
+ if (c === "/" && regex_context(prev)) {
107
+ let in_class = false;
108
+ for (i++; i < src.length; i++) {
109
+ const r = src[i];
110
+ if (r === "\\") i++;
111
+ else if (r === "[") in_class = true;
112
+ else if (r === "]") in_class = false;
113
+ else if (r === "/" && !in_class) break;
114
+ }
115
+ while (i + 1 < src.length && REGEX_FLAG_RE.test(src[i + 1])) i++;
116
+ prev = "/";
117
+ continue;
118
+ }
119
+ if (c === head && src.startsWith(prefix, i)) {
120
+ let p = i + prefix.length;
121
+ const name_start = p;
122
+ while (p < src.length && IDENT.test(src[p])) p++;
123
+ const method = src.slice(name_start, p);
124
+ let q = p;
125
+ while (q < src.length && WS_RE.test(src[q])) q++;
126
+ if (method && src[q] === "(") {
127
+ const close = match_close(src, q);
128
+ if (close >= 0) {
129
+ calls.push({
130
+ start: i,
131
+ end: close + 1,
132
+ method,
133
+ args: src.slice(q + 1, close)
134
+ });
135
+ i = close;
136
+ prev = ")";
137
+ continue;
138
+ }
139
+ }
140
+ i = p - 1;
141
+ prev = "t";
142
+ continue;
143
+ }
144
+ if (!WS_RE.test(c)) prev = c;
145
+ }
146
+ return calls;
147
+ }
148
+ /** Split a call's argument text into the first string-literal (unquoted) and the verbatim rest.
149
+ * Throws (with `who` in the message) when the first argument is not a STATIC string literal — a
150
+ * bare identifier, or a template literal with `${…}` interpolation (not build-determinable). */
151
+ function split_first_string(args, who) {
152
+ let i = 0;
153
+ while (i < args.length && WS_RE.test(args[i])) i++;
154
+ const q = args[i];
155
+ if (q !== "'" && q !== "\"" && q !== "`") throw new Error(`[ogygia] ${who}: the first argument must be a static string literal, got '${args.slice(0, 24)}…'`);
156
+ let j = i + 1;
157
+ for (; j < args.length; j++) if (args[j] === "\\") j++;
158
+ else if (args[j] === q) break;
159
+ const value = args.slice(i + 1, j);
160
+ if (q === "`" && TEMPLATE_INTERPOLATION_RE.test(value)) throw new Error(`[ogygia] ${who}: the first argument must be a static string literal — a template literal with \${…} interpolation is a runtime value the build cannot resolve.`);
161
+ let k = j + 1;
162
+ while (k < args.length && WS_RE.test(args[k])) k++;
163
+ if (k < args.length && args[k] !== ",") throw new Error(`[ogygia] ${who}: the first argument must be a static string literal, but it is part of a larger expression (near '${args.slice(i, k + 8)}…'). Use one plain string.`);
164
+ if (args[k] === ",") k++;
165
+ return {
166
+ value,
167
+ rest: args.slice(k).trim()
168
+ };
169
+ }
170
+ const JS_EXT = /\.(ts|js|mjs|cjs|mts|cts)$/;
171
+ /** Does `id` (a module path, maybe with a `?query`) end in a plain JS/TS extension? */
172
+ function is_js_module(id) {
173
+ const clean = id.split("?")[0];
174
+ return JS_EXT.test(clean);
175
+ }
176
+ /** Does `id` end in one of the configured MARKUP extensions (`.svelte`, `.svx`, `.md`)? */
177
+ function is_markup_module(id, markup_exts) {
178
+ const clean = id.split("?")[0];
179
+ return markup_exts.some((ext) => clean.endsWith(ext));
180
+ }
181
+ /**
182
+ * Extract the JS regions of a module for construct analysis. Returns `null` when the extension is not
183
+ * a recognized construct host (the caller then leaves the file untouched). A JS/TS module is one
184
+ * region; a markup file is its `<script>` blocks. `.svelte.ts`/`.svelte.js` hit the JS branch first
185
+ * (they end in `.ts`/`.js`), so a `.svelte`-suffixed markup ext never shadows them.
186
+ */
187
+ function og_js_regions(src, id, markup_exts) {
188
+ if (is_js_module(id)) return [{
189
+ code: src,
190
+ offset: 0
191
+ }];
192
+ if (is_markup_module(id, markup_exts)) return script_blocks(src);
193
+ return null;
194
+ }
195
+ /**
196
+ * Find every `<script …>…<\/script>` block and return its inner JS + byte offset. A single forward
197
+ * scan (not a regex) so a `<\/script>` inside a JS string can't end a block early: we only close on a
198
+ * `<\/script>` found while scanning raw text, and Svelte itself forbids an unescaped `<\/script>` in
199
+ * script text, so this matches the compiler's own tokenization.
200
+ */
201
+ function script_blocks(src) {
202
+ const regions = [];
203
+ const lower = src.toLowerCase();
204
+ let i = 0;
205
+ for (;;) {
206
+ const open = lower.indexOf("<script", i);
207
+ if (open < 0) break;
208
+ const gt = tag_end(src, open);
209
+ if (gt < 0) break;
210
+ const close = lower.indexOf("<\/script>", gt + 1);
211
+ if (close < 0) break;
212
+ regions.push({
213
+ code: src.slice(gt + 1, close),
214
+ offset: gt + 1
215
+ });
216
+ i = close + 9;
217
+ }
218
+ return regions;
219
+ }
220
+ /** Index of the `>` that ends the tag opened at `open`, honoring quoted attribute values. */
221
+ function tag_end(src, open) {
222
+ for (let i = open; i < src.length; i++) {
223
+ const c = src[i];
224
+ if (c === "\"" || c === "'") {
225
+ for (i++; i < src.length && src[i] !== c; i++);
226
+ continue;
227
+ }
228
+ if (c === ">") return i;
229
+ }
230
+ return -1;
231
+ }
232
+ export { find_og_calls, is_js_module, is_markup_module, match_close, og_js_regions, regex_context, split_first_string };
@@ -0,0 +1,140 @@
1
+ import { FlagSite } from "./flags.js";
2
+ import { AllReason, PageKeys, PendingCall } from "./link/page-keys.js";
3
+ import { RuntimeMarks } from "./link/runtime-entry.js";
4
+ /** Strip a `?query` off a module id (host vs component vs Vite watch paths). */
5
+ export declare const strip_id: (id: string) => string;
6
+ /** Canonical absolute host key (query-stripped, resolved) — the registry's cross-host dedupe key. */
7
+ export declare const host_key: (hostPath: string) => string;
8
+ /** One row in the virtual-module registry — an island's entry / wrapper / region-binding artifact.
9
+ * Loose by design: the three roles carry different legs (source vs ssrSource/clientSource). */
10
+ export interface RegistryEntry {
11
+ source?: string;
12
+ ssrSource?: string;
13
+ clientSource?: string;
14
+ hostPath?: string | null;
15
+ id: string;
16
+ server?: boolean;
17
+ lakes?: string[];
18
+ componentPath?: string | null;
19
+ role?: "entry" | "wrapper" | "region" | "lazy";
20
+ portable?: boolean;
21
+ /** a server entry's render identity (identity.ts `renderId`): what its endpoint renders */
22
+ renderId?: string;
23
+ }
24
+ /** What a host's last transform indexed: the region ids + virtual paths it minted. */
25
+ interface HostIndexEntry {
26
+ ids: Set<string>;
27
+ vpaths: Set<string>;
28
+ }
29
+ /** One island a file's Lower phase minted — the `register`-relevant fields of a lowered descriptor.
30
+ * Loose (most fields optional) because the three legs — entry / wrapper / region binding — differ. */
31
+ export interface IslandDescriptor {
32
+ id: string;
33
+ kind?: "hydrate" | "defer" | "lake";
34
+ server?: boolean;
35
+ fetchWhen?: string;
36
+ strategy?: string;
37
+ wakeAfter?: string;
38
+ held?: boolean;
39
+ lakes?: string[];
40
+ keep?: string;
41
+ portable?: boolean;
42
+ wrapperPath?: string;
43
+ wrapperSource?: string;
44
+ /** the wrapper's client leg (lazy component; see emit.ts `island_wrapper_client_source`) */
45
+ wrapperClientSource?: string;
46
+ /** the lazy component module the client wrapper imports (`lazyEntryVirtualId`) */
47
+ lazyPath?: string;
48
+ lazySource?: string;
49
+ bindingPath?: string;
50
+ bindingSsrSource?: string;
51
+ bindingClientSource?: string;
52
+ hostPath?: string | null;
53
+ componentPath?: string | null;
54
+ virtualPath?: string;
55
+ source?: string;
56
+ /** the region identity (identity.ts `regionIdentity`) the id was hashed from */
57
+ identity?: string;
58
+ }
59
+ /** The relevant shape of a file's transform result the linker registers. */
60
+ export interface RegisterResult {
61
+ islands?: IslandDescriptor[];
62
+ /** THE one wire question a compilation answers: can this file cross live content into an island?
63
+ * The transform owns all the evidence — static placement with children, a portable `{#snippet}`,
64
+ * a wake binding with no static placement (registry/each/`svelte:component`/prop hand-off, where
65
+ * call sites are compile-invisible), a `.ts`-minted wake region. One flag here, one rule below;
66
+ * the server encoder is not gated, so a missed case is a production app whose islands ALL fail
67
+ * with "Unknown type OgygiaRef" (the factory-registry regression). */
68
+ hasWireCrossing?: boolean;
69
+ }
70
+ export declare class Program {
71
+ /** keyed by virtual path → the island's registry row (entry / wrapper / region binding) */
72
+ readonly registry: Map<string, RegistryEntry>;
73
+ /** Absolute module ids in an island's CLIENT dependency graph. `$app/*` resolves to shims
74
+ * for these importers (virtual island module AND its transitive component imports). */
75
+ readonly island_graph: Set<string>;
76
+ /** iid -> entry virtual path (hydrate / defer / swr-lake) */
77
+ readonly by_id: Map<string, string>;
78
+ /** every region id -> kind (server manifest / emit) */
79
+ readonly region_kinds: Map<string, "hydrate" | "defer" | "lake">;
80
+ /** host abs path → region ids + virtual paths discovered on last transform of that host */
81
+ readonly host_index: Map<string, HostIndexEntry>;
82
+ /** region id → hosts still claiming it (cross-host dedupe: don't drop shared wrappers) */
83
+ readonly id_hosts: Map<string, Set<string>>;
84
+ /** Client-leg: hydrate island ids whose deterministic chunk has been emitFile'd (dedup across the
85
+ * buildStart prescan emit AND the transform-time emit that catches islands prescan can't see —
86
+ * those declared inside LIBRARY components, where the host lives outside the app's `src`). */
87
+ readonly emitted_island_chunks: Set<string>;
88
+ /** BUILD, server leg: every module id Vite actually transformed (`host_key`-normalised) — the
89
+ * server bundle's real graph. Handed to the client leg, which emits island chunks only for
90
+ * islands whose HOST is in it: the prescan registers every marked import under `src/`, but a
91
+ * host nothing imports (a second route tree's pages, a retired component) must not cost a
92
+ * chunk — or drag its imports into a client build whose server pass never saw them (a
93
+ * `.remote.ts` there fails Kit's "expected to find metadata" check). */
94
+ readonly ssr_transformed: Set<string>;
95
+ /** Absolute paths of app modules that define a transportable class (built during prescan). */
96
+ readonly transportable_modules: Set<string>;
97
+ /** PAGE MODULES (`b.pageModules()`: importers of a page specifier such as `'@ogygia/router'`, plus
98
+ * files named directly — server-router definition sites) + every walked
99
+ * module's import specifiers — the build data `virtual:ogygia/router-css` computes its
100
+ * component closure from (see link/router-css.ts). Filled during the prescan walk. */
101
+ readonly router_modules: Set<string>;
102
+ readonly module_specs: Map<string, string[]>;
103
+ /** flag()/experiment() call sites the prescan OBSERVED (modules importing 'ogygia' only) —
104
+ * written to node_modules/.ogygia/flags-manifest.json at build for CI flag-debt diffs. */
105
+ readonly flag_sites: FlagSite[];
106
+ /** SEED SHAPING: per module (query-less id, forward slashes), the top-level `page.data` keys its
107
+ * code reads — `'all'` when a read could not be pinned to a literal key. Recorded by the driver's
108
+ * transform for every module that imports Kit's page store (link/page-keys.ts); the client
109
+ * `writeBundle` unions them over each island's chunk closure (link/island-deps.ts), and the
110
+ * handle ships only those keys of `page.data`. */
111
+ readonly page_keys: Map<string, PageKeys>;
112
+ /** Per module that answered `'all'`: why, and on which line — the build report names it, so a
113
+ * developer sees the one read that makes a page ship its whole `page.data`. */
114
+ readonly page_key_reasons: Map<string, AllReason>;
115
+ /** Per module: the `helper(page)` calls into IMPORTED helpers the build follows at `writeBundle`
116
+ * (resolve the specifier, summarize the export, fold the answer into `page_keys`). */
117
+ readonly page_pending: Map<string, PendingCall[]>;
118
+ /** App crosses a held region / transportable value through Kit's `transport` hook — a `.remote.*`
119
+ * file, or a `region`/`site`/content import (loads & remotes that carry regions or wired values).
120
+ * Set during the prescan walk; with `runtime_marks.wire` it decides whether `ogygia.transport`
121
+ * (the generated `virtual:ogygia/kit-transport`) carries the codec cluster or is an empty map. */
122
+ crosses_wire: boolean;
123
+ /** Build-time capability marks for the sticky runtime entry. Incomplete → kitchen-sink. */
124
+ readonly runtime_marks: RuntimeMarks;
125
+ /** The resolved feature set folded into the runtime chunk name (busts the immutable URL when the
126
+ * app's feature set changes, not only when ogygia's source does). Filled by the driver's prescan;
127
+ * empty until then (dev serves the package entry). Both build legs prescan the same source → same
128
+ * hash → the server↔client filename handoff holds. */
129
+ runtime_feature_hash: string;
130
+ constructor(init: {
131
+ forms: boolean;
132
+ router: boolean;
133
+ });
134
+ note_runtime_mark(patch: Partial<RuntimeMarks>): void;
135
+ /** Drop this host's claims; shared region ids (cross-host dedupe) stay until unused. */
136
+ unregister_host(hostPath: string): void;
137
+ /** Replace this host's claims; shared ids keep one registry entry (path+strategy dedupe). */
138
+ register(result: RegisterResult, hostId: string): void;
139
+ }
140
+ export {};