@btst/stack 1.0.1 → 1.1.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 (279) hide show
  1. package/README.md +156 -709
  2. package/dist/api/index.cjs +0 -1
  3. package/dist/api/index.d.cts +3 -3
  4. package/dist/api/index.d.mts +3 -3
  5. package/dist/api/index.d.ts +3 -3
  6. package/dist/api/index.mjs +0 -1
  7. package/dist/client/components/compose.cjs +68 -0
  8. package/dist/client/components/compose.mjs +65 -0
  9. package/dist/client/components/error-boundary.cjs +24 -0
  10. package/dist/client/components/error-boundary.mjs +22 -0
  11. package/dist/client/components/index.cjs +10 -0
  12. package/dist/client/components/index.d.cts +52 -0
  13. package/dist/client/components/index.d.mts +52 -0
  14. package/dist/client/components/index.d.ts +52 -0
  15. package/dist/client/components/index.mjs +2 -0
  16. package/dist/client/index.cjs +22 -5
  17. package/dist/client/index.d.cts +102 -8
  18. package/dist/client/index.d.mts +102 -8
  19. package/dist/client/index.d.ts +102 -8
  20. package/dist/client/index.mjs +20 -4
  21. package/dist/client/meta-utils.cjs +162 -0
  22. package/dist/client/meta-utils.mjs +160 -0
  23. package/dist/client/sitemap-utils.cjs +14 -0
  24. package/dist/client/sitemap-utils.mjs +12 -0
  25. package/dist/context/index.cjs +6 -63
  26. package/dist/context/index.d.cts +21 -24
  27. package/dist/context/index.d.mts +21 -24
  28. package/dist/context/index.d.ts +21 -24
  29. package/dist/context/index.mjs +1 -61
  30. package/dist/context/provider.cjs +51 -0
  31. package/dist/context/provider.mjs +46 -0
  32. package/dist/index.cjs +0 -3
  33. package/dist/index.d.cts +2 -2
  34. package/dist/index.d.mts +2 -2
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.mjs +0 -2
  37. package/dist/plugins/api/index.cjs +15 -0
  38. package/dist/plugins/api/index.d.cts +41 -0
  39. package/dist/plugins/api/index.d.mts +41 -0
  40. package/dist/plugins/api/index.d.ts +41 -0
  41. package/dist/plugins/api/index.mjs +9 -0
  42. package/dist/plugins/blog/api/index.cjs +11 -0
  43. package/dist/plugins/blog/api/index.d.cts +7 -0
  44. package/dist/plugins/blog/api/index.d.mts +7 -0
  45. package/dist/plugins/blog/api/index.d.ts +7 -0
  46. package/dist/plugins/blog/api/index.mjs +2 -0
  47. package/dist/plugins/blog/api/plugin.cjs +569 -0
  48. package/dist/plugins/blog/api/plugin.mjs +565 -0
  49. package/dist/plugins/blog/client/components/forms/image-field.cjs +133 -0
  50. package/dist/plugins/blog/client/components/forms/image-field.mjs +131 -0
  51. package/dist/plugins/blog/client/components/forms/markdown-editor-styles.css +30 -0
  52. package/dist/plugins/blog/client/components/forms/markdown-editor.cjs +106 -0
  53. package/dist/plugins/blog/client/components/forms/markdown-editor.mjs +104 -0
  54. package/dist/plugins/blog/client/components/forms/post-forms.cjs +401 -0
  55. package/dist/plugins/blog/client/components/forms/post-forms.mjs +398 -0
  56. package/dist/plugins/blog/client/components/forms/tags-multiselect.cjs +71 -0
  57. package/dist/plugins/blog/client/components/forms/tags-multiselect.mjs +65 -0
  58. package/dist/plugins/blog/client/components/index.cjs +17 -0
  59. package/dist/plugins/blog/client/components/index.d.cts +22 -0
  60. package/dist/plugins/blog/client/components/index.d.mts +22 -0
  61. package/dist/plugins/blog/client/components/index.d.ts +22 -0
  62. package/dist/plugins/blog/client/components/index.mjs +12 -0
  63. package/dist/plugins/blog/client/components/loading/form-page-skeleton.cjs +62 -0
  64. package/dist/plugins/blog/client/components/loading/form-page-skeleton.mjs +60 -0
  65. package/dist/plugins/blog/client/components/loading/index.cjs +20 -0
  66. package/dist/plugins/blog/client/components/loading/index.mjs +16 -0
  67. package/dist/plugins/blog/client/components/loading/list-page-skeleton.cjs +26 -0
  68. package/dist/plugins/blog/client/components/loading/list-page-skeleton.mjs +24 -0
  69. package/dist/plugins/blog/client/components/loading/page-header-skeleton.cjs +13 -0
  70. package/dist/plugins/blog/client/components/loading/page-header-skeleton.mjs +11 -0
  71. package/dist/plugins/blog/client/components/loading/post-card-skeleton.cjs +22 -0
  72. package/dist/plugins/blog/client/components/loading/post-card-skeleton.mjs +20 -0
  73. package/dist/plugins/blog/client/components/loading/post-page-skeleton.cjs +56 -0
  74. package/dist/plugins/blog/client/components/loading/post-page-skeleton.mjs +54 -0
  75. package/dist/plugins/blog/client/components/pages/404-page.cjs +19 -0
  76. package/dist/plugins/blog/client/components/pages/404-page.mjs +17 -0
  77. package/dist/plugins/blog/client/components/pages/edit-post-page.cjs +41 -0
  78. package/dist/plugins/blog/client/components/pages/edit-post-page.internal.cjs +57 -0
  79. package/dist/plugins/blog/client/components/pages/edit-post-page.internal.mjs +55 -0
  80. package/dist/plugins/blog/client/components/pages/edit-post-page.mjs +39 -0
  81. package/dist/plugins/blog/client/components/pages/home-page.cjs +41 -0
  82. package/dist/plugins/blog/client/components/pages/home-page.internal.cjs +61 -0
  83. package/dist/plugins/blog/client/components/pages/home-page.internal.mjs +59 -0
  84. package/dist/plugins/blog/client/components/pages/home-page.mjs +39 -0
  85. package/dist/plugins/blog/client/components/pages/new-post-page.cjs +37 -0
  86. package/dist/plugins/blog/client/components/pages/new-post-page.internal.cjs +53 -0
  87. package/dist/plugins/blog/client/components/pages/new-post-page.internal.mjs +51 -0
  88. package/dist/plugins/blog/client/components/pages/new-post-page.mjs +35 -0
  89. package/dist/plugins/blog/client/components/pages/post-page.cjs +39 -0
  90. package/dist/plugins/blog/client/components/pages/post-page.internal.cjs +101 -0
  91. package/dist/plugins/blog/client/components/pages/post-page.internal.mjs +99 -0
  92. package/dist/plugins/blog/client/components/pages/post-page.mjs +37 -0
  93. package/dist/plugins/blog/client/components/pages/tag-page.cjs +39 -0
  94. package/dist/plugins/blog/client/components/pages/tag-page.internal.cjs +61 -0
  95. package/dist/plugins/blog/client/components/pages/tag-page.internal.mjs +59 -0
  96. package/dist/plugins/blog/client/components/pages/tag-page.mjs +37 -0
  97. package/dist/plugins/blog/client/components/shared/better-blog-attribution.cjs +24 -0
  98. package/dist/plugins/blog/client/components/shared/better-blog-attribution.mjs +22 -0
  99. package/dist/plugins/blog/client/components/shared/default-error.cjs +18 -0
  100. package/dist/plugins/blog/client/components/shared/default-error.mjs +16 -0
  101. package/dist/plugins/blog/client/components/shared/defaults.cjs +13 -0
  102. package/dist/plugins/blog/client/components/shared/defaults.mjs +10 -0
  103. package/dist/plugins/blog/client/components/shared/empty-list.cjs +21 -0
  104. package/dist/plugins/blog/client/components/shared/empty-list.mjs +19 -0
  105. package/dist/plugins/blog/client/components/shared/error-placeholder.cjs +24 -0
  106. package/dist/plugins/blog/client/components/shared/error-placeholder.mjs +22 -0
  107. package/dist/plugins/blog/client/components/shared/highlight-text.cjs +53 -0
  108. package/dist/plugins/blog/client/components/shared/highlight-text.mjs +51 -0
  109. package/dist/plugins/blog/client/components/shared/markdown-content-styles.css +328 -0
  110. package/dist/plugins/blog/client/components/shared/markdown-content.cjs +324 -0
  111. package/dist/plugins/blog/client/components/shared/markdown-content.mjs +315 -0
  112. package/dist/plugins/blog/client/components/shared/on-this-page.cjs +161 -0
  113. package/dist/plugins/blog/client/components/shared/on-this-page.mjs +158 -0
  114. package/dist/plugins/blog/client/components/shared/page-header.cjs +40 -0
  115. package/dist/plugins/blog/client/components/shared/page-header.mjs +38 -0
  116. package/dist/plugins/blog/client/components/shared/page-layout.cjs +24 -0
  117. package/dist/plugins/blog/client/components/shared/page-layout.mjs +22 -0
  118. package/dist/plugins/blog/client/components/shared/page-wrapper.cjs +23 -0
  119. package/dist/plugins/blog/client/components/shared/page-wrapper.mjs +21 -0
  120. package/dist/plugins/blog/client/components/shared/post-card.cjs +279 -0
  121. package/dist/plugins/blog/client/components/shared/post-card.mjs +277 -0
  122. package/dist/plugins/blog/client/components/shared/post-navigation.cjs +74 -0
  123. package/dist/plugins/blog/client/components/shared/post-navigation.mjs +72 -0
  124. package/dist/plugins/blog/client/components/shared/posts-list.cjs +48 -0
  125. package/dist/plugins/blog/client/components/shared/posts-list.mjs +46 -0
  126. package/dist/plugins/blog/client/components/shared/recent-posts-carousel.cjs +59 -0
  127. package/dist/plugins/blog/client/components/shared/recent-posts-carousel.mjs +57 -0
  128. package/dist/plugins/blog/client/components/shared/search-input.cjs +136 -0
  129. package/dist/plugins/blog/client/components/shared/search-input.mjs +117 -0
  130. package/dist/plugins/blog/client/components/shared/search-modal.cjs +135 -0
  131. package/dist/plugins/blog/client/components/shared/search-modal.mjs +116 -0
  132. package/dist/plugins/blog/client/components/shared/tags-list.cjs +22 -0
  133. package/dist/plugins/blog/client/components/shared/tags-list.mjs +20 -0
  134. package/dist/plugins/blog/client/components/shared/use-route-lifecycle.cjs +50 -0
  135. package/dist/plugins/blog/client/components/shared/use-route-lifecycle.mjs +48 -0
  136. package/dist/plugins/blog/client/hooks/blog-hooks.cjs +380 -0
  137. package/dist/plugins/blog/client/hooks/blog-hooks.mjs +368 -0
  138. package/dist/plugins/blog/client/hooks/index.cjs +17 -0
  139. package/dist/plugins/blog/client/hooks/index.d.cts +150 -0
  140. package/dist/plugins/blog/client/hooks/index.d.mts +150 -0
  141. package/dist/plugins/blog/client/hooks/index.d.ts +150 -0
  142. package/dist/plugins/blog/client/hooks/index.mjs +1 -0
  143. package/dist/plugins/blog/client/hooks/use-debounce.cjs +16 -0
  144. package/dist/plugins/blog/client/hooks/use-debounce.mjs +14 -0
  145. package/dist/plugins/blog/client/index.cjs +7 -0
  146. package/dist/plugins/blog/client/index.d.cts +414 -0
  147. package/dist/plugins/blog/client/index.d.mts +414 -0
  148. package/dist/plugins/blog/client/index.d.ts +414 -0
  149. package/dist/plugins/blog/client/index.mjs +1 -0
  150. package/dist/plugins/blog/client/localization/blog-card.cjs +7 -0
  151. package/dist/plugins/blog/client/localization/blog-card.mjs +5 -0
  152. package/dist/plugins/blog/client/localization/blog-common.cjs +10 -0
  153. package/dist/plugins/blog/client/localization/blog-common.mjs +8 -0
  154. package/dist/plugins/blog/client/localization/blog-forms.cjs +40 -0
  155. package/dist/plugins/blog/client/localization/blog-forms.mjs +38 -0
  156. package/dist/plugins/blog/client/localization/blog-list.cjs +18 -0
  157. package/dist/plugins/blog/client/localization/blog-list.mjs +16 -0
  158. package/dist/plugins/blog/client/localization/blog-post.cjs +13 -0
  159. package/dist/plugins/blog/client/localization/blog-post.mjs +11 -0
  160. package/dist/plugins/blog/client/localization/index.cjs +17 -0
  161. package/dist/plugins/blog/client/localization/index.mjs +15 -0
  162. package/dist/plugins/blog/client/plugin.cjs +462 -0
  163. package/dist/plugins/blog/client/plugin.mjs +460 -0
  164. package/dist/plugins/blog/client.css +3 -0
  165. package/dist/plugins/blog/db.cjs +90 -0
  166. package/dist/plugins/blog/db.mjs +88 -0
  167. package/dist/plugins/blog/query-keys.cjs +181 -0
  168. package/dist/plugins/blog/query-keys.d.cts +530 -0
  169. package/dist/plugins/blog/query-keys.d.mts +530 -0
  170. package/dist/plugins/blog/query-keys.d.ts +530 -0
  171. package/dist/plugins/blog/query-keys.mjs +179 -0
  172. package/dist/plugins/blog/schemas.cjs +39 -0
  173. package/dist/plugins/blog/schemas.mjs +35 -0
  174. package/dist/plugins/blog/style.css +22 -0
  175. package/dist/plugins/blog/utils.cjs +97 -0
  176. package/dist/plugins/blog/utils.mjs +87 -0
  177. package/dist/plugins/client/index.cjs +15 -0
  178. package/dist/plugins/client/index.d.cts +57 -0
  179. package/dist/plugins/client/index.d.mts +57 -0
  180. package/dist/plugins/client/index.d.ts +57 -0
  181. package/dist/plugins/client/index.mjs +9 -0
  182. package/dist/{shared/stack.3OUyGp_E.mjs → plugins/utils.mjs} +1 -1
  183. package/dist/shared/{stack.DORw_1ps.d.cts → stack.ByOugz9d.d.cts} +17 -1
  184. package/dist/shared/{stack.DORw_1ps.d.mts → stack.ByOugz9d.d.mts} +17 -1
  185. package/dist/shared/{stack.DORw_1ps.d.ts → stack.ByOugz9d.d.ts} +17 -1
  186. package/dist/shared/stack.Cr2JoQdo.d.cts +76 -0
  187. package/dist/shared/stack.Cr2JoQdo.d.mts +76 -0
  188. package/dist/shared/stack.Cr2JoQdo.d.ts +76 -0
  189. package/package.json +102 -14
  190. package/src/__tests__/plugins.test.tsx +539 -0
  191. package/src/__tests__/sitemap.test.ts +60 -0
  192. package/src/api/index.ts +73 -0
  193. package/src/client/components/compose.tsx +116 -0
  194. package/src/client/components/error-boundary.tsx +30 -0
  195. package/src/client/components/index.tsx +2 -0
  196. package/src/client/index.ts +107 -0
  197. package/src/client/meta-utils.ts +228 -0
  198. package/src/client/sitemap-utils.ts +46 -0
  199. package/src/context/index.ts +1 -0
  200. package/src/context/provider.tsx +157 -0
  201. package/src/index.ts +1 -0
  202. package/src/plugins/api/index.ts +51 -0
  203. package/src/plugins/blog/api/index.ts +2 -0
  204. package/src/plugins/blog/api/plugin.ts +759 -0
  205. package/src/plugins/blog/client/components/forms/image-field.tsx +165 -0
  206. package/src/plugins/blog/client/components/forms/markdown-editor-styles.css +30 -0
  207. package/src/plugins/blog/client/components/forms/markdown-editor.tsx +136 -0
  208. package/src/plugins/blog/client/components/forms/post-forms.tsx +531 -0
  209. package/src/plugins/blog/client/components/forms/tags-multiselect.tsx +79 -0
  210. package/src/plugins/blog/client/components/index.tsx +11 -0
  211. package/src/plugins/blog/client/components/loading/form-page-skeleton.tsx +75 -0
  212. package/src/plugins/blog/client/components/loading/index.tsx +27 -0
  213. package/src/plugins/blog/client/components/loading/list-page-skeleton.tsx +38 -0
  214. package/src/plugins/blog/client/components/loading/page-header-skeleton.tsx +10 -0
  215. package/src/plugins/blog/client/components/loading/post-card-skeleton.tsx +30 -0
  216. package/src/plugins/blog/client/components/loading/post-page-skeleton.tsx +75 -0
  217. package/src/plugins/blog/client/components/pages/404-page.tsx +23 -0
  218. package/src/plugins/blog/client/components/pages/edit-post-page.internal.tsx +60 -0
  219. package/src/plugins/blog/client/components/pages/edit-post-page.tsx +40 -0
  220. package/src/plugins/blog/client/components/pages/home-page.internal.tsx +71 -0
  221. package/src/plugins/blog/client/components/pages/home-page.tsx +42 -0
  222. package/src/plugins/blog/client/components/pages/new-post-page.internal.tsx +59 -0
  223. package/src/plugins/blog/client/components/pages/new-post-page.tsx +36 -0
  224. package/src/plugins/blog/client/components/pages/post-page.internal.tsx +142 -0
  225. package/src/plugins/blog/client/components/pages/post-page.tsx +38 -0
  226. package/src/plugins/blog/client/components/pages/tag-page.internal.tsx +74 -0
  227. package/src/plugins/blog/client/components/pages/tag-page.tsx +38 -0
  228. package/src/plugins/blog/client/components/shared/better-blog-attribution.tsx +19 -0
  229. package/src/plugins/blog/client/components/shared/default-error.tsx +20 -0
  230. package/src/plugins/blog/client/components/shared/defaults.tsx +9 -0
  231. package/src/plugins/blog/client/components/shared/empty-list.tsx +25 -0
  232. package/src/plugins/blog/client/components/shared/error-placeholder.tsx +20 -0
  233. package/src/plugins/blog/client/components/shared/highlight-text.tsx +80 -0
  234. package/src/plugins/blog/client/components/shared/markdown-content-styles.css +328 -0
  235. package/src/plugins/blog/client/components/shared/markdown-content.tsx +448 -0
  236. package/src/plugins/blog/client/components/shared/on-this-page.tsx +234 -0
  237. package/src/plugins/blog/client/components/shared/page-header.tsx +35 -0
  238. package/src/plugins/blog/client/components/shared/page-layout.tsx +23 -0
  239. package/src/plugins/blog/client/components/shared/page-wrapper.tsx +32 -0
  240. package/src/plugins/blog/client/components/shared/post-card.tsx +308 -0
  241. package/src/plugins/blog/client/components/shared/post-navigation.tsx +98 -0
  242. package/src/plugins/blog/client/components/shared/posts-list.tsx +67 -0
  243. package/src/plugins/blog/client/components/shared/recent-posts-carousel.tsx +79 -0
  244. package/src/plugins/blog/client/components/shared/search-input.tsx +146 -0
  245. package/src/plugins/blog/client/components/shared/search-modal.tsx +162 -0
  246. package/src/plugins/blog/client/components/shared/tags-list.tsx +34 -0
  247. package/src/plugins/blog/client/components/shared/use-route-lifecycle.tsx +68 -0
  248. package/src/plugins/blog/client/hooks/blog-hooks.tsx +623 -0
  249. package/src/plugins/blog/client/hooks/index.tsx +1 -0
  250. package/src/plugins/blog/client/hooks/use-debounce.ts +43 -0
  251. package/src/plugins/blog/client/index.ts +9 -0
  252. package/src/plugins/blog/client/localization/blog-card.ts +3 -0
  253. package/src/plugins/blog/client/localization/blog-common.ts +7 -0
  254. package/src/plugins/blog/client/localization/blog-forms.ts +45 -0
  255. package/src/plugins/blog/client/localization/blog-list.ts +14 -0
  256. package/src/plugins/blog/client/localization/blog-post.ts +9 -0
  257. package/src/plugins/blog/client/localization/index.ts +15 -0
  258. package/src/plugins/blog/client/overrides.ts +123 -0
  259. package/src/plugins/blog/client/plugin.tsx +672 -0
  260. package/src/plugins/blog/client.css +3 -0
  261. package/src/plugins/blog/db.ts +90 -0
  262. package/src/plugins/blog/query-keys.ts +267 -0
  263. package/src/plugins/blog/schemas.ts +39 -0
  264. package/src/plugins/blog/style.css +22 -0
  265. package/src/plugins/blog/types.ts +37 -0
  266. package/src/plugins/blog/utils.ts +144 -0
  267. package/src/plugins/client/index.ts +53 -0
  268. package/src/plugins/index.ts +0 -0
  269. package/src/plugins/utils.ts +35 -0
  270. package/src/types.ts +209 -0
  271. package/dist/plugins/index.cjs +0 -15
  272. package/dist/plugins/index.d.cts +0 -64
  273. package/dist/plugins/index.d.mts +0 -64
  274. package/dist/plugins/index.d.ts +0 -64
  275. package/dist/plugins/index.mjs +0 -11
  276. package/dist/shared/stack.DrUAVfIH.d.cts +0 -17
  277. package/dist/shared/stack.DrUAVfIH.d.mts +0 -17
  278. package/dist/shared/stack.DrUAVfIH.d.ts +0 -17
  279. /package/dist/{shared/stack.CktCg4PJ.cjs → plugins/utils.cjs} +0 -0
@@ -27,5 +27,4 @@ function betterStack(config) {
27
27
  };
28
28
  }
29
29
 
30
- exports.createEndpoint = betterCall.createEndpoint;
31
30
  exports.betterStack = betterStack;
@@ -1,8 +1,8 @@
1
- import { d as PrefixedPluginRoutes, e as BackendLibConfig, f as BackendLib } from '../shared/stack.DORw_1ps.cjs';
2
- export { B as BackendPlugin } from '../shared/stack.DORw_1ps.cjs';
3
- export { createEndpoint } from 'better-call';
1
+ import { d as PrefixedPluginRoutes, e as BackendLibConfig, f as BackendLib } from '../shared/stack.ByOugz9d.cjs';
2
+ export { B as BackendPlugin } from '../shared/stack.ByOugz9d.cjs';
4
3
  import '@btst/yar';
5
4
  import '@btst/db';
5
+ import 'better-call';
6
6
 
7
7
  /**
8
8
  * Creates the backend library with plugin support
@@ -1,8 +1,8 @@
1
- import { d as PrefixedPluginRoutes, e as BackendLibConfig, f as BackendLib } from '../shared/stack.DORw_1ps.mjs';
2
- export { B as BackendPlugin } from '../shared/stack.DORw_1ps.mjs';
3
- export { createEndpoint } from 'better-call';
1
+ import { d as PrefixedPluginRoutes, e as BackendLibConfig, f as BackendLib } from '../shared/stack.ByOugz9d.mjs';
2
+ export { B as BackendPlugin } from '../shared/stack.ByOugz9d.mjs';
4
3
  import '@btst/yar';
5
4
  import '@btst/db';
5
+ import 'better-call';
6
6
 
7
7
  /**
8
8
  * Creates the backend library with plugin support
@@ -1,8 +1,8 @@
1
- import { d as PrefixedPluginRoutes, e as BackendLibConfig, f as BackendLib } from '../shared/stack.DORw_1ps.js';
2
- export { B as BackendPlugin } from '../shared/stack.DORw_1ps.js';
3
- export { createEndpoint } from 'better-call';
1
+ import { d as PrefixedPluginRoutes, e as BackendLibConfig, f as BackendLib } from '../shared/stack.ByOugz9d.js';
2
+ export { B as BackendPlugin } from '../shared/stack.ByOugz9d.js';
4
3
  import '@btst/yar';
5
4
  import '@btst/db';
5
+ import 'better-call';
6
6
 
7
7
  /**
8
8
  * Creates the backend library with plugin support
@@ -1,5 +1,4 @@
1
1
  import { createRouter } from 'better-call';
2
- export { createEndpoint } from 'better-call';
3
2
  import { defineDb } from '@btst/db';
4
3
 
5
4
  function betterStack(config) {
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const React = require('react');
6
+ const errorBoundary = require('./error-boundary.cjs');
7
+
8
+ function RouteRenderer({
9
+ router,
10
+ path,
11
+ NotFoundComponent,
12
+ onNotFound,
13
+ onError,
14
+ props
15
+ }) {
16
+ const route = router.getRoute(path);
17
+ return /* @__PURE__ */ jsxRuntime.jsx(
18
+ ComposedRoute,
19
+ {
20
+ path,
21
+ PageComponent: route?.PageComponent,
22
+ ErrorComponent: route?.ErrorComponent,
23
+ LoadingComponent: route?.LoadingComponent,
24
+ onNotFound,
25
+ NotFoundComponent,
26
+ onError,
27
+ props
28
+ }
29
+ );
30
+ }
31
+ function ComposedRoute({
32
+ path,
33
+ PageComponent,
34
+ ErrorComponent,
35
+ LoadingComponent,
36
+ onNotFound,
37
+ NotFoundComponent,
38
+ props,
39
+ onError
40
+ }) {
41
+ if (PageComponent) {
42
+ const content = /* @__PURE__ */ jsxRuntime.jsx(PageComponent, { ...props });
43
+ const isBrowser = typeof window !== "undefined";
44
+ const suspenseFallback = isBrowser && LoadingComponent ? /* @__PURE__ */ jsxRuntime.jsx(LoadingComponent, {}) : null;
45
+ if (ErrorComponent) {
46
+ return /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: suspenseFallback, children: /* @__PURE__ */ jsxRuntime.jsx(
47
+ errorBoundary.ErrorBoundary,
48
+ {
49
+ FallbackComponent: ErrorComponent,
50
+ resetKeys: [path],
51
+ onError,
52
+ children: /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: suspenseFallback, children: content }, `inner-${path}`)
53
+ }
54
+ ) }, `outer-${path}`);
55
+ }
56
+ return /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: suspenseFallback, children: content }, path);
57
+ } else {
58
+ if (onNotFound) {
59
+ onNotFound();
60
+ }
61
+ if (NotFoundComponent) {
62
+ return /* @__PURE__ */ jsxRuntime.jsx(NotFoundComponent, { message: `Unknown route: ${path}` });
63
+ }
64
+ }
65
+ }
66
+
67
+ exports.ComposedRoute = ComposedRoute;
68
+ exports.RouteRenderer = RouteRenderer;
@@ -0,0 +1,65 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { Suspense } from 'react';
4
+ import { ErrorBoundary } from './error-boundary.mjs';
5
+
6
+ function RouteRenderer({
7
+ router,
8
+ path,
9
+ NotFoundComponent,
10
+ onNotFound,
11
+ onError,
12
+ props
13
+ }) {
14
+ const route = router.getRoute(path);
15
+ return /* @__PURE__ */ jsx(
16
+ ComposedRoute,
17
+ {
18
+ path,
19
+ PageComponent: route?.PageComponent,
20
+ ErrorComponent: route?.ErrorComponent,
21
+ LoadingComponent: route?.LoadingComponent,
22
+ onNotFound,
23
+ NotFoundComponent,
24
+ onError,
25
+ props
26
+ }
27
+ );
28
+ }
29
+ function ComposedRoute({
30
+ path,
31
+ PageComponent,
32
+ ErrorComponent,
33
+ LoadingComponent,
34
+ onNotFound,
35
+ NotFoundComponent,
36
+ props,
37
+ onError
38
+ }) {
39
+ if (PageComponent) {
40
+ const content = /* @__PURE__ */ jsx(PageComponent, { ...props });
41
+ const isBrowser = typeof window !== "undefined";
42
+ const suspenseFallback = isBrowser && LoadingComponent ? /* @__PURE__ */ jsx(LoadingComponent, {}) : null;
43
+ if (ErrorComponent) {
44
+ return /* @__PURE__ */ jsx(Suspense, { fallback: suspenseFallback, children: /* @__PURE__ */ jsx(
45
+ ErrorBoundary,
46
+ {
47
+ FallbackComponent: ErrorComponent,
48
+ resetKeys: [path],
49
+ onError,
50
+ children: /* @__PURE__ */ jsx(Suspense, { fallback: suspenseFallback, children: content }, `inner-${path}`)
51
+ }
52
+ ) }, `outer-${path}`);
53
+ }
54
+ return /* @__PURE__ */ jsx(Suspense, { fallback: suspenseFallback, children: content }, path);
55
+ } else {
56
+ if (onNotFound) {
57
+ onNotFound();
58
+ }
59
+ if (NotFoundComponent) {
60
+ return /* @__PURE__ */ jsx(NotFoundComponent, { message: `Unknown route: ${path}` });
61
+ }
62
+ }
63
+ }
64
+
65
+ export { ComposedRoute, RouteRenderer };
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const reactErrorBoundary = require('react-error-boundary');
6
+
7
+ function ErrorBoundary({
8
+ children,
9
+ FallbackComponent,
10
+ resetKeys,
11
+ onError
12
+ }) {
13
+ return /* @__PURE__ */ jsxRuntime.jsx(
14
+ reactErrorBoundary.ErrorBoundary,
15
+ {
16
+ FallbackComponent,
17
+ onError,
18
+ resetKeys,
19
+ children
20
+ }
21
+ );
22
+ }
23
+
24
+ exports.ErrorBoundary = ErrorBoundary;
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
4
+
5
+ function ErrorBoundary({
6
+ children,
7
+ FallbackComponent,
8
+ resetKeys,
9
+ onError
10
+ }) {
11
+ return /* @__PURE__ */ jsx(
12
+ ErrorBoundary$1,
13
+ {
14
+ FallbackComponent,
15
+ onError,
16
+ resetKeys,
17
+ children
18
+ }
19
+ );
20
+ }
21
+
22
+ export { ErrorBoundary };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const compose = require('./compose.cjs');
4
+ const errorBoundary = require('./error-boundary.cjs');
5
+
6
+
7
+
8
+ exports.ComposedRoute = compose.ComposedRoute;
9
+ exports.RouteRenderer = compose.RouteRenderer;
10
+ exports.ErrorBoundary = errorBoundary.ErrorBoundary;
@@ -0,0 +1,52 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import react__default, { ErrorInfo } from 'react';
3
+ import { FallbackProps } from 'react-error-boundary';
4
+ export { FallbackProps } from 'react-error-boundary';
5
+ import { createRouter } from '@btst/yar';
6
+
7
+ /**
8
+ * Route type with optional components
9
+ */
10
+ type RouteWithComponents = {
11
+ PageComponent?: react__default.ComponentType;
12
+ ErrorComponent?: react__default.ComponentType<FallbackProps>;
13
+ LoadingComponent?: react__default.ComponentType;
14
+ } | null | undefined;
15
+ /**
16
+ * Composes the route content with Suspense and Error Boundary
17
+ * Resolves the route on the client-side where component references are available
18
+ *
19
+ * This is marked "use client" so it can access component references safely
20
+ */
21
+ declare function RouteRenderer({ router, path, NotFoundComponent, onNotFound, onError, props, }: {
22
+ router: ReturnType<typeof createRouter>;
23
+ path: string;
24
+ NotFoundComponent?: react__default.ComponentType<{
25
+ message: string;
26
+ }>;
27
+ onNotFound?: () => never;
28
+ onError: (error: Error, info: ErrorInfo) => void;
29
+ props?: any;
30
+ }): react_jsx_runtime.JSX.Element;
31
+ declare function ComposedRoute({ path, PageComponent, ErrorComponent, LoadingComponent, onNotFound, NotFoundComponent, props, onError, }: {
32
+ path: string;
33
+ PageComponent: react__default.ComponentType<any>;
34
+ ErrorComponent?: react__default.ComponentType<FallbackProps>;
35
+ LoadingComponent: react__default.ComponentType;
36
+ onNotFound?: () => never;
37
+ NotFoundComponent?: react__default.ComponentType<{
38
+ message: string;
39
+ }>;
40
+ props?: any;
41
+ onError: (error: Error, info: ErrorInfo) => void;
42
+ }): react_jsx_runtime.JSX.Element | undefined;
43
+
44
+ declare function ErrorBoundary({ children, FallbackComponent, resetKeys, onError, }: {
45
+ children: React.ReactNode;
46
+ FallbackComponent: React.ComponentType<FallbackProps>;
47
+ resetKeys?: Array<string | number | boolean | null | undefined>;
48
+ onError: (error: Error, info: ErrorInfo) => void;
49
+ }): react_jsx_runtime.JSX.Element;
50
+
51
+ export { ComposedRoute, ErrorBoundary, RouteRenderer };
52
+ export type { RouteWithComponents };
@@ -0,0 +1,52 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import react__default, { ErrorInfo } from 'react';
3
+ import { FallbackProps } from 'react-error-boundary';
4
+ export { FallbackProps } from 'react-error-boundary';
5
+ import { createRouter } from '@btst/yar';
6
+
7
+ /**
8
+ * Route type with optional components
9
+ */
10
+ type RouteWithComponents = {
11
+ PageComponent?: react__default.ComponentType;
12
+ ErrorComponent?: react__default.ComponentType<FallbackProps>;
13
+ LoadingComponent?: react__default.ComponentType;
14
+ } | null | undefined;
15
+ /**
16
+ * Composes the route content with Suspense and Error Boundary
17
+ * Resolves the route on the client-side where component references are available
18
+ *
19
+ * This is marked "use client" so it can access component references safely
20
+ */
21
+ declare function RouteRenderer({ router, path, NotFoundComponent, onNotFound, onError, props, }: {
22
+ router: ReturnType<typeof createRouter>;
23
+ path: string;
24
+ NotFoundComponent?: react__default.ComponentType<{
25
+ message: string;
26
+ }>;
27
+ onNotFound?: () => never;
28
+ onError: (error: Error, info: ErrorInfo) => void;
29
+ props?: any;
30
+ }): react_jsx_runtime.JSX.Element;
31
+ declare function ComposedRoute({ path, PageComponent, ErrorComponent, LoadingComponent, onNotFound, NotFoundComponent, props, onError, }: {
32
+ path: string;
33
+ PageComponent: react__default.ComponentType<any>;
34
+ ErrorComponent?: react__default.ComponentType<FallbackProps>;
35
+ LoadingComponent: react__default.ComponentType;
36
+ onNotFound?: () => never;
37
+ NotFoundComponent?: react__default.ComponentType<{
38
+ message: string;
39
+ }>;
40
+ props?: any;
41
+ onError: (error: Error, info: ErrorInfo) => void;
42
+ }): react_jsx_runtime.JSX.Element | undefined;
43
+
44
+ declare function ErrorBoundary({ children, FallbackComponent, resetKeys, onError, }: {
45
+ children: React.ReactNode;
46
+ FallbackComponent: React.ComponentType<FallbackProps>;
47
+ resetKeys?: Array<string | number | boolean | null | undefined>;
48
+ onError: (error: Error, info: ErrorInfo) => void;
49
+ }): react_jsx_runtime.JSX.Element;
50
+
51
+ export { ComposedRoute, ErrorBoundary, RouteRenderer };
52
+ export type { RouteWithComponents };
@@ -0,0 +1,52 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import react__default, { ErrorInfo } from 'react';
3
+ import { FallbackProps } from 'react-error-boundary';
4
+ export { FallbackProps } from 'react-error-boundary';
5
+ import { createRouter } from '@btst/yar';
6
+
7
+ /**
8
+ * Route type with optional components
9
+ */
10
+ type RouteWithComponents = {
11
+ PageComponent?: react__default.ComponentType;
12
+ ErrorComponent?: react__default.ComponentType<FallbackProps>;
13
+ LoadingComponent?: react__default.ComponentType;
14
+ } | null | undefined;
15
+ /**
16
+ * Composes the route content with Suspense and Error Boundary
17
+ * Resolves the route on the client-side where component references are available
18
+ *
19
+ * This is marked "use client" so it can access component references safely
20
+ */
21
+ declare function RouteRenderer({ router, path, NotFoundComponent, onNotFound, onError, props, }: {
22
+ router: ReturnType<typeof createRouter>;
23
+ path: string;
24
+ NotFoundComponent?: react__default.ComponentType<{
25
+ message: string;
26
+ }>;
27
+ onNotFound?: () => never;
28
+ onError: (error: Error, info: ErrorInfo) => void;
29
+ props?: any;
30
+ }): react_jsx_runtime.JSX.Element;
31
+ declare function ComposedRoute({ path, PageComponent, ErrorComponent, LoadingComponent, onNotFound, NotFoundComponent, props, onError, }: {
32
+ path: string;
33
+ PageComponent: react__default.ComponentType<any>;
34
+ ErrorComponent?: react__default.ComponentType<FallbackProps>;
35
+ LoadingComponent: react__default.ComponentType;
36
+ onNotFound?: () => never;
37
+ NotFoundComponent?: react__default.ComponentType<{
38
+ message: string;
39
+ }>;
40
+ props?: any;
41
+ onError: (error: Error, info: ErrorInfo) => void;
42
+ }): react_jsx_runtime.JSX.Element | undefined;
43
+
44
+ declare function ErrorBoundary({ children, FallbackComponent, resetKeys, onError, }: {
45
+ children: React.ReactNode;
46
+ FallbackComponent: React.ComponentType<FallbackProps>;
47
+ resetKeys?: Array<string | number | boolean | null | undefined>;
48
+ onError: (error: Error, info: ErrorInfo) => void;
49
+ }): react_jsx_runtime.JSX.Element;
50
+
51
+ export { ComposedRoute, ErrorBoundary, RouteRenderer };
52
+ export type { RouteWithComponents };
@@ -0,0 +1,2 @@
1
+ export { ComposedRoute, RouteRenderer } from './compose.mjs';
2
+ export { ErrorBoundary } from './error-boundary.mjs';
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const yar = require('@btst/yar');
4
- const utils = require('../shared/stack.CktCg4PJ.cjs');
5
- require('better-call/client');
4
+ const sitemapUtils = require('./sitemap-utils.cjs');
5
+ const metaUtils = require('./meta-utils.cjs');
6
6
 
7
7
  function createStackClient(config) {
8
8
  const { plugins } = config;
@@ -13,10 +13,27 @@ function createStackClient(config) {
13
13
  }
14
14
  const router = yar.createRouter(allRoutes);
15
15
  return {
16
- router
16
+ router,
17
+ async generateSitemap() {
18
+ const sitemapEntries = [];
19
+ for (const plugin of Object.values(plugins)) {
20
+ if (typeof plugin.sitemap === "function") {
21
+ const entries = await plugin.sitemap();
22
+ if (Array.isArray(entries)) sitemapEntries.push(...entries);
23
+ }
24
+ }
25
+ const seen = /* @__PURE__ */ new Set();
26
+ const deduped = [];
27
+ for (const entry of sitemapEntries) {
28
+ if (!entry?.url || seen.has(entry.url)) continue;
29
+ seen.add(entry.url);
30
+ deduped.push(entry);
31
+ }
32
+ return deduped;
33
+ }
17
34
  };
18
35
  }
19
36
 
20
- exports.createRoute = yar.createRoute;
21
- exports.createApiClient = utils.createApiClient;
37
+ exports.sitemapEntryToXmlString = sitemapUtils.sitemapEntryToXmlString;
38
+ exports.metaElementsToObject = metaUtils.metaElementsToObject;
22
39
  exports.createStackClient = createStackClient;
@@ -1,9 +1,76 @@
1
- import { C as ClientPlugin, P as PluginRoutes, a as ClientLibConfig, b as ClientLib } from '../shared/stack.DORw_1ps.cjs';
2
- export { createRoute } from '@btst/yar';
3
- export { c as createApiClient } from '../shared/stack.DrUAVfIH.cjs';
1
+ import { S as Sitemap, C as ClientPlugin, a as PluginRoutes, b as ClientLibConfig, c as ClientLib } from '../shared/stack.ByOugz9d.cjs';
2
+ import '@btst/yar';
4
3
  import '@btst/db';
5
4
  import 'better-call';
6
- import 'better-call/client';
5
+
6
+ /**
7
+ * Converts an array of sitemap entries into an XML string following the sitemap.org protocol.
8
+ *
9
+ * @param entries - Array of sitemap entries from `lib.generateSitemap()`
10
+ * @returns Complete XML string for the sitemap
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const entries = await lib.generateSitemap();
15
+ * const xml = sitemapEntryToXmlString(entries);
16
+ * return new Response(xml, {
17
+ * headers: { "Content-Type": "application/xml; charset=utf-8" }
18
+ * });
19
+ * ```
20
+ */
21
+ declare function sitemapEntryToXmlString(entries: Sitemap): string;
22
+
23
+ interface Metadata {
24
+ title: string;
25
+ description?: string;
26
+ keywords?: string[];
27
+ applicationName?: string;
28
+ generator?: string;
29
+ referrer?: "no-referrer" | "origin" | "no-referrer-when-downgrade" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin";
30
+ themeColor?: string;
31
+ viewport?: string;
32
+ creator?: string;
33
+ publisher?: string;
34
+ authors?: {
35
+ name: string;
36
+ }[];
37
+ abstract?: string;
38
+ robots?: string;
39
+ alternates?: Partial<{
40
+ canonical: string;
41
+ }>;
42
+ twitter?: Partial<{
43
+ title: string;
44
+ description: string;
45
+ site: string;
46
+ creator: string;
47
+ images?: string[];
48
+ }>;
49
+ openGraph?: Partial<{
50
+ title: string;
51
+ description: string;
52
+ url: string;
53
+ siteName: string;
54
+ locale: string;
55
+ images?: string[];
56
+ videos?: string[];
57
+ audio?: string[];
58
+ }>;
59
+ }
60
+ /**
61
+ * Converts an array of meta elements to a metadata object
62
+ * @param metaElements - An array of meta elements
63
+ * @example
64
+ * ```ts
65
+ * const metaElements = [
66
+ * { name: "title", content: "My Page" },
67
+ * { name: "description", content: "This is my page" },
68
+ * ];
69
+ * const metadata = metaElementsToObject(metaElements);
70
+ * console.log(metadata);
71
+ * ```
72
+ */
73
+ declare function metaElementsToObject(metaElements: Array<React.JSX.IntrinsicElements["meta"] | undefined>): Metadata;
7
74
 
8
75
  /**
9
76
  * Creates the client library with plugin support
@@ -13,12 +80,39 @@ import 'better-call/client';
13
80
  * // For Next.js with SSR:
14
81
  * const lib = createStackClient({
15
82
  * plugins: {
16
- * messages: messagesPlugin.client
83
+ * blog: blogPlugin.client
17
84
  * }
18
85
  * });
19
86
  *
20
- * // Access router for page routing
21
- * const route = lib.router.getRoute('/messages');
87
+ * // SPA usage - just render the route
88
+ * function Page() {
89
+ * return lib.resolveRoute('/blog');
90
+ * }
91
+ *
92
+ * // SSR usage - prefetch data with loader, then render
93
+ * async function Page({ params }) {
94
+ * const path = '/blog';
95
+ *
96
+ * // Load data server-side if loader exists
97
+ * const loader = lib.getLoader(path);
98
+ * if (loader) await loader(queryClient, baseURL, basePath);
99
+ *
100
+ * // Render with built-in Suspense + Error Boundary
101
+ * return lib.resolveRoute(path);
102
+ * }
103
+ *
104
+ * // Next.js with notFound() function
105
+ * import { notFound } from 'next/navigation';
106
+ *
107
+ * async function Page({ params }) {
108
+ * const path = '/blog';
109
+ * const loader = lib.getLoader(path);
110
+ * if (loader) await loader(queryClient, baseURL);
111
+ *
112
+ * return lib.resolveRoute(path, {
113
+ * onNotFound: notFound // Calls Next.js notFound() instead of rendering
114
+ * });
115
+ * }
22
116
  *
23
117
  * ```
24
118
  *
@@ -27,4 +121,4 @@ import 'better-call/client';
27
121
  */
28
122
  declare function createStackClient<TPlugins extends Record<string, ClientPlugin<any, any>>, TRoutes extends PluginRoutes<TPlugins> = PluginRoutes<TPlugins>>(config: ClientLibConfig<TPlugins>): ClientLib<TRoutes>;
29
123
 
30
- export { ClientLib, ClientLibConfig, ClientPlugin, createStackClient };
124
+ export { ClientLib, ClientLibConfig, ClientPlugin, createStackClient, metaElementsToObject, sitemapEntryToXmlString };