@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,16 @@
1
+ /** The import a flag site comes through. (Moves into the flags plugin's compile facet once the
2
+ * compile port lands: internal/notes/packages.md.) */
3
+ export declare const FLAGS_SPEC = "@ogygia/flags";
4
+ export interface FlagSite {
5
+ name: string;
6
+ kind: "flag";
7
+ /** root-relative (or package-relative) posix path. */
8
+ file: string;
9
+ line: number;
10
+ }
11
+ export declare function collect_flag_sites(code: string, id: string, file: string): FlagSite[];
12
+ /** Stable, deduped (both build legs prescan) manifest shape. */
13
+ export declare function flags_manifest(sites: readonly FlagSite[]): {
14
+ flags: FlagSite[];
15
+ names: string[];
16
+ };
@@ -0,0 +1,101 @@
1
+ import { parse_module } from "./parse/oxc.js";
2
+ import { walk } from "estree-walker";
3
+ // src/compiler/flags.ts
4
+ /**
5
+ * Flag/experiment INVENTORY — pure OBSERVATION during the prescan. Nothing is rewritten, so per
6
+ * the macro law this is deliberately NOT an `import.meta.og.*` construct: the compiler only
7
+ * REPORTS what it saw. The build writes the collected sites to
8
+ * `node_modules/.ogygia/flags-manifest.json` — diff it in CI to catch flags that never die
9
+ * (flag debt: the reason Uber built a whole refactoring bot; an inventory is the law-abiding
10
+ * subset our file-local compiler can give for free).
11
+ *
12
+ * AST-walked, not text-matched (user ruling): `flag` is an ordinary function — a text sweep
13
+ * would miss `import { flag as f }` and false-positive on any local function that happens to be
14
+ * named `flag`. The walk resolves the module's ACTUAL bindings from `'@ogygia/flags'` (named, renamed,
15
+ * or namespace imports) and only counts calls through those. Known pragmatic limit (same as the
16
+ * macro family's): a local declaration SHADOWING an imported `flag` inside a nested scope is not
17
+ * scope-analyzed.
18
+ */
19
+ /** The import a flag site comes through. (Moves into the flags plugin's compile facet once the
20
+ * compile port lands: internal/notes/packages.md.) */
21
+ const FLAGS_SPEC = "@ogygia/flags";
22
+ const KINDS = /* @__PURE__ */ new Set(["flag"]);
23
+ /** Cheap pre-parse gate — most modules import ogygia for other reasons. */
24
+ const MAYBE_RE = /\bflag\b/;
25
+ /** All `<script …>` blocks of a `.svelte` file (instance AND module — flags can sit in either). */
26
+ const SCRIPT_BLOCK_RE = /<script\b[^>]*>([\s\S]*?)<\/script>/g;
27
+ const NL = 10;
28
+ function line_at(src, index, base_line) {
29
+ let line = base_line;
30
+ for (let i = 0; i < index; i++) if (src.charCodeAt(i) === NL) line++;
31
+ return line;
32
+ }
33
+ function string_arg(node) {
34
+ if (!node) return null;
35
+ if (node.type === "Literal" && typeof node.value === "string") return node.value;
36
+ if (node.type === "StringLiteral" && typeof node.value === "string") return node.value;
37
+ return null;
38
+ }
39
+ /** Walk ONE parsed js/ts body. `base_line` positions a svelte script block inside its file. */
40
+ function collect_from_source(src, id, file, base_line, out) {
41
+ const result = parse_module(src, id);
42
+ if (!result.ok || !result.program) return;
43
+ const locals = /* @__PURE__ */ new Map();
44
+ const namespaces = /* @__PURE__ */ new Set();
45
+ for (const node of result.program.body ?? []) {
46
+ if (node.type !== "ImportDeclaration") continue;
47
+ if (node.source?.value !== "@ogygia/flags") continue;
48
+ for (const s of node.specifiers ?? []) if (s.type === "ImportSpecifier") {
49
+ const imported = s.imported?.name;
50
+ if (KINDS.has(imported)) locals.set(s.local.name, imported);
51
+ } else if (s.type === "ImportNamespaceSpecifier") namespaces.add(s.local.name);
52
+ }
53
+ if (locals.size === 0 && namespaces.size === 0) return;
54
+ walk(result.program, { enter(n) {
55
+ const node = n;
56
+ if (node.type !== "CallExpression") return;
57
+ const callee = node.callee;
58
+ let kind;
59
+ if (callee?.type === "Identifier") kind = locals.get(callee.name);
60
+ else if (callee?.type === "MemberExpression" && callee.object?.type === "Identifier" && namespaces.has(callee.object.name) && callee.computed !== true && KINDS.has(callee.property?.name)) kind = callee.property.name;
61
+ if (!kind) return;
62
+ const name = string_arg(node.arguments?.[0]);
63
+ if (name == null) return;
64
+ out.push({
65
+ name,
66
+ kind,
67
+ file,
68
+ line: line_at(src, node.start ?? 0, base_line)
69
+ });
70
+ } });
71
+ }
72
+ function collect_flag_sites(code, id, file) {
73
+ if (!code.includes("ogygia") || !MAYBE_RE.test(code)) return [];
74
+ const out = [];
75
+ if (id.endsWith(".svelte")) {
76
+ SCRIPT_BLOCK_RE.lastIndex = 0;
77
+ let m;
78
+ while (m = SCRIPT_BLOCK_RE.exec(code)) {
79
+ const body_start = m.index + m[0].indexOf(">") + 1;
80
+ collect_from_source(m[1], id + ".ts", file, line_at(code, body_start, 1), out);
81
+ }
82
+ } else collect_from_source(code, id, file, 1, out);
83
+ return out;
84
+ }
85
+ /** Stable, deduped (both build legs prescan) manifest shape. */
86
+ function flags_manifest(sites) {
87
+ const seen = /* @__PURE__ */ new Set();
88
+ const flags = [];
89
+ for (const s of sites) {
90
+ const k = `${s.kind}\0${s.name}\0${s.file}\0${s.line}`;
91
+ if (seen.has(k)) continue;
92
+ seen.add(k);
93
+ flags.push(s);
94
+ }
95
+ flags.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : a.file < b.file ? -1 : 1);
96
+ return {
97
+ flags,
98
+ names: [...new Set(flags.map((f) => f.name))].sort()
99
+ };
100
+ }
101
+ export { FLAGS_SPEC, collect_flag_sites, flags_manifest };
@@ -0,0 +1,97 @@
1
+ export declare const FOUC_CSS_PREFIX = "virtual:ogygia/fouc-css/";
2
+ export declare const FOUC_SCOPED_PREFIX = "virtual:ogygia/fouc-scoped/";
3
+ /** @param relPosix */
4
+ export declare function foucCssVirtualId(relPosix: string): string;
5
+ /** @param relPosix */
6
+ export declare function foucScopedVirtualId(relPosix: string): string;
7
+ /** @param id */
8
+ export declare function isFoucCssId(id: string): boolean;
9
+ /** @param id */
10
+ export declare function isFoucScopedId(id: string): boolean;
11
+ /** @param id */
12
+ export declare function foucRelFromId(id: string): string | null;
13
+ /**
14
+ * Resolve a static import specifier against an importer file + `$lib`.
15
+ * @param spec
16
+ * @param importerAbs
17
+ * @param libDir
18
+ */
19
+ /** One resolved Vite alias (`resolve.alias`, normalized) — Kit's `kit.alias` entries arrive here. */
20
+ export interface FoucAlias {
21
+ find: string | RegExp;
22
+ replacement: string;
23
+ }
24
+ export declare function resolveFoucImportSpec(spec: string, importerAbs: string, libDir: string, alias?: readonly FoucAlias[]): string | null;
25
+ /**
26
+ * Collect side-effect import specs that pull island CSS into the client graph without JS.
27
+ * @param entryAbs absolute path to the island entry `.svelte`
28
+ * @param opts
29
+ */
30
+ export declare function buildFoucCssModuleSource(entryAbs: string, opts: CssReachOptions): Promise<string>;
31
+ /**
32
+ * The transitive CSS-reachability walk under `buildFoucCssModuleSource`, exported on its own for the
33
+ * server-router CSS registry (link/router-css.ts): from a component entry, in DISCOVERY ORDER (the
34
+ * cascade order the aggregator has always imported in), every `.svelte` with a `<style>` block
35
+ * (`kind: 'scoped'`) and every plain style-file import (`kind: 'css'`) reachable through the
36
+ * component tree. Abs paths. Same resolution rules as the aggregator, so both stay in lockstep.
37
+ */
38
+ export interface CssReachOptions {
39
+ root: string;
40
+ libDir: string;
41
+ readFile?: (p: string) => string | null;
42
+ /** app aliases to follow (`$lib_x/…`, `@scope/pkg/…` → source dirs) — the fallback resolver's */
43
+ alias?: readonly FoucAlias[];
44
+ /**
45
+ * The bundler's own resolver (Vite's `this.resolve`): a package specifier through its `exports`
46
+ * (a TypeScript entry included), a workspace link, an alias — whatever the build resolves. Without
47
+ * it (a unit test, a host with no bundler) `$lib`, relative paths and `alias` only.
48
+ */
49
+ resolve?: (spec: string, importer: string) => Promise<string | null>;
50
+ }
51
+ /**
52
+ * THE CSS A COMPONENT TREE REACHES — every `.svelte` with a `<style>` block (`kind: 'scoped'`) and
53
+ * every plain style-file import (`kind: 'css'`), in DISCOVERY ORDER (the cascade order the aggregator
54
+ * has always imported in). Abs paths.
55
+ *
56
+ * A subtree no client chunk carries (a server-only hole, a router page, a lake) gets its CSS from
57
+ * here, so this walk must reach what the bundler reaches — a component imported through a workspace
58
+ * package's TypeScript barrel came back unstyled: its specifier was not resolved, and a `.ts` module
59
+ * was a dead end. So:
60
+ * - specifiers resolve through the bundler's resolver (`opts.resolve`) when the build has one;
61
+ * - a `.svelte` file is a component: all of it renders, so every import of it is followed;
62
+ * - a script module is followed by the NAMES taken from it: through a barrel (the debarrel index —
63
+ * nested barrels, `export *`), each name to its leaf, so a barrel of twenty components brings the
64
+ * CSS of the two imported; a module with code of its own, every import it makes (its code may
65
+ * render them). A dependency's own JavaScript (`node_modules`, not a barrel) is not walked: a
66
+ * package ships compiled code, its components as `.svelte` files a barrel names.
67
+ */
68
+ export declare function collectFoucCssReachable(entryAbs: string, opts: CssReachOptions): Promise<Array<{
69
+ kind: "scoped" | "css";
70
+ abs: string;
71
+ }>>;
72
+ /**
73
+ * Compile scoped CSS for a `.svelte` file (filename must match SSR for hash stability).
74
+ * @param abs
75
+ * @param source
76
+ */
77
+ export declare function compileFoucScopedCss(abs: string, source: string, opts?: {
78
+ /** Keep the `<script>` (already free of TS/dialects): a template reading `$store` from an
79
+ * imported store, or any script-declared name, only compiles WITH its script. Stripping it
80
+ * throws on such a template and falls back to UNSCOPED style bodies — which match nothing
81
+ * the SSR'd markup carries. Without it (a source that may still carry TypeScript), the
82
+ * source is tried whole first (Svelte reads `lang="ts"` itself), then script-stripped. */
83
+ keepScript?: boolean;
84
+ }): string;
85
+ /** @param source */
86
+ export declare function svelteHasStyle(source: string): boolean;
87
+ /**
88
+ * Static import sources from a Svelte file's script blocks (default + side-effect).
89
+ * @param source
90
+ * @param filename
91
+ */
92
+ /** A component's static imports: each specifier with the names it takes (`*` for a namespace;
93
+ * none for a bare `import 'x'`). Type-only imports are left out: they bring nothing at runtime. */
94
+ export declare function listStaticImports(source: string, filename: string): Array<{
95
+ source: string;
96
+ names: Set<string>;
97
+ }>;
@@ -0,0 +1,335 @@
1
+ import { fs, path } from "./host.js";
2
+ import { unscoped_marker } from "../unscoped-css.js";
3
+ import { blank_styles } from "./blank-styles.js";
4
+ import { BarrelIndex } from "./debarrel/barrel.js";
5
+ import { analyze_exports, analyze_imports } from "./debarrel/parse.js";
6
+ import { compile, parse } from "svelte/compiler";
7
+ import { walk } from "estree-walker";
8
+ // src/compiler/fouc-css.ts
9
+ /**
10
+ * csr=false FOUC without dual-owning island component JS.
11
+ *
12
+ * Kit only links stylesheets from the *client* page graph. Importing the authored `.svelte`
13
+ * for that purpose (0.4.1) puts the same default-export module in the page graph and the
14
+ * `emitFile` island entry → Rolldown thin-facades `og-region.*`.
15
+ *
16
+ * Hosts instead import `virtual:ogygia/fouc-css/<encoded>.js` which side-effect-imports:
17
+ * - plain `.css` files reachable from the entry
18
+ * - `virtual:ogygia/fouc-scoped/<encoded>.css` for each `.svelte` with a `<style>` block
19
+ * Aggregator ids end in `.js` and scoped ids in `.css` so vite-plugin-svelte / Vite classify
20
+ * them correctly (never as `.svelte` components). Scoped CSS is compiled with the real
21
+ * filename so hashes match SSR.
22
+ */
23
+ const FOUC_CSS_PREFIX = "virtual:ogygia/fouc-css/";
24
+ const FOUC_SCOPED_PREFIX = "virtual:ogygia/fouc-scoped/";
25
+ const PATH_SEP = /[/\\]/;
26
+ const SCRIPT_TAG = /<script\b[^>]*>[\s\S]*?<\/script>/gi;
27
+ const STYLE_OPEN = /<style\b/i;
28
+ const STYLE_BODY = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
29
+ const STYLE_EXT = /\.(css|scss|sass|less|styl|stylus|pcss)(?:\?|$)/i;
30
+ const SVELTE_EXT = /\.svelte(?:\?|$)/i;
31
+ const IMPORT_SPEC = /import\s+(?:[\s\S]*?\s+from\s+)?["']([^"']+\.(?:svelte|css|scss|sass|less|styl|pcss)(?:\?[^"']*)?)["']/g;
32
+ const WIN_DRIVE_RE = /^[a-zA-Z]:/;
33
+ const PARENT_TRAVERSAL_RE = /(^|[\\/])\.\.([\\/]|$)/;
34
+ /** @param relPosix */
35
+ function foucCssVirtualId(relPosix) {
36
+ return FOUC_CSS_PREFIX + encodeURIComponent(relPosix.split(PATH_SEP).join("/")) + ".js";
37
+ }
38
+ /** @param relPosix */
39
+ function foucScopedVirtualId(relPosix) {
40
+ return FOUC_SCOPED_PREFIX + encodeURIComponent(relPosix.split(PATH_SEP).join("/")) + ".css";
41
+ }
42
+ /** @param id */
43
+ function isFoucCssId(id) {
44
+ const bare = id.startsWith("\0") ? id.slice(1) : id;
45
+ return bare.startsWith("virtual:ogygia/fouc-css/") && bare.endsWith(".js");
46
+ }
47
+ /** @param id */
48
+ function isFoucScopedId(id) {
49
+ const bare = id.startsWith("\0") ? id.slice(1) : id;
50
+ return bare.startsWith("virtual:ogygia/fouc-scoped/") && bare.endsWith(".css");
51
+ }
52
+ /** @param id */
53
+ function foucRelFromId(id) {
54
+ const bare = id.startsWith("\0") ? id.slice(1) : id;
55
+ let encoded = null;
56
+ if (bare.startsWith("virtual:ogygia/fouc-css/") && bare.endsWith(".js")) encoded = bare.slice(24, -3);
57
+ else if (bare.startsWith("virtual:ogygia/fouc-scoped/") && bare.endsWith(".css")) encoded = bare.slice(27, -4);
58
+ if (encoded == null) return null;
59
+ let rel;
60
+ try {
61
+ rel = decodeURIComponent(encoded);
62
+ } catch {
63
+ rel = encoded;
64
+ }
65
+ if (rel.startsWith("/") || rel.startsWith("\\") || WIN_DRIVE_RE.test(rel) || PARENT_TRAVERSAL_RE.test(rel)) return null;
66
+ return rel;
67
+ }
68
+ function resolveFoucImportSpec(spec, importerAbs, libDir, alias = []) {
69
+ if (spec === "$lib" || spec.startsWith("$lib/")) return path.join(libDir, spec === "$lib" ? "" : spec.slice(5));
70
+ if (spec.startsWith(".")) return path.resolve(path.dirname(importerAbs), spec);
71
+ for (const a of alias) if (typeof a.find === "string") {
72
+ if (spec === a.find) return a.replacement;
73
+ if (spec.startsWith(a.find + "/")) return a.replacement + spec.slice(a.find.length);
74
+ } else if (a.find.test(spec)) return spec.replace(a.find, a.replacement);
75
+ return null;
76
+ }
77
+ /**
78
+ * Collect side-effect import specs that pull island CSS into the client graph without JS.
79
+ * @param entryAbs absolute path to the island entry `.svelte`
80
+ * @param opts
81
+ */
82
+ async function buildFoucCssModuleSource(entryAbs, opts) {
83
+ const entries = await collectFoucCssReachable(entryAbs, opts);
84
+ const posix_rel = (abs) => path.relative(opts.root, abs).split(PATH_SEP).join("/");
85
+ const imports = [];
86
+ for (const e of entries) if (e.kind !== "scoped") imports.push(e.abs);
87
+ else {
88
+ const rel = posix_rel(e.abs);
89
+ if (!rel.startsWith("../") && !path.isAbsolute(rel)) imports.push(foucScopedVirtualId(rel));
90
+ }
91
+ if (imports.length === 0) return "export {}";
92
+ return imports.map((s) => `import ${JSON.stringify(s)};`).join("\n") + "\n";
93
+ }
94
+ const SCRIPT_MODULE_EXT = /\.(?:[cm]?[jt]sx?|svelte\.[jt]s)$/;
95
+ const RESOLVE_SUFFIXES = [
96
+ "",
97
+ ".ts",
98
+ ".js",
99
+ "/index.ts",
100
+ "/index.js"
101
+ ];
102
+ const NODE_MODULES_RE = /[\\/]node_modules[\\/]/;
103
+ /** every name a module exports — a namespace import, or a module reached for its own code */
104
+ const ALL = "*";
105
+ /** the barrel index of each bundler resolver (one per build's legs: see `collectFoucCssReachable`) */
106
+ const barrel_indexes = /* @__PURE__ */ new WeakMap();
107
+ /**
108
+ * THE CSS A COMPONENT TREE REACHES — every `.svelte` with a `<style>` block (`kind: 'scoped'`) and
109
+ * every plain style-file import (`kind: 'css'`), in DISCOVERY ORDER (the cascade order the aggregator
110
+ * has always imported in). Abs paths.
111
+ *
112
+ * A subtree no client chunk carries (a server-only hole, a router page, a lake) gets its CSS from
113
+ * here, so this walk must reach what the bundler reaches — a component imported through a workspace
114
+ * package's TypeScript barrel came back unstyled: its specifier was not resolved, and a `.ts` module
115
+ * was a dead end. So:
116
+ * - specifiers resolve through the bundler's resolver (`opts.resolve`) when the build has one;
117
+ * - a `.svelte` file is a component: all of it renders, so every import of it is followed;
118
+ * - a script module is followed by the NAMES taken from it: through a barrel (the debarrel index —
119
+ * nested barrels, `export *`), each name to its leaf, so a barrel of twenty components brings the
120
+ * CSS of the two imported; a module with code of its own, every import it makes (its code may
121
+ * render them). A dependency's own JavaScript (`node_modules`, not a barrel) is not walked: a
122
+ * package ships compiled code, its components as `.svelte` files a barrel names.
123
+ */
124
+ async function collectFoucCssReachable(entryAbs, opts) {
125
+ const read = opts.readFile || ((p) => {
126
+ try {
127
+ return fs.readFileSync(p, "utf8");
128
+ } catch {
129
+ return null;
130
+ }
131
+ });
132
+ const resolve = async (spec, importer) => {
133
+ if (opts.resolve) {
134
+ const id = await opts.resolve(spec, importer);
135
+ return id ? path.normalize(id.split("?")[0]) : null;
136
+ }
137
+ const base = resolveFoucImportSpec(spec, importer, opts.libDir, opts.alias);
138
+ if (!base) return null;
139
+ const clean = base.split("?")[0];
140
+ if (STYLE_EXT.test(clean) || SVELTE_EXT.test(clean)) return path.normalize(clean);
141
+ for (const suffix of RESOLVE_SUFFIXES) {
142
+ const candidate = path.normalize(clean + suffix);
143
+ if (read(candidate) != null) return candidate;
144
+ }
145
+ return null;
146
+ };
147
+ let barrels = opts.resolve ? barrel_indexes.get(opts.resolve) : void 0;
148
+ if (!barrels) {
149
+ barrels = new BarrelIndex({
150
+ read: (id) => read(id),
151
+ resolve: (spec, importer) => resolve(spec, importer),
152
+ candidate: () => true,
153
+ forced: () => false,
154
+ kept: () => false,
155
+ follow_packages: true
156
+ });
157
+ if (opts.resolve) barrel_indexes.set(opts.resolve, barrels);
158
+ }
159
+ const entries = [];
160
+ const seen_css = /* @__PURE__ */ new Set();
161
+ const seen_svelte = /* @__PURE__ */ new Set();
162
+ /** script module → the names already followed (`*`: all of them) */
163
+ const seen_names = /* @__PURE__ */ new Map();
164
+ const visit = async (abs, names, spec) => {
165
+ if (STYLE_EXT.test(abs)) {
166
+ if (!seen_css.has(abs)) {
167
+ seen_css.add(abs);
168
+ entries.push({
169
+ kind: "css",
170
+ abs
171
+ });
172
+ }
173
+ } else if (SVELTE_EXT.test(abs)) await visit_svelte(abs);
174
+ else if (SCRIPT_MODULE_EXT.test(abs)) await visit_script(abs, names, spec);
175
+ };
176
+ const follow = async (decls, importer) => {
177
+ for (const d of decls) {
178
+ const resolved = await resolve(d.source, importer);
179
+ if (resolved) await visit(resolved, d.names, d.source);
180
+ }
181
+ };
182
+ const visit_svelte = async (abs) => {
183
+ if (seen_svelte.has(abs)) return;
184
+ seen_svelte.add(abs);
185
+ const source = read(abs);
186
+ if (source == null) return;
187
+ if (svelteHasStyle(source)) entries.push({
188
+ kind: "scoped",
189
+ abs
190
+ });
191
+ await follow(listStaticImports(source, abs), abs);
192
+ };
193
+ const visit_script = async (abs, names, spec) => {
194
+ let done = seen_names.get(abs);
195
+ if (!done) seen_names.set(abs, done = /* @__PURE__ */ new Set());
196
+ if (done.has(ALL)) return;
197
+ const wanted = names.has(ALL) ? [ALL] : [...names].filter((n) => !done.has(n));
198
+ if (!wanted.length) return;
199
+ for (const n of wanted) done.add(n);
200
+ const map = await barrels.map(abs, spec);
201
+ if (map && !wanted.includes(ALL)) {
202
+ const own = [];
203
+ for (const n of wanted) {
204
+ const entry = map.entries.get(n);
205
+ if (entry && typeof entry === "object") await visit(entry.id, /* @__PURE__ */ new Set(["namespace" in entry ? ALL : entry.name]), entry.id);
206
+ else own.push(n);
207
+ }
208
+ if (!own.length && !map.opaque) return;
209
+ }
210
+ if (NODE_MODULES_RE.test(abs)) return;
211
+ const code = read(abs);
212
+ if (code == null) return;
213
+ const decls = analyze_imports(code, abs);
214
+ if (!decls) return;
215
+ await follow(decls.filter((d) => !d.type_only).map((d) => ({
216
+ source: d.source,
217
+ names: new Set(d.side_effect ? [] : d.specs.filter((s) => !s.type_only).map((s) => s.kind === "namespace" ? ALL : s.imported))
218
+ })), abs);
219
+ const shape = analyze_exports(code, abs);
220
+ if (shape) await follow(shape.exports.flatMap((e) => e.kind === "reexport" && !e.type_only ? [{
221
+ source: e.source,
222
+ names: /* @__PURE__ */ new Set([e.imported])
223
+ }] : e.kind === "star" && !e.type_only ? [{
224
+ source: e.source,
225
+ names: /* @__PURE__ */ new Set([ALL])
226
+ }] : e.kind === "star_ns" ? [{
227
+ source: e.source,
228
+ names: /* @__PURE__ */ new Set([ALL])
229
+ }] : []), abs);
230
+ };
231
+ await visit_svelte(path.normalize(entryAbs));
232
+ return entries;
233
+ }
234
+ /**
235
+ * Compile scoped CSS for a `.svelte` file (filename must match SSR for hash stability).
236
+ * @param abs
237
+ * @param source
238
+ */
239
+ function compileFoucScopedCss(abs, source, opts = {}) {
240
+ const inputs = opts.keepScript ? [source] : [source, source.replace(SCRIPT_TAG, "")];
241
+ let err;
242
+ for (const input of inputs) try {
243
+ return compile(input, {
244
+ filename: abs,
245
+ generate: "client",
246
+ css: "external",
247
+ discloseVersion: false,
248
+ experimental: { async: true }
249
+ }).css?.code ?? "";
250
+ } catch (e) {
251
+ err ??= e;
252
+ }
253
+ const why = err.message.split("\n")[0];
254
+ if (opts.keepScript) console.warn(`[ogygia] scoped CSS for ${abs} could not be compiled (${why}) — shipping its style bodies unscoped`);
255
+ const raw = extractRawStyleBodies(source);
256
+ return raw ? unscoped_marker(abs, why) + raw : raw;
257
+ }
258
+ /** @param source */
259
+ function svelteHasStyle(source) {
260
+ return STYLE_OPEN.test(source);
261
+ }
262
+ /**
263
+ * Unwrap `:global(SELECTOR)` → `SELECTOR`. `:global(...)` is a Svelte construct, not CSS — left
264
+ * literal in a raw style body (the fallback below never runs the Svelte compiler) the browser drops
265
+ * the whole rule. This fallback already ships styles UNSCOPED, so a global-wrapped selector is just
266
+ * the selector. Balanced-paren scan so `:global(x:not(.y))` unwraps to `x:not(.y)`, not `x:not(.y`.
267
+ */
268
+ function unwrap_global(css) {
269
+ let out = "";
270
+ let i = 0;
271
+ while (i < css.length) {
272
+ const at = css.indexOf(":global(", i);
273
+ if (at === -1) {
274
+ out += css.slice(i);
275
+ break;
276
+ }
277
+ out += css.slice(i, at);
278
+ let depth = 1;
279
+ let j = at + 8;
280
+ for (; j < css.length && depth > 0; j++) if (css[j] === "(") depth++;
281
+ else if (css[j] === ")") depth--;
282
+ out += css.slice(at + 8, j - 1);
283
+ i = j;
284
+ }
285
+ return out;
286
+ }
287
+ /** @param source */
288
+ function extractRawStyleBodies(source) {
289
+ return unwrap_global([...source.matchAll(STYLE_BODY)].map((m) => m[1]).join("\n"));
290
+ }
291
+ /**
292
+ * Static import sources from a Svelte file's script blocks (default + side-effect).
293
+ * @param source
294
+ * @param filename
295
+ */
296
+ /** A component's static imports: each specifier with the names it takes (`*` for a namespace;
297
+ * none for a bare `import 'x'`). Type-only imports are left out: they bring nothing at runtime. */
298
+ function listStaticImports(source, filename) {
299
+ const out = [];
300
+ try {
301
+ const ast = parse(blank_styles(source), {
302
+ filename,
303
+ modern: true
304
+ });
305
+ const scripts = [ast.instance, ast.module].filter(Boolean);
306
+ for (const block of scripts) {
307
+ const content = block?.content;
308
+ if (!content || content.type !== "Program") continue;
309
+ walk(content, { enter(node) {
310
+ if (node.type !== "ImportDeclaration") return;
311
+ const decl = node;
312
+ const src = decl.source?.value;
313
+ if (typeof src !== "string" || decl.importKind === "type") return;
314
+ const names = /* @__PURE__ */ new Set();
315
+ for (const s of decl.specifiers ?? []) {
316
+ if (s.importKind === "type") continue;
317
+ if (s.type === "ImportDefaultSpecifier") names.add("default");
318
+ else if (s.type === "ImportNamespaceSpecifier") names.add(ALL);
319
+ else names.add(s.imported?.name ?? s.imported?.value ?? ALL);
320
+ }
321
+ out.push({
322
+ source: src,
323
+ names
324
+ });
325
+ } });
326
+ }
327
+ } catch {
328
+ for (const m of source.matchAll(IMPORT_SPEC)) out.push({
329
+ source: m[1],
330
+ names: /* @__PURE__ */ new Set([ALL])
331
+ });
332
+ }
333
+ return out;
334
+ }
335
+ export { FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, buildFoucCssModuleSource, collectFoucCssReachable, compileFoucScopedCss, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, isFoucCssId, isFoucScopedId, listStaticImports, resolveFoucImportSpec, svelteHasStyle };
@@ -0,0 +1,20 @@
1
+ import { SvelteNode } from "./region/ir.js";
2
+ /** Collect all snippet names defined anywhere in a subtree (for cross-boundary error detection). */
3
+ export declare function collectSnippetNames(nodes: SvelteNode[]): Set<unknown>;
4
+ /**
5
+ * @param nodes hoisted subtree top-level nodes
6
+ * @returns free identifier names + free mutation targets + `$store` read sites
7
+ */
8
+ export declare function collectCaptureInfo(nodes: SvelteNode[]): {
9
+ free: Set<string>;
10
+ mutated: Set<string>;
11
+ stores: Map<string, {
12
+ start: number;
13
+ end: number;
14
+ }[]>;
15
+ };
16
+ /**
17
+ * @param nodes hoisted subtree top-level nodes
18
+ * @returns free identifier names
19
+ */
20
+ export declare function collectFreeIdentifiers(nodes: SvelteNode[]): Set<string>;