@askrjs/askr 0.0.27 → 0.0.29

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 (442) hide show
  1. package/README.md +55 -147
  2. package/dist/_virtual/_rolldown/runtime.js +7 -0
  3. package/dist/bench/components/benchmark-row.d.ts +20 -0
  4. package/dist/bench/components/benchmark-row.d.ts.map +1 -0
  5. package/dist/bench/components/benchmark-row.js +42 -0
  6. package/dist/bench/components/benchmark-row.js.map +1 -0
  7. package/dist/bench/components/benchmark-table.js +25 -0
  8. package/dist/bench/components/benchmark-table.js.map +1 -0
  9. package/dist/benchmark.d.ts +22 -0
  10. package/dist/benchmark.d.ts.map +1 -0
  11. package/dist/benchmark.js +64 -1
  12. package/dist/benchmark.js.map +1 -0
  13. package/dist/bin/askr-ssg.d.ts +28 -0
  14. package/dist/bin/askr-ssg.d.ts.map +1 -0
  15. package/dist/bin/askr-ssg.js +171 -0
  16. package/dist/bin/askr-ssg.js.map +1 -0
  17. package/dist/boot/index.d.ts +64 -42
  18. package/dist/boot/index.d.ts.map +1 -1
  19. package/dist/boot/index.js +416 -2
  20. package/dist/boot/index.js.map +1 -0
  21. package/dist/common/component.d.ts +14 -13
  22. package/dist/common/component.d.ts.map +1 -1
  23. package/dist/common/control.d.ts +13 -0
  24. package/dist/common/control.d.ts.map +1 -0
  25. package/dist/common/control.js +14 -0
  26. package/dist/common/control.js.map +1 -0
  27. package/dist/common/env.js +47 -0
  28. package/dist/common/env.js.map +1 -0
  29. package/dist/common/jsx.d.ts +17 -15
  30. package/dist/common/jsx.d.ts.map +1 -1
  31. package/dist/common/jsx.js +8 -1
  32. package/dist/common/jsx.js.map +1 -0
  33. package/dist/common/props.d.ts +14 -11
  34. package/dist/common/props.d.ts.map +1 -1
  35. package/dist/common/router.d.ts +190 -32
  36. package/dist/common/router.d.ts.map +1 -1
  37. package/dist/common/ssr-errors.d.ts +6 -3
  38. package/dist/common/ssr-errors.d.ts.map +1 -1
  39. package/dist/common/ssr-errors.js +16 -1
  40. package/dist/common/ssr-errors.js.map +1 -0
  41. package/dist/common/ssr.d.ts +12 -9
  42. package/dist/common/ssr.d.ts.map +1 -1
  43. package/dist/common/vnode.d.ts +17 -15
  44. package/dist/common/vnode.d.ts.map +1 -1
  45. package/dist/common/vnode.js +10 -1
  46. package/dist/common/vnode.js.map +1 -0
  47. package/dist/components/link.d.ts +37 -25
  48. package/dist/components/link.d.ts.map +1 -1
  49. package/dist/components/link.js +64 -1
  50. package/dist/components/link.js.map +1 -0
  51. package/dist/control/case.d.ts +17 -0
  52. package/dist/control/case.d.ts.map +1 -0
  53. package/dist/control/case.js +69 -0
  54. package/dist/control/case.js.map +1 -0
  55. package/dist/control/for.d.ts +23 -0
  56. package/dist/control/for.d.ts.map +1 -0
  57. package/dist/control/for.js +62 -0
  58. package/dist/control/for.js.map +1 -0
  59. package/dist/control/index.d.ts +4 -0
  60. package/dist/control/index.js +4 -0
  61. package/dist/control/shared.js +20 -0
  62. package/dist/control/shared.js.map +1 -0
  63. package/dist/control/show.d.ts +14 -0
  64. package/dist/control/show.d.ts.map +1 -0
  65. package/dist/control/show.js +33 -0
  66. package/dist/control/show.js.map +1 -0
  67. package/dist/dev/invariant.js +29 -2
  68. package/dist/dev/invariant.js.map +1 -0
  69. package/dist/dev/logger.js +37 -1
  70. package/dist/dev/logger.js.map +1 -0
  71. package/dist/foundations/icon/icon.d.ts +53 -0
  72. package/dist/foundations/icon/icon.d.ts.map +1 -0
  73. package/dist/foundations/icon/icon.js +88 -0
  74. package/dist/foundations/icon/icon.js.map +1 -0
  75. package/dist/foundations/icon/icon.types.d.ts +21 -0
  76. package/dist/foundations/icon/icon.types.d.ts.map +1 -0
  77. package/dist/foundations/index.d.ts +10 -3
  78. package/dist/foundations/index.js +9 -1
  79. package/dist/foundations/interactions/interaction-policy.js +93 -1
  80. package/dist/foundations/interactions/interaction-policy.js.map +1 -0
  81. package/dist/foundations/interactions/pressable.js +51 -1
  82. package/dist/foundations/interactions/pressable.js.map +1 -0
  83. package/dist/foundations/structures/collection.d.ts +25 -40
  84. package/dist/foundations/structures/collection.d.ts.map +1 -1
  85. package/dist/foundations/structures/collection.js +51 -1
  86. package/dist/foundations/structures/collection.js.map +1 -0
  87. package/dist/foundations/structures/layer.d.ts +47 -68
  88. package/dist/foundations/structures/layer.d.ts.map +1 -1
  89. package/dist/foundations/structures/layer.js +81 -1
  90. package/dist/foundations/structures/layer.js.map +1 -0
  91. package/dist/foundations/structures/layout.d.ts +6 -3
  92. package/dist/foundations/structures/layout.d.ts.map +1 -1
  93. package/dist/foundations/structures/layout.js +13 -1
  94. package/dist/foundations/structures/layout.js.map +1 -0
  95. package/dist/foundations/structures/portal.d.ts +17 -10
  96. package/dist/foundations/structures/portal.d.ts.map +1 -1
  97. package/dist/foundations/structures/portal.js +105 -1
  98. package/dist/foundations/structures/portal.js.map +1 -0
  99. package/dist/foundations/structures/presence.d.ts +11 -5
  100. package/dist/foundations/structures/presence.d.ts.map +1 -1
  101. package/dist/foundations/structures/presence.js +39 -1
  102. package/dist/foundations/structures/presence.js.map +1 -0
  103. package/dist/foundations/structures/slot.d.ts +11 -8
  104. package/dist/foundations/structures/slot.d.ts.map +1 -1
  105. package/dist/foundations/structures/slot.js +41 -1
  106. package/dist/foundations/structures/slot.js.map +1 -0
  107. package/dist/foundations/structures.d.ts +7 -14
  108. package/dist/foundations/structures.js +6 -1
  109. package/dist/foundations/utilities/aria.js +11 -1
  110. package/dist/foundations/utilities/aria.js.map +1 -0
  111. package/dist/foundations/utilities/compose-handlers.js +20 -1
  112. package/dist/foundations/utilities/compose-handlers.js.map +1 -0
  113. package/dist/foundations/utilities/compose-ref.d.ts +7 -4
  114. package/dist/foundations/utilities/compose-ref.d.ts.map +1 -1
  115. package/dist/foundations/utilities/compose-ref.js +18 -1
  116. package/dist/foundations/utilities/compose-ref.js.map +1 -0
  117. package/dist/foundations/utilities/merge-props.js +49 -1
  118. package/dist/foundations/utilities/merge-props.js.map +1 -0
  119. package/dist/fx/fx.d.ts +24 -21
  120. package/dist/fx/fx.d.ts.map +1 -1
  121. package/dist/fx/fx.js +212 -1
  122. package/dist/fx/fx.js.map +1 -0
  123. package/dist/fx/index.d.ts +4 -7
  124. package/dist/fx/index.js +4 -1
  125. package/dist/fx/noop.js +9 -1
  126. package/dist/fx/noop.js.map +1 -0
  127. package/dist/fx/timing.d.ts +24 -21
  128. package/dist/fx/timing.d.ts.map +1 -1
  129. package/dist/fx/timing.js +236 -1
  130. package/dist/fx/timing.js.map +1 -0
  131. package/dist/index.d.ts +21 -20
  132. package/dist/index.js +34 -1
  133. package/dist/index.js.map +1 -0
  134. package/dist/jsx/index.d.ts +1 -4
  135. package/dist/jsx/index.js +3 -1
  136. package/dist/jsx/types.d.ts +18 -25
  137. package/dist/jsx/types.d.ts.map +1 -1
  138. package/dist/jsx/types.js +1 -1
  139. package/dist/jsx/utils.d.ts +4 -3
  140. package/dist/jsx/utils.d.ts.map +1 -1
  141. package/dist/jsx/utils.js +19 -1
  142. package/dist/jsx/utils.js.map +1 -0
  143. package/dist/jsx-dev-runtime.d.ts +8 -0
  144. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  145. package/dist/jsx-dev-runtime.js +32 -1
  146. package/dist/jsx-dev-runtime.js.map +1 -0
  147. package/dist/jsx-runtime.d.ts +12 -0
  148. package/dist/jsx-runtime.d.ts.map +1 -0
  149. package/dist/jsx-runtime.js +45 -1
  150. package/dist/jsx-runtime.js.map +1 -0
  151. package/dist/jsx-runtime2.d.ts +2 -0
  152. package/dist/jsx-runtime2.js +3 -0
  153. package/dist/renderer/children.js +293 -0
  154. package/dist/renderer/children.js.map +1 -0
  155. package/dist/renderer/cleanup.js +150 -1
  156. package/dist/renderer/cleanup.js.map +1 -0
  157. package/dist/renderer/dom.js +2439 -1
  158. package/dist/renderer/dom.js.map +1 -0
  159. package/dist/renderer/env.js +1 -0
  160. package/dist/renderer/evaluate.js +450 -1
  161. package/dist/renderer/evaluate.js.map +1 -0
  162. package/dist/renderer/fastpath.js +145 -1
  163. package/dist/renderer/fastpath.js.map +1 -0
  164. package/dist/renderer/index.js +24 -1
  165. package/dist/renderer/index.js.map +1 -0
  166. package/dist/renderer/keyed.js +119 -1
  167. package/dist/renderer/keyed.js.map +1 -0
  168. package/dist/renderer/reconcile.js +359 -1
  169. package/dist/renderer/reconcile.js.map +1 -0
  170. package/dist/renderer/types.js +1 -1
  171. package/dist/renderer/utils.js +220 -1
  172. package/dist/renderer/utils.js.map +1 -0
  173. package/dist/resources/index.d.ts +3 -9
  174. package/dist/resources/index.js +3 -1
  175. package/dist/router/index.d.ts +6 -10
  176. package/dist/router/index.js +5 -1
  177. package/dist/router/match.js +83 -1
  178. package/dist/router/match.js.map +1 -0
  179. package/dist/router/navigate.d.ts +20 -8
  180. package/dist/router/navigate.d.ts.map +1 -1
  181. package/dist/router/navigate.js +288 -1
  182. package/dist/router/navigate.js.map +1 -0
  183. package/dist/router/policy.d.ts +22 -0
  184. package/dist/router/policy.d.ts.map +1 -0
  185. package/dist/router/policy.js +116 -0
  186. package/dist/router/policy.js.map +1 -0
  187. package/dist/router/route-context.js +79 -0
  188. package/dist/router/route-context.js.map +1 -0
  189. package/dist/router/route.d.ts +101 -33
  190. package/dist/router/route.d.ts.map +1 -1
  191. package/dist/router/route.js +599 -1
  192. package/dist/router/route.js.map +1 -0
  193. package/dist/runtime/child-scope.d.ts +21 -0
  194. package/dist/runtime/child-scope.d.ts.map +1 -0
  195. package/dist/runtime/child-scope.js +77 -0
  196. package/dist/runtime/child-scope.js.map +1 -0
  197. package/dist/runtime/component.d.ts +67 -53
  198. package/dist/runtime/component.d.ts.map +1 -1
  199. package/dist/runtime/component.js +462 -1
  200. package/dist/runtime/component.js.map +1 -0
  201. package/dist/runtime/context.d.ts +28 -42
  202. package/dist/runtime/context.d.ts.map +1 -1
  203. package/dist/runtime/context.js +205 -1
  204. package/dist/runtime/context.js.map +1 -0
  205. package/dist/runtime/control.d.ts +43 -0
  206. package/dist/runtime/control.d.ts.map +1 -0
  207. package/dist/runtime/control.js +125 -0
  208. package/dist/runtime/control.js.map +1 -0
  209. package/dist/runtime/derive.d.ts +15 -6
  210. package/dist/runtime/derive.d.ts.map +1 -1
  211. package/dist/runtime/derive.js +134 -1
  212. package/dist/runtime/derive.js.map +1 -0
  213. package/dist/runtime/dev-namespace.js +57 -1
  214. package/dist/runtime/dev-namespace.js.map +1 -0
  215. package/dist/runtime/effect.d.ts +32 -0
  216. package/dist/runtime/effect.d.ts.map +1 -0
  217. package/dist/runtime/effect.js +146 -0
  218. package/dist/runtime/effect.js.map +1 -0
  219. package/dist/runtime/events.js +162 -1
  220. package/dist/runtime/events.js.map +1 -0
  221. package/dist/runtime/execution-model.js +15 -1
  222. package/dist/runtime/execution-model.js.map +1 -0
  223. package/dist/runtime/fastlane.js +204 -1
  224. package/dist/runtime/fastlane.js.map +1 -0
  225. package/dist/runtime/for-bench.d.ts +41 -0
  226. package/dist/runtime/for-bench.d.ts.map +1 -0
  227. package/dist/runtime/for-bench.js +173 -0
  228. package/dist/runtime/for-bench.js.map +1 -0
  229. package/dist/runtime/for.d.ts +62 -49
  230. package/dist/runtime/for.d.ts.map +1 -1
  231. package/dist/runtime/for.js +668 -1
  232. package/dist/runtime/for.js.map +1 -0
  233. package/dist/runtime/operations.d.ts +18 -15
  234. package/dist/runtime/operations.d.ts.map +1 -1
  235. package/dist/runtime/operations.js +209 -1
  236. package/dist/runtime/operations.js.map +1 -0
  237. package/dist/runtime/perf-metrics.js +64 -0
  238. package/dist/runtime/perf-metrics.js.map +1 -0
  239. package/dist/runtime/readable.d.ts +27 -0
  240. package/dist/runtime/readable.d.ts.map +1 -0
  241. package/dist/runtime/readable.js +118 -0
  242. package/dist/runtime/readable.js.map +1 -0
  243. package/dist/runtime/resource-cell.js +102 -1
  244. package/dist/runtime/resource-cell.js.map +1 -0
  245. package/dist/runtime/scheduler.d.ts +51 -35
  246. package/dist/runtime/scheduler.d.ts.map +1 -1
  247. package/dist/runtime/scheduler.js +328 -1
  248. package/dist/runtime/scheduler.js.map +1 -0
  249. package/dist/runtime/selector.d.ts +11 -0
  250. package/dist/runtime/selector.d.ts.map +1 -0
  251. package/dist/runtime/selector.js +188 -0
  252. package/dist/runtime/selector.js.map +1 -0
  253. package/dist/runtime/ssr-bridge.js +24 -1
  254. package/dist/runtime/ssr-bridge.js.map +1 -0
  255. package/dist/runtime/state.d.ts +11 -21
  256. package/dist/runtime/state.d.ts.map +1 -1
  257. package/dist/runtime/state.js +99 -1
  258. package/dist/runtime/state.js.map +1 -0
  259. package/dist/ssg/batch-render.d.ts +16 -0
  260. package/dist/ssg/batch-render.d.ts.map +1 -0
  261. package/dist/ssg/batch-render.js +84 -0
  262. package/dist/ssg/batch-render.js.map +1 -0
  263. package/dist/ssg/create-static-gen.d.ts +50 -0
  264. package/dist/ssg/create-static-gen.d.ts.map +1 -0
  265. package/dist/ssg/create-static-gen.js +282 -0
  266. package/dist/ssg/create-static-gen.js.map +1 -0
  267. package/dist/ssg/generate-metadata.d.ts +24 -0
  268. package/dist/ssg/generate-metadata.d.ts.map +1 -0
  269. package/dist/ssg/generate-metadata.js +94 -0
  270. package/dist/ssg/generate-metadata.js.map +1 -0
  271. package/dist/ssg/incremental-manifest.js +56 -0
  272. package/dist/ssg/incremental-manifest.js.map +1 -0
  273. package/dist/ssg/index.d.ts +8 -0
  274. package/dist/ssg/index.js +7 -0
  275. package/dist/ssg/resolve-ssg-data.d.ts +23 -0
  276. package/dist/ssg/resolve-ssg-data.d.ts.map +1 -0
  277. package/dist/ssg/resolve-ssg-data.js +46 -0
  278. package/dist/ssg/resolve-ssg-data.js.map +1 -0
  279. package/dist/ssg/route-utils.d.ts +16 -0
  280. package/dist/ssg/route-utils.d.ts.map +1 -0
  281. package/dist/ssg/route-utils.js +24 -0
  282. package/dist/ssg/route-utils.js.map +1 -0
  283. package/dist/ssg/types.d.ts +177 -0
  284. package/dist/ssg/types.d.ts.map +1 -0
  285. package/dist/ssg/write-static-files.d.ts +15 -0
  286. package/dist/ssg/write-static-files.d.ts.map +1 -0
  287. package/dist/ssg/write-static-files.js +73 -0
  288. package/dist/ssg/write-static-files.js.map +1 -0
  289. package/dist/ssr/attrs.js +93 -1
  290. package/dist/ssr/attrs.js.map +1 -0
  291. package/dist/ssr/context.d.ts +31 -32
  292. package/dist/ssr/context.d.ts.map +1 -1
  293. package/dist/ssr/context.js +63 -1
  294. package/dist/ssr/context.js.map +1 -0
  295. package/dist/ssr/errors.d.ts +6 -4
  296. package/dist/ssr/errors.d.ts.map +1 -1
  297. package/dist/ssr/errors.js +4 -1
  298. package/dist/ssr/errors.js.map +1 -0
  299. package/dist/ssr/escape.js +153 -1
  300. package/dist/ssr/escape.js.map +1 -0
  301. package/dist/ssr/index.d.ts +75 -46
  302. package/dist/ssr/index.d.ts.map +1 -1
  303. package/dist/ssr/index.js +543 -1
  304. package/dist/ssr/index.js.map +1 -0
  305. package/dist/ssr/render-keys.d.ts +27 -29
  306. package/dist/ssr/render-keys.d.ts.map +1 -1
  307. package/dist/ssr/render-keys.js +39 -1
  308. package/dist/ssr/render-keys.js.map +1 -0
  309. package/dist/ssr/sink.js +86 -1
  310. package/dist/ssr/sink.js.map +1 -0
  311. package/dist/ssr/stream-render.js +76 -1
  312. package/dist/ssr/stream-render.js.map +1 -0
  313. package/dist/ssr/types.d.ts +14 -13
  314. package/dist/ssr/types.d.ts.map +1 -1
  315. package/package.json +53 -48
  316. package/dist/_virtual/___vite-browser-external.js +0 -1
  317. package/dist/_virtual/__vite-browser-external.js +0 -1
  318. package/dist/_virtual/_commonjsHelpers.js +0 -1
  319. package/dist/_virtual/main.js +0 -1
  320. package/dist/_virtual/preload-helper.js +0 -1
  321. package/dist/bench/benchmark-entry.d.ts +0 -14
  322. package/dist/bench/benchmark-entry.d.ts.map +0 -1
  323. package/dist/common/errors.d.ts +0 -53
  324. package/dist/common/errors.d.ts.map +0 -1
  325. package/dist/common/index.d.ts +0 -14
  326. package/dist/common/index.d.ts.map +0 -1
  327. package/dist/dev/invariant.d.ts +0 -83
  328. package/dist/dev/invariant.d.ts.map +0 -1
  329. package/dist/dev/logger.d.ts +0 -13
  330. package/dist/dev/logger.d.ts.map +0 -1
  331. package/dist/dev/vite-plugin-askr.d.ts +0 -18
  332. package/dist/dev/vite-plugin-askr.d.ts.map +0 -1
  333. package/dist/dev/warnings.d.ts +0 -5
  334. package/dist/dev/warnings.d.ts.map +0 -1
  335. package/dist/for/for.d.ts +0 -16
  336. package/dist/for/for.d.ts.map +0 -1
  337. package/dist/for/for.js +0 -1
  338. package/dist/for/index.d.ts +0 -2
  339. package/dist/for/index.d.ts.map +0 -1
  340. package/dist/for/index.js +0 -1
  341. package/dist/foundations/core.d.ts +0 -23
  342. package/dist/foundations/core.d.ts.map +0 -1
  343. package/dist/foundations/core.js +0 -1
  344. package/dist/foundations/index.d.ts.map +0 -1
  345. package/dist/foundations/interactions/dismissable.d.ts +0 -58
  346. package/dist/foundations/interactions/dismissable.d.ts.map +0 -1
  347. package/dist/foundations/interactions/dismissable.js +0 -1
  348. package/dist/foundations/interactions/focusable.d.ts +0 -16
  349. package/dist/foundations/interactions/focusable.d.ts.map +0 -1
  350. package/dist/foundations/interactions/focusable.js +0 -1
  351. package/dist/foundations/interactions/hoverable.d.ts +0 -19
  352. package/dist/foundations/interactions/hoverable.d.ts.map +0 -1
  353. package/dist/foundations/interactions/hoverable.js +0 -1
  354. package/dist/foundations/interactions/index.d.ts +0 -5
  355. package/dist/foundations/interactions/index.d.ts.map +0 -1
  356. package/dist/foundations/interactions/interaction-policy.d.ts +0 -96
  357. package/dist/foundations/interactions/interaction-policy.d.ts.map +0 -1
  358. package/dist/foundations/interactions/pressable.d.ts +0 -54
  359. package/dist/foundations/interactions/pressable.d.ts.map +0 -1
  360. package/dist/foundations/interactions/roving-focus.d.ts +0 -117
  361. package/dist/foundations/interactions/roving-focus.d.ts.map +0 -1
  362. package/dist/foundations/interactions/roving-focus.js +0 -1
  363. package/dist/foundations/state/controllable.d.ts +0 -53
  364. package/dist/foundations/state/controllable.d.ts.map +0 -1
  365. package/dist/foundations/state/controllable.js +0 -1
  366. package/dist/foundations/state/index.d.ts +0 -2
  367. package/dist/foundations/state/index.d.ts.map +0 -1
  368. package/dist/foundations/structures/index.d.ts +0 -5
  369. package/dist/foundations/structures/index.d.ts.map +0 -1
  370. package/dist/foundations/structures.d.ts.map +0 -1
  371. package/dist/foundations/utilities/aria.d.ts +0 -13
  372. package/dist/foundations/utilities/aria.d.ts.map +0 -1
  373. package/dist/foundations/utilities/compose-handlers.d.ts +0 -34
  374. package/dist/foundations/utilities/compose-handlers.d.ts.map +0 -1
  375. package/dist/foundations/utilities/event-types.d.ts +0 -17
  376. package/dist/foundations/utilities/event-types.d.ts.map +0 -1
  377. package/dist/foundations/utilities/index.d.ts +0 -7
  378. package/dist/foundations/utilities/index.d.ts.map +0 -1
  379. package/dist/foundations/utilities/merge-props.d.ts +0 -2
  380. package/dist/foundations/utilities/merge-props.d.ts.map +0 -1
  381. package/dist/foundations/utilities/use-id.d.ts +0 -29
  382. package/dist/foundations/utilities/use-id.d.ts.map +0 -1
  383. package/dist/foundations/utilities/use-id.js +0 -1
  384. package/dist/fx/index.d.ts.map +0 -1
  385. package/dist/fx/noop.d.ts +0 -12
  386. package/dist/fx/noop.d.ts.map +0 -1
  387. package/dist/index.d.ts.map +0 -1
  388. package/dist/jsx/index.d.ts.map +0 -1
  389. package/dist/jsx/jsx-dev-runtime.d.ts +0 -4
  390. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  391. package/dist/jsx/jsx-runtime.d.ts +0 -10
  392. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  393. package/dist/node_modules/esbuild/lib/main.js +0 -65
  394. package/dist/renderer/cleanup.d.ts +0 -25
  395. package/dist/renderer/cleanup.d.ts.map +0 -1
  396. package/dist/renderer/dom.d.ts +0 -62
  397. package/dist/renderer/dom.d.ts.map +0 -1
  398. package/dist/renderer/evaluate.d.ts +0 -4
  399. package/dist/renderer/evaluate.d.ts.map +0 -1
  400. package/dist/renderer/fastpath.d.ts +0 -7
  401. package/dist/renderer/fastpath.d.ts.map +0 -1
  402. package/dist/renderer/index.d.ts +0 -6
  403. package/dist/renderer/index.d.ts.map +0 -1
  404. package/dist/renderer/keyed.d.ts +0 -23
  405. package/dist/renderer/keyed.d.ts.map +0 -1
  406. package/dist/renderer/reconcile.d.ts +0 -88
  407. package/dist/renderer/reconcile.d.ts.map +0 -1
  408. package/dist/renderer/types.d.ts +0 -3
  409. package/dist/renderer/types.d.ts.map +0 -1
  410. package/dist/renderer/utils.d.ts +0 -63
  411. package/dist/renderer/utils.d.ts.map +0 -1
  412. package/dist/resources/index.d.ts.map +0 -1
  413. package/dist/router/index.d.ts.map +0 -1
  414. package/dist/router/match.d.ts +0 -22
  415. package/dist/router/match.d.ts.map +0 -1
  416. package/dist/runtime/dev-namespace.d.ts +0 -31
  417. package/dist/runtime/dev-namespace.d.ts.map +0 -1
  418. package/dist/runtime/events.d.ts +0 -52
  419. package/dist/runtime/events.d.ts.map +0 -1
  420. package/dist/runtime/execution-model.d.ts +0 -4
  421. package/dist/runtime/execution-model.d.ts.map +0 -1
  422. package/dist/runtime/fastlane.d.ts +0 -27
  423. package/dist/runtime/fastlane.d.ts.map +0 -1
  424. package/dist/runtime/hydration.d.ts +0 -25
  425. package/dist/runtime/hydration.d.ts.map +0 -1
  426. package/dist/runtime/resource-cell.d.ts +0 -35
  427. package/dist/runtime/resource-cell.d.ts.map +0 -1
  428. package/dist/runtime/snapshot.d.ts +0 -25
  429. package/dist/runtime/snapshot.d.ts.map +0 -1
  430. package/dist/runtime/ssr-bridge.d.ts +0 -10
  431. package/dist/runtime/ssr-bridge.d.ts.map +0 -1
  432. package/dist/ssr/attrs.d.ts +0 -26
  433. package/dist/ssr/attrs.d.ts.map +0 -1
  434. package/dist/ssr/create-ssr.d.ts +0 -19
  435. package/dist/ssr/create-ssr.d.ts.map +0 -1
  436. package/dist/ssr/escape.d.ts +0 -38
  437. package/dist/ssr/escape.d.ts.map +0 -1
  438. package/dist/ssr/sink.d.ts +0 -23
  439. package/dist/ssr/sink.d.ts.map +0 -1
  440. package/dist/ssr/stream-render.d.ts +0 -7
  441. package/dist/ssr/stream-render.d.ts.map +0 -1
  442. package/dist/vite/index.js +0 -3
@@ -1,16 +1,6 @@
1
- /**
2
- * State primitive for Askr components
3
- * Optimized for minimal overhead and fast updates
4
- *
5
- * INVARIANTS ENFORCED:
6
- * - state() only callable during component render (currentInstance exists)
7
- * - state() called at top-level only (indices must be monotonically increasing)
8
- * - state values persist across re-renders (stored in stateValues array)
9
- * - state.set() cannot be called during render (causes infinite loops)
10
- * - state.set() always enqueues through scheduler (never direct mutation)
11
- * - state.set() callback (notifyUpdate) always available
12
- */
13
- import { type ComponentInstance } from './component';
1
+ import { ReadableSource } from "./readable.js";
2
+
3
+ //#region src/runtime/state.d.ts
14
4
  /**
15
5
  * State value holder - callable to read, has set method to update
16
6
  * @example
@@ -18,13 +8,11 @@ import { type ComponentInstance } from './component';
18
8
  * count(); // read: 0
19
9
  * count.set(1); // write: triggers re-render
20
10
  */
21
- export interface State<T> {
22
- (): T;
23
- set(value: T): void;
24
- set(updater: (prev: T) => T): void;
25
- [Symbol.iterator](): Iterator<State<T> | State<T>['set']>;
26
- _hasBeenRead?: boolean;
27
- _readers?: Map<ComponentInstance, number>;
11
+ interface State<T> extends ReadableSource<T> {
12
+ (): T;
13
+ set(value: T): void;
14
+ set(updater: (prev: T) => T): void;
15
+ [Symbol.iterator](): Iterator<State<T> | State<T>['set']>;
28
16
  }
29
17
  /**
30
18
  * Creates a local state value for a component
@@ -52,5 +40,7 @@ export interface State<T> {
52
40
  * }
53
41
  * ```
54
42
  */
55
- export declare function state<T>(initialValue: T): State<T>;
43
+ declare function state<T>(initialValue: T): State<T>;
44
+ //#endregion
45
+ export { State, state };
56
46
  //# sourceMappingURL=state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/runtime/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAIrB;;;;;;GAMG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC;IACtB,IAAI,CAAC,CAAC;IACN,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACnC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAwElD"}
1
+ {"version":3,"file":"state.d.ts","names":[],"sources":["../../src/runtime/state.ts"],"mappings":";;;;;;;;;;UAmCiB,KAAA,YAAiB,cAAA,CAAe,CAAA;EAAA,IAC3C,CAAA;EACJ,GAAA,CAAI,KAAA,EAAO,CAAA;EACX,GAAA,CAAI,OAAA,GAAU,IAAA,EAAM,CAAA,KAAM,CAAA;EAAA,CACzB,MAAA,CAAO,QAAP,KAAoB,QAAA,CAAS,KAAA,CAAM,CAAA,IAAK,KAAA,CAAM,CAAA;AAAA;;;;;;;;;;;;;;;;AA6BjD;;;;;;;;;;;iBAAgB,KAAA,GAAA,CAAS,YAAA,EAAc,CAAA,GAAI,KAAA,CAAM,CAAA"}
@@ -1 +1,99 @@
1
- import{globalScheduler as i}from"./scheduler.js";import{getCurrentInstance as c,getNextStateIndex as h}from"./component.js";import{invariant as m}from"../dev/invariant.js";import{isBulkCommitActive as w}from"./fastlane.js";function _(d){const e=c();if(!e)throw new Error("state() can only be called during component render execution. Move state() calls to the top level of your component function.");const t=h(),r=e.stateValues;if(t<e.stateIndexCheck)throw new Error(`State index violation: state() call at index ${t}, but previously saw index ${e.stateIndexCheck}. This happens when state() is called conditionally (inside if/for/etc). Move all state() calls to the top level of your component function, before any conditionals.`);if(m(t>=e.stateIndexCheck,"[State] State indices must increase monotonically"),e.stateIndexCheck=t,e.firstRenderComplete){if(!e.expectedStateIndices.includes(t))throw new Error(`Hook order violation: state() called at index ${t}, but this index was not in the first render's sequence [${e.expectedStateIndices.join(", ")}]. This usually means state() is inside a conditional or loop. Move all state() calls to the top level of your component function.`)}else e.expectedStateIndices.push(t);if(r[t]){const o=r[t];if(o._owner!==e)throw new Error(`State ownership violation: state() called at index ${t} is owned by a different component instance. State ownership is positional and immutable.`);return o}const n=g(d,e);return r[t]=n,n}function g(d,e){let t=d;const r=new Map;function n(){n._hasBeenRead=!0;const o=c();return o&&o._currentRenderToken!==void 0&&(o._pendingReadStates||(o._pendingReadStates=new Set),o._pendingReadStates.add(n)),t}return n._readers=r,n._owner=e,n.set=o=>{if(c()!==null)throw new Error("[Askr] state.set() cannot be called during component render. State mutations during render break the actor model and cause infinite loops. Move state updates to event handlers or use conditional rendering instead.");let s;if(typeof o=="function"?s=o(t):s=o,Object.is(t,s))return;if(w()){t=s;return}t=s;const l=n._readers;if(l){for(const[a,p]of l)if(a.lastRenderToken===p&&!a.hasPendingUpdate){a.hasPendingUpdate=!0;const f=a._pendingFlushTask;f?i.enqueue(f):i.enqueue(()=>{a.hasPendingUpdate=!1,a.notifyUpdate?.()})}}const u=l?.get(e);if(u!==void 0&&e.lastRenderToken===u&&!e.hasPendingUpdate){e.hasPendingUpdate=!0;const a=e._pendingFlushTask;a?i.enqueue(a):i.enqueue(()=>{e.hasPendingUpdate=!1,e.notifyUpdate?.()})}},n[Symbol.iterator]=function*(){yield n,yield n.set},n}export{_ as state};
1
+ import { globalScheduler } from "./scheduler.js";
2
+ import { markReactivePropsDirtySource, markReadableDerivedSubscribersDirty, notifyReadableReaders, recordReadableRead } from "./readable.js";
3
+ import { isBulkCommitActive } from "./fastlane.js";
4
+ import { claimHookIndex, getCurrentInstance } from "./component.js";
5
+ //#region src/runtime/state.ts
6
+ /**
7
+ * State primitive for Askr components
8
+ * Optimized for minimal overhead and fast updates
9
+ *
10
+ * INVARIANTS ENFORCED:
11
+ * - state() only callable during component render (currentInstance exists)
12
+ * - state() called at top-level only (indices must be monotonically increasing)
13
+ * - state values persist across re-renders (stored in stateValues array)
14
+ * - state.set() cannot be called during render (causes infinite loops)
15
+ * - state.set() always enqueues through scheduler (never direct mutation)
16
+ * - state.set() callback (notifyUpdate) always available
17
+ */
18
+ /**
19
+ * Creates a local state value for a component
20
+ * Optimized for:
21
+ * - O(1) read performance
22
+ * - Minimal allocation per state
23
+ * - Fast scheduler integration
24
+ *
25
+ * IMPORTANT: state() must be called during component render execution.
26
+ * It captures the current component instance from context.
27
+ * Calling outside a component function will throw an error.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * // ✅ Correct: called during render
32
+ * export function Counter() {
33
+ * const count = state(0);
34
+ * return { type: 'button', children: [count()] };
35
+ * }
36
+ *
37
+ * // ❌ Wrong: called outside component
38
+ * const count = state(0);
39
+ * export function BadComponent() {
40
+ * return { type: 'div' };
41
+ * }
42
+ * ```
43
+ */
44
+ function state(initialValue) {
45
+ const instance = getCurrentInstance();
46
+ if (!instance) throw new Error("state() can only be called during component render execution. Move state() calls to the top level of your component function.");
47
+ const index = claimHookIndex(instance, "state");
48
+ const stateValues = instance.stateValues;
49
+ if (stateValues[index]) {
50
+ const existing = stateValues[index];
51
+ if (existing._owner !== instance) throw new Error(`State ownership violation: state() called at index ${index} is owned by a different component instance. State ownership is positional and immutable.`);
52
+ return existing;
53
+ }
54
+ const cell = createStateCell(initialValue, instance);
55
+ stateValues[index] = cell;
56
+ return cell;
57
+ }
58
+ /**
59
+ * Internal helper: create the backing state cell (value + readers + set semantics)
60
+ * This extraction makes it easier to later split hook wiring from storage.
61
+ */
62
+ function createStateCell(initialValue, instance) {
63
+ let value = initialValue;
64
+ let pendingNotifyFlushVersion = -1;
65
+ const readers = /* @__PURE__ */ new Map();
66
+ function read() {
67
+ read._hasBeenRead = true;
68
+ recordReadableRead(read);
69
+ return value;
70
+ }
71
+ read._readers = readers;
72
+ read._owner = instance;
73
+ read.set = (newValueOrUpdater) => {
74
+ if (getCurrentInstance() !== null) throw new Error("[Askr] state.set() cannot be called during component render. State mutations during render break the actor model and cause infinite loops. Move state updates to event handlers or use conditional rendering instead.");
75
+ let newValue;
76
+ if (typeof newValueOrUpdater === "function") newValue = newValueOrUpdater(value);
77
+ else newValue = newValueOrUpdater;
78
+ if (Object.is(value, newValue)) return;
79
+ if (isBulkCommitActive()) {
80
+ value = newValue;
81
+ return;
82
+ }
83
+ value = newValue;
84
+ markReadableDerivedSubscribersDirty(read);
85
+ markReactivePropsDirtySource(read);
86
+ const flushVersion = globalScheduler.getFlushVersion();
87
+ if (pendingNotifyFlushVersion === flushVersion && !globalScheduler.isExecuting()) return;
88
+ pendingNotifyFlushVersion = notifyReadableReaders(read) && !globalScheduler.isExecuting() ? flushVersion : -1;
89
+ };
90
+ read[Symbol.iterator] = function* () {
91
+ yield read;
92
+ yield read.set;
93
+ };
94
+ return read;
95
+ }
96
+ //#endregion
97
+ export { state };
98
+
99
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","names":[],"sources":["../../src/runtime/state.ts"],"sourcesContent":["/**\n * State primitive for Askr components\n * Optimized for minimal overhead and fast updates\n *\n * INVARIANTS ENFORCED:\n * - state() only callable during component render (currentInstance exists)\n * - state() called at top-level only (indices must be monotonically increasing)\n * - state values persist across re-renders (stored in stateValues array)\n * - state.set() cannot be called during render (causes infinite loops)\n * - state.set() always enqueues through scheduler (never direct mutation)\n * - state.set() callback (notifyUpdate) always available\n */\n\nimport { globalScheduler } from './scheduler';\nimport {\n claimHookIndex,\n getCurrentInstance,\n type ComponentInstance,\n} from './component';\nimport { isBulkCommitActive } from './fastlane';\nimport {\n recordReadableRead,\n type ReadableSource,\n markReadableDerivedSubscribersDirty,\n markReactivePropsDirtySource,\n notifyReadableReaders,\n} from './readable';\n\n/**\n * State value holder - callable to read, has set method to update\n * @example\n * const count = state(0);\n * count(); // read: 0\n * count.set(1); // write: triggers re-render\n */\nexport interface State<T> extends ReadableSource<T> {\n (): T;\n set(value: T): void;\n set(updater: (prev: T) => T): void;\n [Symbol.iterator](): Iterator<State<T> | State<T>['set']>; // Allows destructuring: const [get, set] = state(0)\n}\n\n/**\n * Creates a local state value for a component\n * Optimized for:\n * - O(1) read performance\n * - Minimal allocation per state\n * - Fast scheduler integration\n *\n * IMPORTANT: state() must be called during component render execution.\n * It captures the current component instance from context.\n * Calling outside a component function will throw an error.\n *\n * @example\n * ```ts\n * // ✅ Correct: called during render\n * export function Counter() {\n * const count = state(0);\n * return { type: 'button', children: [count()] };\n * }\n *\n * // ❌ Wrong: called outside component\n * const count = state(0);\n * export function BadComponent() {\n * return { type: 'div' };\n * }\n * ```\n */\nexport function state<T>(initialValue: T): State<T> {\n // INVARIANT: state() must be called during component render\n const instance = getCurrentInstance();\n if (!instance) {\n throw new Error(\n 'state() can only be called during component render execution. ' +\n 'Move state() calls to the top level of your component function.'\n );\n }\n\n const index = claimHookIndex(instance, 'state');\n const stateValues = instance.stateValues;\n\n // INVARIANT: Reuse existing state if it exists (fast path on re-renders)\n // This ensures state identity and persistence and enforces ownership stability\n if (stateValues[index]) {\n const existing = stateValues[index] as State<T> & {\n _owner?: ComponentInstance;\n };\n // Ownership must be stable: the state cell belongs to the instance that\n // created it and must never change. This checks for accidental reuse.\n if (existing._owner !== instance) {\n throw new Error(\n `State ownership violation: state() called at index ${index} is owned by a different component instance. ` +\n `State ownership is positional and immutable.`\n );\n }\n return existing as State<T>;\n }\n\n // Create new state (slow path, only on first render) — delegated to helper\n const cell = createStateCell(initialValue, instance);\n\n // INVARIANT: Store state in instance for persistence across renders\n stateValues[index] = cell;\n\n return cell;\n}\n\n/**\n * Internal helper: create the backing state cell (value + readers + set semantics)\n * This extraction makes it easier to later split hook wiring from storage.\n */\nfunction createStateCell<T>(\n initialValue: T,\n instance: ComponentInstance\n): State<T> {\n let value = initialValue;\n let pendingNotifyFlushVersion = -1;\n\n // Per-state reader map: component -> last-committed render token\n const readers = new Map<ComponentInstance, number>();\n\n // Use a function as the state object (callable directly)\n function read(): T {\n (read as State<T>)._hasBeenRead = true;\n recordReadableRead(read as State<T>);\n\n return value;\n }\n\n // Attach the readers map to the callable so other runtime parts can access it\n (read as State<T>)._readers = readers;\n\n // Record explicit ownership of this state cell. Ownership is the component\n // instance that created the state cell and must never change for the life\n // of the cell. We expose this for runtime invariant checks/tests.\n (read as State<T> & { _owner?: ComponentInstance })._owner = instance;\n\n // Attach set method directly to function\n read.set = (newValueOrUpdater: T | ((prev: T) => T)): void => {\n // INVARIANT: State cannot be mutated during component render\n // (when currentInstance is non-null). It must be scheduled for consistency.\n const currentInst = getCurrentInstance();\n if (currentInst !== null) {\n throw new Error(\n `[Askr] state.set() cannot be called during component render. ` +\n `State mutations during render break the actor model and cause infinite loops. ` +\n `Move state updates to event handlers or use conditional rendering instead.`\n );\n }\n\n // Compute new value if an updater was provided\n let newValue: T;\n if (typeof newValueOrUpdater === 'function') {\n // Note: function-valued state cannot be set directly via a function argument;\n // such an argument is treated as a functional updater (this follows the common\n // convention from other libraries). If you need to store a function as state,\n // wrap it in an object.\n const updater = newValueOrUpdater as (prev: T) => T;\n newValue = updater(value);\n } else {\n newValue = newValueOrUpdater as T;\n }\n\n // Skip work if value didn't change\n if (Object.is(value, newValue)) return;\n\n // If a bulk commit is active, update backing value only and DO NOT notify or enqueue.\n // Bulk commits must be side-effect silent with respect to runtime notifications.\n if (isBulkCommitActive()) {\n // In bulk commit mode we must be side-effect free: update backing\n // value only and do not notify, enqueue, or log.\n value = newValue;\n return;\n }\n\n // INVARIANT: Update the value\n value = newValue;\n\n markReadableDerivedSubscribersDirty(read as State<T>);\n markReactivePropsDirtySource(read as State<T>);\n\n // notifyUpdate may be temporarily unavailable (e.g. during hydration).\n // We intentionally avoid logging here to keep the state mutation path\n // side-effect free. The scheduler will process updates when the system\n // is stable.\n const flushVersion = globalScheduler.getFlushVersion();\n const canSkipNotifyPass =\n pendingNotifyFlushVersion === flushVersion &&\n !globalScheduler.isExecuting();\n\n if (canSkipNotifyPass) {\n return;\n }\n\n // After value change, notify only components that *read* this state in their last committed render.\n const didScheduleUpdate = notifyReadableReaders(read as State<T>);\n\n pendingNotifyFlushVersion =\n didScheduleUpdate && !globalScheduler.isExecuting() ? flushVersion : -1;\n };\n\n // Allow destructuring assignment: const [get, set] = state(0);\n // The state function is iterable and yields the getter then the setter\n (\n read as unknown as {\n [Symbol.iterator]?: () => Iterator<State<T> | State<T>['set']>;\n }\n )[Symbol.iterator] = function* (): Generator<\n State<T> | State<T>['set'],\n void,\n unknown\n > {\n yield read;\n yield read.set;\n };\n\n return read as State<T>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,SAAgB,MAAS,cAA2B;CAElD,MAAM,WAAW,oBAAoB;AACrC,KAAI,CAAC,SACH,OAAM,IAAI,MACR,gIAED;CAGH,MAAM,QAAQ,eAAe,UAAU,QAAQ;CAC/C,MAAM,cAAc,SAAS;AAI7B,KAAI,YAAY,QAAQ;EACtB,MAAM,WAAW,YAAY;AAK7B,MAAI,SAAS,WAAW,SACtB,OAAM,IAAI,MACR,sDAAsD,MAAM,2FAE7D;AAEH,SAAO;;CAIT,MAAM,OAAO,gBAAgB,cAAc,SAAS;AAGpD,aAAY,SAAS;AAErB,QAAO;;;;;;AAOT,SAAS,gBACP,cACA,UACU;CACV,IAAI,QAAQ;CACZ,IAAI,4BAA4B;CAGhC,MAAM,0BAAU,IAAI,KAAgC;CAGpD,SAAS,OAAU;AAChB,OAAkB,eAAe;AAClC,qBAAmB,KAAiB;AAEpC,SAAO;;AAIR,MAAkB,WAAW;AAK7B,MAAmD,SAAS;AAG7D,MAAK,OAAO,sBAAkD;AAI5D,MADoB,oBAChB,KAAgB,KAClB,OAAM,IAAI,MACR,wNAGD;EAIH,IAAI;AACJ,MAAI,OAAO,sBAAsB,WAM/B,YAAW,kBAAQ,MAAM;MAEzB,YAAW;AAIb,MAAI,OAAO,GAAG,OAAO,SAAS,CAAE;AAIhC,MAAI,oBAAoB,EAAE;AAGxB,WAAQ;AACR;;AAIF,UAAQ;AAER,sCAAoC,KAAiB;AACrD,+BAA6B,KAAiB;EAM9C,MAAM,eAAe,gBAAgB,iBAAiB;AAKtD,MAHE,8BAA8B,gBAC9B,CAAC,gBAAgB,aAAa,CAG9B;AAMF,8BAF0B,sBAAsB,KAG9C,IAAqB,CAAC,gBAAgB,aAAa,GAAG,eAAe;;AAMvE,MAGA,OAAO,YAAY,aAInB;AACA,QAAM;AACN,QAAM,KAAK;;AAGb,QAAO"}
@@ -0,0 +1,16 @@
1
+ import { RouteConfig, RouteRenderResult } from "./types.js";
2
+ import { SSRData } from "../common/ssr.js";
3
+
4
+ //#region src/ssg/batch-render.d.ts
5
+ interface BatchRenderOptions {
6
+ seed?: number;
7
+ dataMap?: Record<string, SSRData>;
8
+ concurrency?: number;
9
+ }
10
+ /**
11
+ * Render multiple routes in parallel with error handling
12
+ */
13
+ declare function batchRenderRoutes(routes: RouteConfig[], options?: BatchRenderOptions): Promise<RouteRenderResult[]>;
14
+ //#endregion
15
+ export { batchRenderRoutes };
16
+ //# sourceMappingURL=batch-render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-render.d.ts","names":[],"sources":["../../src/ssg/batch-render.ts"],"mappings":";;;;UAWU,kBAAA;EACR,IAAA;EACA,OAAA,GAAU,MAAA,SAAe,OAAA;EACzB,WAAA;AAAA;;;;iBAMoB,iBAAA,CACpB,MAAA,EAAQ,WAAA,IACR,OAAA,GAAS,kBAAA,GACR,OAAA,CAAQ,iBAAA"}
@@ -0,0 +1,84 @@
1
+ import { renderResolvedToStringSync } from "../ssr/index.js";
2
+ import { getOutputFilePath, interpolateRoutePath } from "./route-utils.js";
3
+ //#region src/ssg/batch-render.ts
4
+ /**
5
+ * Batch rendering of multiple routes for SSG
6
+ */
7
+ /**
8
+ * Render multiple routes in parallel with error handling
9
+ */
10
+ async function batchRenderRoutes(routes, options = {}) {
11
+ const { seed = 12345, dataMap = {}, concurrency = 1 } = options;
12
+ const workerCount = Math.max(1, Math.min(concurrency, routes.length || 1));
13
+ const results = [];
14
+ results.length = routes.length;
15
+ let nextIndex = 0;
16
+ const renderOne = async (route) => {
17
+ const startTime = performance.now();
18
+ const url = interpolateRoutePath(route.path, route.params);
19
+ const baseData = dataMap[route.path] ?? dataMap[url] ?? {};
20
+ const mergedHandler = route.handler ? route.handler : (params, ctx) => {
21
+ const component = route.component;
22
+ return component({
23
+ ...route.props,
24
+ ...params
25
+ }, ctx);
26
+ };
27
+ try {
28
+ const html = renderResolvedToStringSync({
29
+ url,
30
+ routes: [{
31
+ path: route.path,
32
+ handler: mergedHandler,
33
+ namespace: route.namespace
34
+ }],
35
+ handler: mergedHandler,
36
+ params: route.params,
37
+ options: {
38
+ seed,
39
+ data: baseData
40
+ }
41
+ });
42
+ const duration = performance.now() - startTime;
43
+ return {
44
+ path: url,
45
+ filePath: getOutputFilePath(url),
46
+ html,
47
+ fileSize: Buffer.byteLength(html, "utf8"),
48
+ renderDuration: Math.round(duration),
49
+ resourceCount: Object.keys(baseData).length,
50
+ status: "success",
51
+ reason: "full",
52
+ written: false
53
+ };
54
+ } catch (error) {
55
+ const duration = performance.now() - startTime;
56
+ return {
57
+ path: url,
58
+ filePath: getOutputFilePath(url),
59
+ html: "",
60
+ fileSize: 0,
61
+ renderDuration: Math.round(duration),
62
+ resourceCount: Object.keys(baseData).length,
63
+ status: "error",
64
+ reason: "full",
65
+ written: false,
66
+ error: error instanceof Error ? error.message : String(error)
67
+ };
68
+ }
69
+ };
70
+ const worker = async () => {
71
+ while (true) {
72
+ const current = nextIndex;
73
+ nextIndex += 1;
74
+ if (current >= routes.length) return;
75
+ results[current] = await renderOne(routes[current]);
76
+ }
77
+ };
78
+ await Promise.all(Array.from({ length: workerCount }, () => worker()));
79
+ return results;
80
+ }
81
+ //#endregion
82
+ export { batchRenderRoutes };
83
+
84
+ //# sourceMappingURL=batch-render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-render.js","names":[],"sources":["../../src/ssg/batch-render.ts"],"sourcesContent":["/**\n * Batch rendering of multiple routes for SSG\n */\n\nimport { renderResolvedToStringSync } from '../ssr';\nimport type { RouteConfig, RouteRenderResult } from './types';\nimport type { RouteHandler } from '../common/router';\nimport type { ComponentFunction } from '../common/component';\nimport type { SSRData } from '../common/ssr';\nimport { getOutputFilePath, interpolateRoutePath } from './route-utils';\n\ninterface BatchRenderOptions {\n seed?: number;\n dataMap?: Record<string, SSRData>;\n concurrency?: number;\n}\n\n/**\n * Render multiple routes in parallel with error handling\n */\nexport async function batchRenderRoutes(\n routes: RouteConfig[],\n options: BatchRenderOptions = {}\n): Promise<RouteRenderResult[]> {\n const { seed = 12345, dataMap = {}, concurrency = 1 } = options;\n\n const workerCount = Math.max(1, Math.min(concurrency, routes.length || 1));\n const results: RouteRenderResult[] = [];\n results.length = routes.length;\n let nextIndex = 0;\n\n const renderOne = async (route: RouteConfig): Promise<RouteRenderResult> => {\n const startTime = performance.now();\n const url = interpolateRoutePath(route.path, route.params);\n const baseData = dataMap[route.path] ?? dataMap[url] ?? {};\n\n const mergedHandler: RouteHandler = route.handler\n ? route.handler\n : (params, ctx?: unknown) => {\n const component = route.component as ComponentFunction;\n return component(\n { ...route.props, ...params },\n ctx as { signal: AbortSignal; ssr?: unknown }\n );\n };\n\n try {\n const routeEntry = {\n path: route.path,\n handler: mergedHandler,\n namespace: route.namespace,\n };\n\n const html = renderResolvedToStringSync({\n url,\n routes: [routeEntry],\n handler: mergedHandler,\n params: route.params,\n options: {\n seed,\n data: baseData,\n },\n });\n\n const duration = performance.now() - startTime;\n return {\n path: url,\n filePath: getOutputFilePath(url),\n html,\n fileSize: Buffer.byteLength(html, 'utf8'),\n renderDuration: Math.round(duration),\n resourceCount: Object.keys(baseData).length,\n status: 'success',\n reason: 'full',\n written: false,\n };\n } catch (error) {\n const duration = performance.now() - startTime;\n return {\n path: url,\n filePath: getOutputFilePath(url),\n html: '',\n fileSize: 0,\n renderDuration: Math.round(duration),\n resourceCount: Object.keys(baseData).length,\n status: 'error',\n reason: 'full',\n written: false,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n };\n\n const worker = async () => {\n while (true) {\n const current = nextIndex;\n nextIndex += 1;\n if (current >= routes.length) return;\n results[current] = await renderOne(routes[current]);\n }\n };\n\n await Promise.all(Array.from({ length: workerCount }, () => worker()));\n return results;\n}\n"],"mappings":";;;;;;;;;AAoBA,eAAsB,kBACpB,QACA,UAA8B,EAAE,EACF;CAC9B,MAAM,EAAE,OAAO,OAAO,UAAU,EAAE,EAAE,cAAc,MAAM;CAExD,MAAM,cAAc,KAAK,IAAI,GAAG,KAAK,IAAI,aAAa,OAAO,UAAU,EAAE,CAAC;CAC1E,MAAM,UAA+B,EAAE;AACvC,SAAQ,SAAS,OAAO;CACxB,IAAI,YAAY;CAEhB,MAAM,YAAY,OAAO,UAAmD;EAC1E,MAAM,YAAY,YAAY,KAAK;EACnC,MAAM,MAAM,qBAAqB,MAAM,MAAM,MAAM,OAAO;EAC1D,MAAM,WAAW,QAAQ,MAAM,SAAS,QAAQ,QAAQ,EAAE;EAE1D,MAAM,gBAA8B,MAAM,UACtC,MAAM,WACL,QAAQ,QAAkB;GACzB,MAAM,YAAY,MAAM;AACxB,UAAO,UACL;IAAE,GAAG,MAAM;IAAO,GAAG;IAAQ,EAC7B,IACD;;AAGP,MAAI;GAOF,MAAM,OAAO,2BAA2B;IACtC;IACA,QAAQ,CAAC;KAPT,MAAM,MAAM;KACZ,SAAS;KACT,WAAW,MAAM;KAKR,CAAW;IACpB,SAAS;IACT,QAAQ,MAAM;IACd,SAAS;KACP;KACA,MAAM;KACP;IACF,CAAC;GAEF,MAAM,WAAW,YAAY,KAAK,GAAG;AACrC,UAAO;IACL,MAAM;IACN,UAAU,kBAAkB,IAAI;IAChC;IACA,UAAU,OAAO,WAAW,MAAM,OAAO;IACzC,gBAAgB,KAAK,MAAM,SAAS;IACpC,eAAe,OAAO,KAAK,SAAS,CAAC;IACrC,QAAQ;IACR,QAAQ;IACR,SAAS;IACV;WACM,OAAO;GACd,MAAM,WAAW,YAAY,KAAK,GAAG;AACrC,UAAO;IACL,MAAM;IACN,UAAU,kBAAkB,IAAI;IAChC,MAAM;IACN,UAAU;IACV,gBAAgB,KAAK,MAAM,SAAS;IACpC,eAAe,OAAO,KAAK,SAAS,CAAC;IACrC,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;IAC9D;;;CAIL,MAAM,SAAS,YAAY;AACzB,SAAO,MAAM;GACX,MAAM,UAAU;AAChB,gBAAa;AACb,OAAI,WAAW,OAAO,OAAQ;AAC9B,WAAQ,WAAW,MAAM,UAAU,OAAO,SAAS;;;AAIvD,OAAM,QAAQ,IAAI,MAAM,KAAK,EAAE,QAAQ,aAAa,QAAQ,QAAQ,CAAC,CAAC;AACtE,QAAO"}
@@ -0,0 +1,50 @@
1
+ import { SSGGenerateOptions, SSGOptions, SSGResult } from "./types.js";
2
+
3
+ //#region src/ssg/create-static-gen.d.ts
4
+ /**
5
+ * Create a Static Site Generator
6
+ *
7
+ * Usage:
8
+ * ```ts
9
+ * const ssg = createStaticGen({
10
+ * routes: [
11
+ * { path: '/', component: HomePage },
12
+ * { path: '/about', component: AboutPage },
13
+ * ],
14
+ * outputDir: './dist',
15
+ * dataOverrides: {
16
+ * '/api/posts': { posts: [...] }
17
+ * }
18
+ * });
19
+ *
20
+ * const result = await ssg.generate();
21
+ * console.log(`Generated ${result.successful}/${result.totalRoutes} routes`);
22
+ * ```
23
+ */
24
+ declare function createStaticGen(options: SSGOptions): {
25
+ /**
26
+ * Generate static HTML for all routes
27
+ * Writes to outputDir with metadata.json
28
+ * Returns detailed results
29
+ */
30
+ generate(generateOptions?: SSGGenerateOptions): Promise<SSGResult>;
31
+ /**
32
+ * Get effective config in a serializable form for diagnostics.
33
+ */
34
+ getConfig(): {
35
+ routeCount: number;
36
+ outputDir: string;
37
+ seed: number;
38
+ concurrency: number;
39
+ parallelism: number;
40
+ hasDataOverrides: boolean;
41
+ };
42
+ /**
43
+ * Get the last generation result
44
+ * Returns null if generate() hasn't been called
45
+ */
46
+ getResult(): SSGResult | null;
47
+ };
48
+ //#endregion
49
+ export { createStaticGen };
50
+ //# sourceMappingURL=create-static-gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-static-gen.d.ts","names":[],"sources":["../../src/ssg/create-static-gen.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBAkHgB,eAAA,CAAgB,OAAA,EAAS,UAAA;;;;;;6BAwBlB,kBAAA,GAChB,OAAA,CAAQ,SAAA;;;;;;;;;;;;;;;;eAmPE,SAAA;AAAA"}
@@ -0,0 +1,282 @@
1
+ import { addPerfDuration, incrementPerfMetric } from "../runtime/perf-metrics.js";
2
+ import { resolveSsgData, validateRoutes } from "./resolve-ssg-data.js";
3
+ import { resolveRouteDescriptor } from "./route-utils.js";
4
+ import { batchRenderRoutes } from "./batch-render.js";
5
+ import { writeStaticFiles } from "./write-static-files.js";
6
+ import { generateSSGResult, resultToMetadata, writeMetadata } from "./generate-metadata.js";
7
+ import { getExistingOutputFileSize, hashHtml, outputFileExists, readIncrementalManifest, writeIncrementalManifest } from "./incremental-manifest.js";
8
+ //#region src/ssg/create-static-gen.ts
9
+ function getRuntimeOnlyDiagnostic(descriptor) {
10
+ const { route } = descriptor;
11
+ if (route.auth === true) return `Skipped prerender for "${descriptor.path}": authenticated routes are runtime-only by default.`;
12
+ if (route.role) return `Skipped prerender for "${descriptor.path}": role-gated routes are runtime-only by default.`;
13
+ if (route.permission) return `Skipped prerender for "${descriptor.path}": permission-gated routes are runtime-only by default.`;
14
+ if (route.policies && route.policies.length > 0) return `Skipped prerender for "${descriptor.path}": routes with custom policies are runtime-only by default.`;
15
+ return null;
16
+ }
17
+ function resolveParallelism(requested) {
18
+ if (requested !== "auto") return Math.max(1, requested ?? 1);
19
+ const maybeNavigator = globalThis;
20
+ const envWorkers = Number(maybeNavigator.process?.env?.ASKR_SSG_WORKERS ?? maybeNavigator.process?.env?.NUMBER_OF_PROCESSORS ?? maybeNavigator.process?.env?.UV_THREADPOOL_SIZE);
21
+ if (Number.isFinite(envWorkers) && envWorkers > 0) return Math.max(1, Math.trunc(envWorkers));
22
+ if (typeof maybeNavigator.navigator?.hardwareConcurrency === "number") return Math.max(1, maybeNavigator.navigator.hardwareConcurrency);
23
+ return 1;
24
+ }
25
+ /**
26
+ * Create a Static Site Generator
27
+ *
28
+ * Usage:
29
+ * ```ts
30
+ * const ssg = createStaticGen({
31
+ * routes: [
32
+ * { path: '/', component: HomePage },
33
+ * { path: '/about', component: AboutPage },
34
+ * ],
35
+ * outputDir: './dist',
36
+ * dataOverrides: {
37
+ * '/api/posts': { posts: [...] }
38
+ * }
39
+ * });
40
+ *
41
+ * const result = await ssg.generate();
42
+ * console.log(`Generated ${result.successful}/${result.totalRoutes} routes`);
43
+ * ```
44
+ */
45
+ function createStaticGen(options) {
46
+ let result = null;
47
+ const seed = options.seed ?? 12345;
48
+ const resolvedParallelism = resolveParallelism(options.parallelism);
49
+ const resolvedConcurrency = Math.max(1, options.concurrency ?? resolvedParallelism);
50
+ if (!Array.isArray(options.routes) || options.routes.length === 0) throw new Error("routes array is required");
51
+ if (!options.outputDir || options.outputDir.trim().length === 0) throw new Error("outputDir is required");
52
+ return {
53
+ /**
54
+ * Generate static HTML for all routes
55
+ * Writes to outputDir with metadata.json
56
+ * Returns detailed results
57
+ */
58
+ async generate(generateOptions = {}) {
59
+ validateRoutes(options.routes);
60
+ const changedKeys = dedupeStrings(generateOptions.changedKeys);
61
+ const changedRoutes = dedupeStrings(generateOptions.changedRoutes);
62
+ const requestedMode = generateOptions.mode ?? "full";
63
+ const previousManifest = !generateOptions.forceFull && requestedMode === "incremental" ? readIncrementalManifest(options.outputDir, seed) : null;
64
+ const effectiveMode = generateOptions.forceFull || requestedMode !== "incremental" || previousManifest === null ? "full" : "incremental";
65
+ const dataMap = resolveSsgData(options.routes, { dataOverrides: options.dataOverrides });
66
+ const descriptors = options.routes.map(resolveRouteDescriptor);
67
+ const routeResultsById = /* @__PURE__ */ new Map();
68
+ const eligibleDescriptors = [];
69
+ for (const descriptor of descriptors) {
70
+ const diagnostic = getRuntimeOnlyDiagnostic(descriptor);
71
+ if (diagnostic) {
72
+ routeResultsById.set(descriptor.routeId, {
73
+ path: descriptor.path,
74
+ filePath: descriptor.filePath,
75
+ html: "",
76
+ fileSize: 0,
77
+ renderDuration: 0,
78
+ resourceCount: 0,
79
+ status: "skipped",
80
+ reason: "runtime-only",
81
+ written: false,
82
+ error: diagnostic
83
+ });
84
+ continue;
85
+ }
86
+ eligibleDescriptors.push(descriptor);
87
+ }
88
+ const previousEntries = new Map((previousManifest?.routes ?? []).map((entry) => [entry.routeId, entry]));
89
+ const currentRouteIds = new Set(eligibleDescriptors.map((descriptor) => descriptor.routeId));
90
+ const selected = [];
91
+ const routesToRender = [];
92
+ for (let index = 0; index < eligibleDescriptors.length; index += 1) {
93
+ const descriptor = eligibleDescriptors[index];
94
+ const entry = selectRouteForGeneration(descriptor, previousEntries.get(descriptor.routeId) ?? null, effectiveMode, changedKeys, changedRoutes);
95
+ selected.push(entry);
96
+ if (entry.reason !== "unchanged") routesToRender.push(entry);
97
+ }
98
+ const renderStartTime = performance.now();
99
+ incrementPerfMetric("ssgWorkerCount", resolvedParallelism);
100
+ const renderedResults = routesToRender.length > 0 ? await batchRenderRoutes(getRoutesToRender(routesToRender), {
101
+ seed,
102
+ dataMap,
103
+ concurrency: resolvedConcurrency
104
+ }) : [];
105
+ addPerfDuration("ssgRenderTimeMs", performance.now() - renderStartTime);
106
+ const renderedByRouteId = /* @__PURE__ */ new Map();
107
+ for (let index = 0; index < renderedResults.length; index += 1) renderedByRouteId.set(routesToRender[index].descriptor.routeId, renderedResults[index]);
108
+ let cacheHits = 0;
109
+ const nextManifestRoutes = [];
110
+ for (const entry of selected) {
111
+ const { descriptor, previous, reason } = entry;
112
+ const baseData = dataMap[descriptor.route.path] ?? dataMap[descriptor.path] ?? {};
113
+ const resourceCount = Object.keys(baseData).length;
114
+ if (reason === "unchanged") {
115
+ routeResultsById.set(descriptor.routeId, {
116
+ path: descriptor.path,
117
+ filePath: descriptor.filePath,
118
+ html: "",
119
+ fileSize: previous?.htmlHash !== null && previous !== null ? getExistingOutputFileSize(options.outputDir, descriptor.filePath) : 0,
120
+ renderDuration: 0,
121
+ resourceCount,
122
+ status: "skipped",
123
+ reason: "unchanged",
124
+ written: false
125
+ });
126
+ if (previous) nextManifestRoutes.push({
127
+ ...previous,
128
+ path: descriptor.path,
129
+ filePath: descriptor.filePath,
130
+ invalidationKeys: descriptor.invalidationKeys.slice()
131
+ });
132
+ continue;
133
+ }
134
+ const rendered = renderedByRouteId.get(descriptor.routeId);
135
+ if (!rendered) throw new Error(`Missing rendered result for route "${descriptor.path}"`);
136
+ const nextResult = {
137
+ ...rendered,
138
+ path: descriptor.path,
139
+ filePath: descriptor.filePath,
140
+ resourceCount,
141
+ reason,
142
+ written: false
143
+ };
144
+ if (nextResult.status === "success") {
145
+ const htmlDigest = hashHtml(nextResult.html);
146
+ const shouldWrite = effectiveMode === "full" || !previous || previous.htmlHash !== htmlDigest || !outputFileExists(options.outputDir, descriptor.filePath);
147
+ nextResult.written = shouldWrite;
148
+ if (!shouldWrite) cacheHits += 1;
149
+ nextManifestRoutes.push({
150
+ routeId: descriptor.routeId,
151
+ path: descriptor.path,
152
+ filePath: descriptor.filePath,
153
+ invalidationKeys: descriptor.invalidationKeys.slice(),
154
+ htmlHash: htmlDigest,
155
+ lastStatus: "success"
156
+ });
157
+ } else nextManifestRoutes.push({
158
+ routeId: descriptor.routeId,
159
+ path: descriptor.path,
160
+ filePath: descriptor.filePath,
161
+ invalidationKeys: descriptor.invalidationKeys.slice(),
162
+ htmlHash: previous?.htmlHash ?? null,
163
+ lastStatus: "error"
164
+ });
165
+ routeResultsById.set(descriptor.routeId, nextResult);
166
+ }
167
+ const removedResults = collectRemovedRouteResults(previousManifest, currentRouteIds);
168
+ const routeResults = [];
169
+ for (let index = 0; index < descriptors.length; index += 1) {
170
+ const routeResult = routeResultsById.get(descriptors[index].routeId);
171
+ if (routeResult) routeResults.push(routeResult);
172
+ }
173
+ routeResults.push(...removedResults);
174
+ const writeStartTime = performance.now();
175
+ await writeStaticFiles(routeResults, options.outputDir, { concurrency: resolvedConcurrency });
176
+ addPerfDuration("ssgWriteTimeMs", performance.now() - writeStartTime);
177
+ result = generateSSGResult(routeResults, {
178
+ mode: effectiveMode,
179
+ cacheHits,
180
+ invalidatedKeys: changedKeys,
181
+ invalidatedRoutes: changedRoutes
182
+ });
183
+ await writeMetadata(resultToMetadata(result), options.outputDir);
184
+ await writeIncrementalManifest({
185
+ schemaVersion: 1,
186
+ seed,
187
+ mode: effectiveMode,
188
+ routes: nextManifestRoutes
189
+ }, options.outputDir);
190
+ return result;
191
+ },
192
+ /**
193
+ * Get effective config in a serializable form for diagnostics.
194
+ */
195
+ getConfig() {
196
+ return {
197
+ routeCount: options.routes.length,
198
+ outputDir: options.outputDir,
199
+ seed,
200
+ concurrency: resolvedConcurrency,
201
+ parallelism: resolvedParallelism,
202
+ hasDataOverrides: !!options.dataOverrides
203
+ };
204
+ },
205
+ /**
206
+ * Get the last generation result
207
+ * Returns null if generate() hasn't been called
208
+ */
209
+ getResult() {
210
+ return result;
211
+ }
212
+ };
213
+ }
214
+ function dedupeStrings(values) {
215
+ return values ? Array.from(new Set(values)) : [];
216
+ }
217
+ function getRoutesToRender(selected) {
218
+ const routes = [];
219
+ for (let index = 0; index < selected.length; index += 1) routes.push(selected[index].descriptor.route);
220
+ return routes;
221
+ }
222
+ function selectRouteForGeneration(descriptor, previous, mode, changedKeys, changedRoutes) {
223
+ if (mode === "full") return {
224
+ descriptor,
225
+ reason: "full",
226
+ previous
227
+ };
228
+ if (!previous) return {
229
+ descriptor,
230
+ reason: "new-route",
231
+ previous
232
+ };
233
+ if (previous.lastStatus === "error" || previous.htmlHash === null) return {
234
+ descriptor,
235
+ reason: "new-route",
236
+ previous
237
+ };
238
+ if (descriptor.invalidationKeys.length === 0) return {
239
+ descriptor,
240
+ reason: "no-keys",
241
+ previous
242
+ };
243
+ if (changedRoutes.includes(descriptor.path)) return {
244
+ descriptor,
245
+ reason: "changed-route",
246
+ previous
247
+ };
248
+ if (descriptor.invalidationKeys.some((key) => changedKeys.includes(key))) return {
249
+ descriptor,
250
+ reason: "changed-key",
251
+ previous
252
+ };
253
+ return {
254
+ descriptor,
255
+ reason: "unchanged",
256
+ previous
257
+ };
258
+ }
259
+ function collectRemovedRouteResults(manifest, currentRouteIds) {
260
+ if (!manifest) return [];
261
+ const results = [];
262
+ for (let index = 0; index < manifest.routes.length; index += 1) {
263
+ const entry = manifest.routes[index];
264
+ if (currentRouteIds.has(entry.routeId)) continue;
265
+ results.push({
266
+ path: entry.path,
267
+ filePath: entry.filePath,
268
+ html: "",
269
+ fileSize: 0,
270
+ renderDuration: 0,
271
+ resourceCount: 0,
272
+ status: "removed",
273
+ reason: "deleted",
274
+ written: false
275
+ });
276
+ }
277
+ return results;
278
+ }
279
+ //#endregion
280
+ export { createStaticGen };
281
+
282
+ //# sourceMappingURL=create-static-gen.js.map