@btst/stack 1.0.0 → 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 +237 -2
  2. package/dist/api/index.cjs +2 -2
  3. package/dist/api/index.d.cts +2 -2
  4. package/dist/api/index.d.mts +2 -2
  5. package/dist/api/index.d.ts +2 -2
  6. package/dist/api/index.mjs +2 -2
  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 +21 -16
  17. package/dist/client/index.d.cts +102 -14
  18. package/dist/client/index.d.mts +102 -14
  19. package/dist/client/index.d.ts +102 -14
  20. package/dist/client/index.mjs +19 -10
  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 -51
  26. package/dist/context/index.d.cts +26 -26
  27. package/dist/context/index.d.mts +26 -26
  28. package/dist/context/index.d.ts +26 -26
  29. package/dist/context/index.mjs +1 -50
  30. package/dist/context/provider.cjs +51 -0
  31. package/dist/context/provider.mjs +46 -0
  32. package/dist/index.cjs +0 -2
  33. package/dist/index.d.cts +1 -1
  34. package/dist/index.d.mts +1 -1
  35. package/dist/index.d.ts +1 -1
  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.Br2KMECJ.cjs → plugins/utils.cjs} +1 -8
  183. package/dist/{shared/stack.CwGEQ10b.mjs → plugins/utils.mjs} +2 -8
  184. package/dist/shared/{stack.Dva9muUy.d.cts → stack.ByOugz9d.d.cts} +17 -23
  185. package/dist/shared/{stack.Dva9muUy.d.mts → stack.ByOugz9d.d.mts} +17 -23
  186. package/dist/shared/{stack.Dva9muUy.d.ts → stack.ByOugz9d.d.ts} +17 -23
  187. package/dist/shared/stack.Cr2JoQdo.d.cts +76 -0
  188. package/dist/shared/stack.Cr2JoQdo.d.mts +76 -0
  189. package/dist/shared/stack.Cr2JoQdo.d.ts +76 -0
  190. package/package.json +104 -16
  191. package/src/__tests__/plugins.test.tsx +539 -0
  192. package/src/__tests__/sitemap.test.ts +60 -0
  193. package/src/api/index.ts +73 -0
  194. package/src/client/components/compose.tsx +116 -0
  195. package/src/client/components/error-boundary.tsx +30 -0
  196. package/src/client/components/index.tsx +2 -0
  197. package/src/client/index.ts +107 -0
  198. package/src/client/meta-utils.ts +228 -0
  199. package/src/client/sitemap-utils.ts +46 -0
  200. package/src/context/index.ts +1 -0
  201. package/src/context/provider.tsx +157 -0
  202. package/src/index.ts +1 -0
  203. package/src/plugins/api/index.ts +51 -0
  204. package/src/plugins/blog/api/index.ts +2 -0
  205. package/src/plugins/blog/api/plugin.ts +759 -0
  206. package/src/plugins/blog/client/components/forms/image-field.tsx +165 -0
  207. package/src/plugins/blog/client/components/forms/markdown-editor-styles.css +30 -0
  208. package/src/plugins/blog/client/components/forms/markdown-editor.tsx +136 -0
  209. package/src/plugins/blog/client/components/forms/post-forms.tsx +531 -0
  210. package/src/plugins/blog/client/components/forms/tags-multiselect.tsx +79 -0
  211. package/src/plugins/blog/client/components/index.tsx +11 -0
  212. package/src/plugins/blog/client/components/loading/form-page-skeleton.tsx +75 -0
  213. package/src/plugins/blog/client/components/loading/index.tsx +27 -0
  214. package/src/plugins/blog/client/components/loading/list-page-skeleton.tsx +38 -0
  215. package/src/plugins/blog/client/components/loading/page-header-skeleton.tsx +10 -0
  216. package/src/plugins/blog/client/components/loading/post-card-skeleton.tsx +30 -0
  217. package/src/plugins/blog/client/components/loading/post-page-skeleton.tsx +75 -0
  218. package/src/plugins/blog/client/components/pages/404-page.tsx +23 -0
  219. package/src/plugins/blog/client/components/pages/edit-post-page.internal.tsx +60 -0
  220. package/src/plugins/blog/client/components/pages/edit-post-page.tsx +40 -0
  221. package/src/plugins/blog/client/components/pages/home-page.internal.tsx +71 -0
  222. package/src/plugins/blog/client/components/pages/home-page.tsx +42 -0
  223. package/src/plugins/blog/client/components/pages/new-post-page.internal.tsx +59 -0
  224. package/src/plugins/blog/client/components/pages/new-post-page.tsx +36 -0
  225. package/src/plugins/blog/client/components/pages/post-page.internal.tsx +142 -0
  226. package/src/plugins/blog/client/components/pages/post-page.tsx +38 -0
  227. package/src/plugins/blog/client/components/pages/tag-page.internal.tsx +74 -0
  228. package/src/plugins/blog/client/components/pages/tag-page.tsx +38 -0
  229. package/src/plugins/blog/client/components/shared/better-blog-attribution.tsx +19 -0
  230. package/src/plugins/blog/client/components/shared/default-error.tsx +20 -0
  231. package/src/plugins/blog/client/components/shared/defaults.tsx +9 -0
  232. package/src/plugins/blog/client/components/shared/empty-list.tsx +25 -0
  233. package/src/plugins/blog/client/components/shared/error-placeholder.tsx +20 -0
  234. package/src/plugins/blog/client/components/shared/highlight-text.tsx +80 -0
  235. package/src/plugins/blog/client/components/shared/markdown-content-styles.css +328 -0
  236. package/src/plugins/blog/client/components/shared/markdown-content.tsx +448 -0
  237. package/src/plugins/blog/client/components/shared/on-this-page.tsx +234 -0
  238. package/src/plugins/blog/client/components/shared/page-header.tsx +35 -0
  239. package/src/plugins/blog/client/components/shared/page-layout.tsx +23 -0
  240. package/src/plugins/blog/client/components/shared/page-wrapper.tsx +32 -0
  241. package/src/plugins/blog/client/components/shared/post-card.tsx +308 -0
  242. package/src/plugins/blog/client/components/shared/post-navigation.tsx +98 -0
  243. package/src/plugins/blog/client/components/shared/posts-list.tsx +67 -0
  244. package/src/plugins/blog/client/components/shared/recent-posts-carousel.tsx +79 -0
  245. package/src/plugins/blog/client/components/shared/search-input.tsx +146 -0
  246. package/src/plugins/blog/client/components/shared/search-modal.tsx +162 -0
  247. package/src/plugins/blog/client/components/shared/tags-list.tsx +34 -0
  248. package/src/plugins/blog/client/components/shared/use-route-lifecycle.tsx +68 -0
  249. package/src/plugins/blog/client/hooks/blog-hooks.tsx +623 -0
  250. package/src/plugins/blog/client/hooks/index.tsx +1 -0
  251. package/src/plugins/blog/client/hooks/use-debounce.ts +43 -0
  252. package/src/plugins/blog/client/index.ts +9 -0
  253. package/src/plugins/blog/client/localization/blog-card.ts +3 -0
  254. package/src/plugins/blog/client/localization/blog-common.ts +7 -0
  255. package/src/plugins/blog/client/localization/blog-forms.ts +45 -0
  256. package/src/plugins/blog/client/localization/blog-list.ts +14 -0
  257. package/src/plugins/blog/client/localization/blog-post.ts +9 -0
  258. package/src/plugins/blog/client/localization/index.ts +15 -0
  259. package/src/plugins/blog/client/overrides.ts +123 -0
  260. package/src/plugins/blog/client/plugin.tsx +672 -0
  261. package/src/plugins/blog/client.css +3 -0
  262. package/src/plugins/blog/db.ts +90 -0
  263. package/src/plugins/blog/query-keys.ts +267 -0
  264. package/src/plugins/blog/schemas.ts +39 -0
  265. package/src/plugins/blog/style.css +22 -0
  266. package/src/plugins/blog/types.ts +37 -0
  267. package/src/plugins/blog/utils.ts +144 -0
  268. package/src/plugins/client/index.ts +53 -0
  269. package/src/plugins/index.ts +0 -0
  270. package/src/plugins/utils.ts +35 -0
  271. package/src/types.ts +209 -0
  272. package/dist/plugins/index.cjs +0 -16
  273. package/dist/plugins/index.d.cts +0 -64
  274. package/dist/plugins/index.d.mts +0 -64
  275. package/dist/plugins/index.d.ts +0 -64
  276. package/dist/plugins/index.mjs +0 -11
  277. package/dist/shared/stack.DvFqFlOV.d.cts +0 -22
  278. package/dist/shared/stack.DvFqFlOV.d.mts +0 -22
  279. package/dist/shared/stack.DvFqFlOV.d.ts +0 -22
@@ -24,11 +24,6 @@ interface BackendPlugin<TRoutes extends Record<string, Endpoint> = Record<string
24
24
  routes: (adapter: Adapter) => TRoutes;
25
25
  dbPlugin: DbPlugin;
26
26
  }
27
- /**
28
- * Hook function type
29
- * Generic function type for React hooks returned by plugins
30
- */
31
- type HookFunction = (...args: unknown[]) => unknown;
32
27
  /**
33
28
  * Frontend plugin definition
34
29
  * Defines pages, components, loaders, and React Query hooks for a feature
@@ -45,20 +40,16 @@ interface ClientPlugin<TOverrides = Record<string, never>, TRoutes extends Recor
45
40
  */
46
41
  routes: () => TRoutes;
47
42
  /**
48
- * Optional: Create React Query hooks for this plugin
49
- * These can be used directly in components without the loader
43
+ * Optional sitemap generator for this plugin. Should return absolute URLs.
44
+ * Implementations can call their own API endpoints to include dynamic routes.
50
45
  */
51
- hooks?: () => Record<string, HookFunction>;
52
- /**
53
- * Optional: Default implementations for overridable components/functions
54
- * These will be used if no override is provided in BetterStackContext
55
- */
56
- defaultOverrides?: Partial<TOverrides>;
46
+ sitemap?: () => Promise<Sitemap> | Sitemap;
57
47
  }
58
48
  /**
59
49
  * Configuration for creating the backend library
60
50
  */
61
51
  interface BackendLibConfig<TPlugins extends Record<string, BackendPlugin<any>> = Record<string, BackendPlugin<any>>> {
52
+ basePath: string;
62
53
  dbSchema?: DatabaseDefinition;
63
54
  plugins: TPlugins;
64
55
  adapter: (db: DatabaseDefinition) => Adapter;
@@ -89,13 +80,6 @@ type PluginOverrides<TPlugins extends Record<string, ClientPlugin<any, any>>> =
89
80
  * Extract all routes from all client plugins, merging them into a single record
90
81
  */
91
82
  type PluginRoutes<TPlugins extends Record<string, ClientPlugin<any, any>>> = MergeAllPluginRoutes<TPlugins>;
92
- /**
93
- * Extract all hooks from all client plugins, organized by plugin name
94
- * For plugins without hooks, the type will be an empty object
95
- */
96
- type PluginHooks<TPlugins extends Record<string, ClientPlugin<any, any>>> = {
97
- [K in keyof TPlugins]: TPlugins[K]["hooks"] extends () => infer H ? H : {};
98
- };
99
83
  /**
100
84
  * Prefix all backend plugin route keys with the plugin name
101
85
  * Example: { messages: { list: Endpoint } } => { messages_list: Endpoint }
@@ -130,9 +114,19 @@ type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) exten
130
114
  /**
131
115
  * Result of creating the client library
132
116
  */
133
- interface ClientLib<TRoutes extends Record<string, Route> = Record<string, Route>, THooks extends Record<string, any> = Record<string, any>> {
117
+ interface ClientLib<TRoutes extends Record<string, Route> = Record<string, Route>> {
134
118
  router: ReturnType<typeof createRouter<TRoutes, {}>>;
135
- hooks: THooks;
119
+ generateSitemap: () => Promise<Sitemap>;
136
120
  }
121
+ /**
122
+ * Minimal sitemap entry shape aligned with Next.js MetadataRoute.Sitemap
123
+ */
124
+ type SitemapEntry = {
125
+ url: string;
126
+ lastModified?: string | Date;
127
+ changeFrequency?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
128
+ priority?: number;
129
+ };
130
+ type Sitemap = Array<SitemapEntry>;
137
131
 
138
- export type { BackendPlugin as B, ClientPlugin as C, InferPluginOverrides as I, PluginRoutes as P, PluginHooks as a, ClientLibConfig as b, ClientLib as c, PluginOverrides as d, PrefixedPluginRoutes as e, BackendLibConfig as f, BackendLib as g };
132
+ export type { BackendPlugin as B, ClientPlugin as C, PluginOverrides as P, Sitemap as S, PluginRoutes as a, ClientLibConfig as b, ClientLib as c, PrefixedPluginRoutes as d, BackendLibConfig as e, BackendLib as f };
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+
3
+ type Post = {
4
+ id: string;
5
+ authorId?: string;
6
+ defaultLocale?: string;
7
+ slug: string;
8
+ title: string;
9
+ content: string;
10
+ excerpt: string;
11
+ image?: string;
12
+ published: boolean;
13
+ status?: "DRAFT" | "PUBLISHED";
14
+ tags: Tag[];
15
+ publishedAt?: Date;
16
+ createdAt: Date;
17
+ updatedAt: Date;
18
+ };
19
+ type Tag = {
20
+ id: string;
21
+ slug: string;
22
+ name: string;
23
+ createdAt: Date;
24
+ updatedAt: Date;
25
+ };
26
+ interface SerializedPost extends Omit<Post, "createdAt" | "updatedAt" | "publishedAt" | "tags"> {
27
+ tags: SerializedTag[];
28
+ publishedAt?: string;
29
+ createdAt: string;
30
+ updatedAt: string;
31
+ }
32
+ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
33
+ createdAt: string;
34
+ updatedAt: string;
35
+ }
36
+
37
+ declare const createPostSchema: z.ZodObject<{
38
+ title: z.ZodString;
39
+ slug: z.ZodOptional<z.ZodString>;
40
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
41
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
42
+ publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
43
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
44
+ content: z.ZodString;
45
+ excerpt: z.ZodString;
46
+ image: z.ZodOptional<z.ZodString>;
47
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
48
+ name: z.ZodString;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ id: z.ZodString;
51
+ name: z.ZodString;
52
+ slug: z.ZodString;
53
+ }, z.core.$strip>]>>>>;
54
+ }, z.core.$strip>;
55
+ declare const updatePostSchema: z.ZodObject<{
56
+ publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
57
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
58
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
59
+ title: z.ZodString;
60
+ content: z.ZodString;
61
+ excerpt: z.ZodString;
62
+ image: z.ZodOptional<z.ZodString>;
63
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
64
+ slug: z.ZodString;
65
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
66
+ name: z.ZodString;
67
+ }, z.core.$strip>, z.ZodObject<{
68
+ id: z.ZodString;
69
+ name: z.ZodString;
70
+ slug: z.ZodString;
71
+ }, z.core.$strip>]>>>>;
72
+ id: z.ZodString;
73
+ }, z.core.$strip>;
74
+
75
+ export { createPostSchema as c, updatePostSchema as u };
76
+ export type { Post as P, SerializedPost as S, Tag as T, SerializedTag as a };
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+
3
+ type Post = {
4
+ id: string;
5
+ authorId?: string;
6
+ defaultLocale?: string;
7
+ slug: string;
8
+ title: string;
9
+ content: string;
10
+ excerpt: string;
11
+ image?: string;
12
+ published: boolean;
13
+ status?: "DRAFT" | "PUBLISHED";
14
+ tags: Tag[];
15
+ publishedAt?: Date;
16
+ createdAt: Date;
17
+ updatedAt: Date;
18
+ };
19
+ type Tag = {
20
+ id: string;
21
+ slug: string;
22
+ name: string;
23
+ createdAt: Date;
24
+ updatedAt: Date;
25
+ };
26
+ interface SerializedPost extends Omit<Post, "createdAt" | "updatedAt" | "publishedAt" | "tags"> {
27
+ tags: SerializedTag[];
28
+ publishedAt?: string;
29
+ createdAt: string;
30
+ updatedAt: string;
31
+ }
32
+ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
33
+ createdAt: string;
34
+ updatedAt: string;
35
+ }
36
+
37
+ declare const createPostSchema: z.ZodObject<{
38
+ title: z.ZodString;
39
+ slug: z.ZodOptional<z.ZodString>;
40
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
41
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
42
+ publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
43
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
44
+ content: z.ZodString;
45
+ excerpt: z.ZodString;
46
+ image: z.ZodOptional<z.ZodString>;
47
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
48
+ name: z.ZodString;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ id: z.ZodString;
51
+ name: z.ZodString;
52
+ slug: z.ZodString;
53
+ }, z.core.$strip>]>>>>;
54
+ }, z.core.$strip>;
55
+ declare const updatePostSchema: z.ZodObject<{
56
+ publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
57
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
58
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
59
+ title: z.ZodString;
60
+ content: z.ZodString;
61
+ excerpt: z.ZodString;
62
+ image: z.ZodOptional<z.ZodString>;
63
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
64
+ slug: z.ZodString;
65
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
66
+ name: z.ZodString;
67
+ }, z.core.$strip>, z.ZodObject<{
68
+ id: z.ZodString;
69
+ name: z.ZodString;
70
+ slug: z.ZodString;
71
+ }, z.core.$strip>]>>>>;
72
+ id: z.ZodString;
73
+ }, z.core.$strip>;
74
+
75
+ export { createPostSchema as c, updatePostSchema as u };
76
+ export type { Post as P, SerializedPost as S, Tag as T, SerializedTag as a };
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+
3
+ type Post = {
4
+ id: string;
5
+ authorId?: string;
6
+ defaultLocale?: string;
7
+ slug: string;
8
+ title: string;
9
+ content: string;
10
+ excerpt: string;
11
+ image?: string;
12
+ published: boolean;
13
+ status?: "DRAFT" | "PUBLISHED";
14
+ tags: Tag[];
15
+ publishedAt?: Date;
16
+ createdAt: Date;
17
+ updatedAt: Date;
18
+ };
19
+ type Tag = {
20
+ id: string;
21
+ slug: string;
22
+ name: string;
23
+ createdAt: Date;
24
+ updatedAt: Date;
25
+ };
26
+ interface SerializedPost extends Omit<Post, "createdAt" | "updatedAt" | "publishedAt" | "tags"> {
27
+ tags: SerializedTag[];
28
+ publishedAt?: string;
29
+ createdAt: string;
30
+ updatedAt: string;
31
+ }
32
+ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
33
+ createdAt: string;
34
+ updatedAt: string;
35
+ }
36
+
37
+ declare const createPostSchema: z.ZodObject<{
38
+ title: z.ZodString;
39
+ slug: z.ZodOptional<z.ZodString>;
40
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
41
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
42
+ publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
43
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
44
+ content: z.ZodString;
45
+ excerpt: z.ZodString;
46
+ image: z.ZodOptional<z.ZodString>;
47
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
48
+ name: z.ZodString;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ id: z.ZodString;
51
+ name: z.ZodString;
52
+ slug: z.ZodString;
53
+ }, z.core.$strip>]>>>>;
54
+ }, z.core.$strip>;
55
+ declare const updatePostSchema: z.ZodObject<{
56
+ publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
57
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
58
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
59
+ title: z.ZodString;
60
+ content: z.ZodString;
61
+ excerpt: z.ZodString;
62
+ image: z.ZodOptional<z.ZodString>;
63
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
64
+ slug: z.ZodString;
65
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
66
+ name: z.ZodString;
67
+ }, z.core.$strip>, z.ZodObject<{
68
+ id: z.ZodString;
69
+ name: z.ZodString;
70
+ slug: z.ZodString;
71
+ }, z.core.$strip>]>>>>;
72
+ id: z.ZodString;
73
+ }, z.core.$strip>;
74
+
75
+ export { createPostSchema as c, updatePostSchema as u };
76
+ export type { Post as P, SerializedPost as S, Tag as T, SerializedTag as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btst/stack",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A composable, plugin-based library for building full-stack applications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,13 +21,17 @@
21
21
  "access": "public"
22
22
  },
23
23
  "scripts": {
24
- "build": "unbuild --clean",
24
+ "build": "unbuild --clean && node ./scripts/postbuild.cjs",
25
+ "build:analyze": "ANALYZE=1 unbuild --clean && node ./scripts/postbuild.cjs",
25
26
  "stub": "unbuild --stub",
26
27
  "test": "vitest",
27
28
  "typecheck": "tsc --project tsconfig.json"
28
29
  },
29
30
  "main": "./dist/index.cjs",
30
31
  "module": "./dist/index.mjs",
32
+ "sideEffects": [
33
+ "./dist/style.css"
34
+ ],
31
35
  "exports": {
32
36
  ".": {
33
37
  "import": {
@@ -59,6 +63,16 @@
59
63
  "default": "./dist/client/index.cjs"
60
64
  }
61
65
  },
66
+ "./client/components": {
67
+ "import": {
68
+ "types": "./dist/client/components/index.d.ts",
69
+ "default": "./dist/client/components/index.mjs"
70
+ },
71
+ "require": {
72
+ "types": "./dist/client/components/index.d.cts",
73
+ "default": "./dist/client/components/index.cjs"
74
+ }
75
+ },
62
76
  "./context": {
63
77
  "import": {
64
78
  "types": "./dist/context/index.d.ts",
@@ -69,16 +83,49 @@
69
83
  "default": "./dist/context/index.cjs"
70
84
  }
71
85
  },
72
- "./plugins": {
86
+ "./plugins/api": {
87
+ "import": {
88
+ "types": "./dist/plugins/api/index.d.ts",
89
+ "default": "./dist/plugins/api/index.mjs"
90
+ },
91
+ "require": {
92
+ "types": "./dist/plugins/api/index.d.cts",
93
+ "default": "./dist/plugins/api/index.cjs"
94
+ }
95
+ },
96
+ "./plugins/client": {
97
+ "import": {
98
+ "types": "./dist/plugins/client/index.d.ts",
99
+ "default": "./dist/plugins/client/index.mjs"
100
+ },
101
+ "require": {
102
+ "types": "./dist/plugins/client/index.d.cts",
103
+ "default": "./dist/plugins/client/index.cjs"
104
+ }
105
+ },
106
+ "./plugins/blog/api": {
73
107
  "import": {
74
- "types": "./dist/plugins/index.d.ts",
75
- "default": "./dist/plugins/index.mjs"
108
+ "types": "./dist/plugins/blog/api/index.d.ts",
109
+ "default": "./dist/plugins/blog/api/index.mjs"
76
110
  },
77
111
  "require": {
78
- "types": "./dist/plugins/index.d.cts",
79
- "default": "./dist/plugins/index.cjs"
112
+ "types": "./dist/plugins/blog/api/index.d.cts",
113
+ "default": "./dist/plugins/blog/api/index.cjs"
80
114
  }
81
115
  },
116
+ "./plugins/blog/client": {
117
+ "import": {
118
+ "types": "./dist/plugins/blog/client/index.d.ts",
119
+ "default": "./dist/plugins/blog/client/index.mjs"
120
+ },
121
+ "require": {
122
+ "types": "./dist/plugins/blog/client/index.d.cts",
123
+ "default": "./dist/plugins/blog/client/index.cjs"
124
+ }
125
+ },
126
+ "./plugins/blog/css": "./dist/plugins/blog/style.css",
127
+ "./dist/*": "./dist/*",
128
+ "./ui/css": "./dist/ui/components.css",
82
129
  "./package.json": "./package.json"
83
130
  },
84
131
  "typesVersions": {
@@ -95,35 +142,76 @@
95
142
  "context": [
96
143
  "./dist/context/index.d.ts"
97
144
  ],
98
- "plugins": [
99
- "./dist/plugins/index.d.ts"
145
+ "plugins/api": [
146
+ "./dist/plugins/api/index.d.ts"
147
+ ],
148
+ "plugins/client": [
149
+ "./dist/plugins/client/index.d.ts"
150
+ ],
151
+ "plugins/blog/api": [
152
+ "./dist/plugins/blog/api/index.d.ts"
153
+ ],
154
+ "plugins/blog/client": [
155
+ "./dist/plugins/blog/client/index.d.ts"
100
156
  ]
101
157
  }
102
158
  },
103
159
  "dependencies": {
104
160
  "@btst/db": "1.0.2",
105
- "@btst/yar": "1.1.0",
161
+ "@btst/yar": "1.1.1",
162
+ "@lukemorales/query-key-factory": "^1.3.4",
163
+ "@milkdown/crepe": "^7.17.1",
164
+ "@milkdown/kit": "^7.17.1",
165
+ "@workspace/ui": "workspace:*",
106
166
  "better-call": "1.0.19",
107
- "zod": "^4.1.5"
167
+ "slug": "^11.0.1"
108
168
  },
109
169
  "peerDependencies": {
170
+ "@hookform/resolvers": ">=5.0.0",
171
+ "@radix-ui/react-dialog": ">=1.1.0",
172
+ "@radix-ui/react-label": ">=2.1.0",
173
+ "@radix-ui/react-slot": ">=1.1.0",
174
+ "@radix-ui/react-switch": ">=1.1.0",
175
+ "@tanstack/react-query": "^5.0.0",
176
+ "class-variance-authority": ">=0.7.0",
177
+ "clsx": ">=2.1.0",
178
+ "cmdk": ">=1.1.0",
179
+ "date-fns": ">=4.1.0",
180
+ "highlight.js": ">=11.9.0",
181
+ "katex": ">=0.16.0",
182
+ "lucide-react": ">=0.469.0",
110
183
  "react": "^18.0.0 || ^19.0.0",
111
184
  "react-dom": "^18.0.0 || ^19.0.0",
112
- "@tanstack/react-query": "^5.0.0"
185
+ "react-error-boundary": ">=4.0.0",
186
+ "react-hook-form": ">=7.55.0",
187
+ "react-intersection-observer": ">=9.0.0",
188
+ "react-markdown": ">=10.1.0",
189
+ "rehype-highlight": ">=7.0.0",
190
+ "rehype-katex": ">=7.0.0",
191
+ "rehype-raw": ">=7.0.0",
192
+ "remark-gfm": ">=4.0.0",
193
+ "remark-math": ">=6.0.0",
194
+ "sonner": ">=2.0.0",
195
+ "tailwind-merge": ">=2.6.0",
196
+ "tailwindcss": ">=3.0.0",
197
+ "zod": ">=3.24.0"
113
198
  },
114
199
  "devDependencies": {
115
200
  "@btst/adapter-memory": "1.0.2",
116
- "@tanstack/react-query": "^5.0.0",
117
- "@types/react": "^18.3.23",
201
+ "@types/react": "^19.0.0",
202
+ "@types/slug": "^5.0.9",
118
203
  "react": "^19.1.1",
119
204
  "react-dom": "^19.1.1",
205
+ "react-error-boundary": "^4.1.2",
206
+ "rollup-plugin-preserve-directives": "0.4.0",
207
+ "rollup-plugin-visualizer": "^5.12.0",
120
208
  "typescript": "catalog:",
121
209
  "unbuild": "catalog:",
122
210
  "vitest": "catalog:",
123
211
  "vue": "^3.5.18"
124
212
  },
125
- "sideEffects": false,
126
213
  "files": [
127
- "dist"
214
+ "dist",
215
+ "src"
128
216
  ]
129
217
  }