@conloca/astro-cms 0.1.15 → 0.2.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 (367) hide show
  1. package/README.md +259 -247
  2. package/dist/internal/acorn-default.mjs +11 -3
  3. package/dist/internal/page-handler.astro +137 -358
  4. package/dist/ts/node/content.d.ts +4 -0
  5. package/dist/ts/node/content.d.ts.map +1 -0
  6. package/dist/ts/node/content.js +3 -0
  7. package/dist/ts/node/content.js.map +1 -0
  8. package/dist/ts/node/index.d.ts +9 -0
  9. package/dist/ts/node/index.d.ts.map +1 -0
  10. package/dist/ts/node/index.js +14 -0
  11. package/dist/ts/node/index.js.map +1 -0
  12. package/dist/ts/src/asset-ref-base.d.ts +3 -0
  13. package/dist/ts/src/asset-ref-base.d.ts.map +1 -0
  14. package/dist/ts/src/asset-ref-base.js +48 -0
  15. package/dist/ts/src/asset-ref-base.js.map +1 -0
  16. package/dist/ts/src/checks.d.ts +7 -0
  17. package/dist/ts/src/checks.d.ts.map +1 -0
  18. package/dist/ts/src/checks.js +7 -0
  19. package/dist/ts/src/checks.js.map +1 -0
  20. package/dist/ts/src/cms-handler.d.ts +18 -0
  21. package/dist/ts/src/cms-handler.d.ts.map +1 -0
  22. package/dist/ts/src/cms-handler.js +245 -0
  23. package/dist/ts/src/cms-handler.js.map +1 -0
  24. package/dist/ts/src/collections.d.ts +160 -0
  25. package/dist/ts/src/collections.d.ts.map +1 -0
  26. package/dist/ts/src/collections.js +170 -0
  27. package/dist/ts/src/collections.js.map +1 -0
  28. package/dist/ts/src/components/HydrationWrapper.d.ts +18 -0
  29. package/dist/ts/src/components/HydrationWrapper.d.ts.map +1 -0
  30. package/dist/ts/src/components/HydrationWrapper.js +22 -0
  31. package/dist/ts/src/components/HydrationWrapper.js.map +1 -0
  32. package/dist/ts/src/components/RenderWithFragments.d.ts +27 -0
  33. package/dist/ts/src/components/RenderWithFragments.d.ts.map +1 -0
  34. package/dist/ts/src/components/RenderWithFragments.js +133 -0
  35. package/dist/ts/src/components/RenderWithFragments.js.map +1 -0
  36. package/dist/ts/src/components/RenderWithHydration.d.ts +21 -0
  37. package/dist/ts/src/components/RenderWithHydration.d.ts.map +1 -0
  38. package/dist/ts/src/components/RenderWithHydration.js +39 -0
  39. package/dist/ts/src/components/RenderWithHydration.js.map +1 -0
  40. package/dist/ts/src/components.d.ts +4 -0
  41. package/dist/ts/src/components.d.ts.map +1 -0
  42. package/dist/ts/src/components.js +4 -0
  43. package/dist/ts/src/components.js.map +1 -0
  44. package/dist/ts/src/discovery/astro-frontmatter.d.ts +18 -0
  45. package/dist/ts/src/discovery/astro-frontmatter.d.ts.map +1 -0
  46. package/dist/ts/src/discovery/astro-frontmatter.js +25 -0
  47. package/dist/ts/src/discovery/astro-frontmatter.js.map +1 -0
  48. package/dist/ts/src/discovery/discover.d.ts +43 -0
  49. package/dist/ts/src/discovery/discover.d.ts.map +1 -0
  50. package/dist/ts/src/discovery/discover.js +87 -0
  51. package/dist/ts/src/discovery/discover.js.map +1 -0
  52. package/dist/ts/src/discovery/extract-props-ts.d.ts +41 -0
  53. package/dist/ts/src/discovery/extract-props-ts.d.ts.map +1 -0
  54. package/dist/ts/src/discovery/extract-props-ts.js +232 -0
  55. package/dist/ts/src/discovery/extract-props-ts.js.map +1 -0
  56. package/dist/ts/src/discovery/merge-registry.d.ts +58 -0
  57. package/dist/ts/src/discovery/merge-registry.d.ts.map +1 -0
  58. package/dist/ts/src/discovery/merge-registry.js +333 -0
  59. package/dist/ts/src/discovery/merge-registry.js.map +1 -0
  60. package/dist/ts/src/discovery/registry-endpoint.d.ts +27 -0
  61. package/dist/ts/src/discovery/registry-endpoint.d.ts.map +1 -0
  62. package/dist/ts/src/discovery/registry-endpoint.js +76 -0
  63. package/dist/ts/src/discovery/registry-endpoint.js.map +1 -0
  64. package/dist/ts/src/discovery/scan-components.d.ts +94 -0
  65. package/dist/ts/src/discovery/scan-components.d.ts.map +1 -0
  66. package/dist/ts/src/discovery/scan-components.js +397 -0
  67. package/dist/ts/src/discovery/scan-components.js.map +1 -0
  68. package/dist/ts/src/discovery/scan-mdx.d.ts +63 -0
  69. package/dist/ts/src/discovery/scan-mdx.d.ts.map +1 -0
  70. package/dist/ts/src/discovery/scan-mdx.js +113 -0
  71. package/dist/ts/src/discovery/scan-mdx.js.map +1 -0
  72. package/dist/ts/src/discovery/scan-overrides.d.ts +71 -0
  73. package/dist/ts/src/discovery/scan-overrides.d.ts.map +1 -0
  74. package/dist/ts/src/discovery/scan-overrides.js +34 -0
  75. package/dist/ts/src/discovery/scan-overrides.js.map +1 -0
  76. package/dist/ts/src/editor-descriptors.d.ts +31 -0
  77. package/dist/ts/src/editor-descriptors.d.ts.map +1 -0
  78. package/dist/ts/src/editor-descriptors.js +84 -0
  79. package/dist/ts/src/editor-descriptors.js.map +1 -0
  80. package/dist/ts/src/handlers/collection-content-api.d.ts +32 -0
  81. package/dist/ts/src/handlers/collection-content-api.d.ts.map +1 -0
  82. package/dist/ts/src/handlers/collection-content-api.js +166 -0
  83. package/dist/ts/src/handlers/collection-content-api.js.map +1 -0
  84. package/dist/ts/src/handlers/page-render-core.d.ts +137 -0
  85. package/dist/ts/src/handlers/page-render-core.d.ts.map +1 -0
  86. package/dist/ts/src/handlers/page-render-core.js +315 -0
  87. package/dist/ts/src/handlers/page-render-core.js.map +1 -0
  88. package/dist/ts/src/hydration.d.ts +4 -0
  89. package/dist/ts/src/hydration.d.ts.map +1 -0
  90. package/dist/ts/src/hydration.js +5 -0
  91. package/dist/ts/src/hydration.js.map +1 -0
  92. package/dist/ts/src/index.d.ts +21 -0
  93. package/dist/ts/src/index.d.ts.map +1 -0
  94. package/dist/ts/src/index.js +45 -0
  95. package/dist/ts/src/index.js.map +1 -0
  96. package/dist/ts/src/internal/declared-collections.d.ts +30 -0
  97. package/dist/ts/src/internal/declared-collections.d.ts.map +1 -0
  98. package/dist/ts/src/internal/declared-collections.js +84 -0
  99. package/dist/ts/src/internal/declared-collections.js.map +1 -0
  100. package/dist/ts/src/internal/page-collection-schema.d.ts +44 -0
  101. package/dist/ts/src/internal/page-collection-schema.d.ts.map +1 -0
  102. package/dist/ts/src/internal/page-collection-schema.js +152 -0
  103. package/dist/ts/src/internal/page-collection-schema.js.map +1 -0
  104. package/dist/ts/src/lib/content-config-guard.d.ts +11 -0
  105. package/dist/ts/src/lib/content-config-guard.d.ts.map +1 -0
  106. package/dist/ts/src/lib/content-config-guard.js +41 -0
  107. package/dist/ts/src/lib/content-config-guard.js.map +1 -0
  108. package/dist/ts/src/lib/hydration-scanner.d.ts +47 -0
  109. package/dist/ts/src/lib/hydration-scanner.d.ts.map +1 -0
  110. package/dist/ts/src/lib/hydration-scanner.js +136 -0
  111. package/dist/ts/src/lib/hydration-scanner.js.map +1 -0
  112. package/dist/{lib/hydration-script.d.mts → ts/src/lib/hydration-script.d.ts} +7 -10
  113. package/dist/ts/src/lib/hydration-script.d.ts.map +1 -0
  114. package/dist/ts/src/lib/hydration-script.js +89 -0
  115. package/dist/ts/src/lib/hydration-script.js.map +1 -0
  116. package/dist/ts/src/lib/hydration-utils.d.ts +51 -0
  117. package/dist/ts/src/lib/hydration-utils.d.ts.map +1 -0
  118. package/dist/ts/src/lib/hydration-utils.js +84 -0
  119. package/dist/ts/src/lib/hydration-utils.js.map +1 -0
  120. package/dist/ts/src/lib/resolve-locale.d.ts +15 -0
  121. package/dist/ts/src/lib/resolve-locale.d.ts.map +1 -0
  122. package/dist/ts/src/lib/resolve-locale.js +16 -0
  123. package/dist/ts/src/lib/resolve-locale.js.map +1 -0
  124. package/dist/ts/src/lib/resolve-site-name.d.ts +8 -0
  125. package/dist/ts/src/lib/resolve-site-name.d.ts.map +1 -0
  126. package/dist/ts/src/lib/resolve-site-name.js +12 -0
  127. package/dist/ts/src/lib/resolve-site-name.js.map +1 -0
  128. package/dist/ts/src/lib/route-utils.d.ts +61 -0
  129. package/dist/ts/src/lib/route-utils.d.ts.map +1 -0
  130. package/dist/ts/src/lib/route-utils.js +96 -0
  131. package/dist/ts/src/lib/route-utils.js.map +1 -0
  132. package/dist/ts/src/lib/routing-config.d.ts +38 -0
  133. package/dist/ts/src/lib/routing-config.d.ts.map +1 -0
  134. package/dist/ts/src/lib/routing-config.js +106 -0
  135. package/dist/ts/src/lib/routing-config.js.map +1 -0
  136. package/dist/ts/src/lib/serialize-props.d.ts +6 -0
  137. package/dist/ts/src/lib/serialize-props.d.ts.map +1 -0
  138. package/dist/ts/src/lib/serialize-props.js +8 -0
  139. package/dist/ts/src/lib/serialize-props.js.map +1 -0
  140. package/dist/ts/src/lib/unknown-components.d.ts +21 -0
  141. package/dist/ts/src/lib/unknown-components.d.ts.map +1 -0
  142. package/dist/ts/src/lib/unknown-components.js +49 -0
  143. package/dist/ts/src/lib/unknown-components.js.map +1 -0
  144. package/dist/ts/src/lib/virtual-module-generators.d.ts +33 -0
  145. package/dist/ts/src/lib/virtual-module-generators.d.ts.map +1 -0
  146. package/dist/ts/src/lib/virtual-module-generators.js +51 -0
  147. package/dist/ts/src/lib/virtual-module-generators.js.map +1 -0
  148. package/dist/{withHydration-HIvO9ysY.d.mts → ts/src/lib/withHydration.d.ts} +7 -11
  149. package/dist/ts/src/lib/withHydration.d.ts.map +1 -0
  150. package/dist/ts/src/lib/withHydration.js +50 -0
  151. package/dist/ts/src/lib/withHydration.js.map +1 -0
  152. package/dist/ts/src/loader.d.ts +27 -0
  153. package/dist/ts/src/loader.d.ts.map +1 -0
  154. package/dist/ts/src/loader.js +118 -0
  155. package/dist/ts/src/loader.js.map +1 -0
  156. package/dist/ts/src/locales-helpers.d.ts +61 -0
  157. package/dist/ts/src/locales-helpers.d.ts.map +1 -0
  158. package/dist/ts/src/locales-helpers.js +50 -0
  159. package/dist/ts/src/locales-helpers.js.map +1 -0
  160. package/dist/ts/src/mime-types.d.ts +3 -0
  161. package/dist/ts/src/mime-types.d.ts.map +1 -0
  162. package/dist/ts/src/mime-types.js +20 -0
  163. package/dist/ts/src/mime-types.js.map +1 -0
  164. package/dist/ts/src/page-feed.d.ts +13 -0
  165. package/dist/ts/src/page-feed.d.ts.map +1 -0
  166. package/dist/ts/src/page-feed.js +20 -0
  167. package/dist/ts/src/page-feed.js.map +1 -0
  168. package/dist/ts/src/page-schemas.d.ts +6 -0
  169. package/dist/ts/src/page-schemas.d.ts.map +1 -0
  170. package/dist/ts/src/page-schemas.js +6 -0
  171. package/dist/ts/src/page-schemas.js.map +1 -0
  172. package/dist/ts/src/path-validation.d.ts +8 -0
  173. package/dist/ts/src/path-validation.d.ts.map +1 -0
  174. package/dist/ts/src/path-validation.js +13 -0
  175. package/dist/ts/src/path-validation.js.map +1 -0
  176. package/dist/ts/src/plugin-spa.d.ts +182 -0
  177. package/dist/ts/src/plugin-spa.d.ts.map +1 -0
  178. package/dist/ts/src/plugin-spa.js +1165 -0
  179. package/dist/ts/src/plugin-spa.js.map +1 -0
  180. package/dist/ts/src/puck-manifest/components-endpoint.d.ts +30 -0
  181. package/dist/ts/src/puck-manifest/components-endpoint.d.ts.map +1 -0
  182. package/dist/ts/src/puck-manifest/components-endpoint.js +54 -0
  183. package/dist/ts/src/puck-manifest/components-endpoint.js.map +1 -0
  184. package/dist/ts/src/puck-manifest/field-projection.d.ts +91 -0
  185. package/dist/ts/src/puck-manifest/field-projection.d.ts.map +1 -0
  186. package/dist/ts/src/puck-manifest/field-projection.js +422 -0
  187. package/dist/ts/src/puck-manifest/field-projection.js.map +1 -0
  188. package/dist/ts/src/puck-manifest/index.d.ts +4 -0
  189. package/dist/ts/src/puck-manifest/index.d.ts.map +1 -0
  190. package/dist/ts/src/puck-manifest/index.js +3 -0
  191. package/dist/ts/src/puck-manifest/index.js.map +1 -0
  192. package/dist/ts/src/puck-manifest/literal.d.ts +163 -0
  193. package/dist/ts/src/puck-manifest/literal.d.ts.map +1 -0
  194. package/dist/ts/src/puck-manifest/literal.js +354 -0
  195. package/dist/ts/src/puck-manifest/literal.js.map +1 -0
  196. package/dist/ts/src/puck-manifest/read-config.d.ts +42 -0
  197. package/dist/ts/src/puck-manifest/read-config.d.ts.map +1 -0
  198. package/dist/ts/src/puck-manifest/read-config.js +517 -0
  199. package/dist/ts/src/puck-manifest/read-config.js.map +1 -0
  200. package/dist/ts/src/puck-manifest/read-field.d.ts +7 -0
  201. package/dist/ts/src/puck-manifest/read-field.d.ts.map +1 -0
  202. package/dist/ts/src/puck-manifest/read-field.js +11 -0
  203. package/dist/ts/src/puck-manifest/read-field.js.map +1 -0
  204. package/dist/ts/src/puck-manifest/read-wrapper.d.ts +147 -0
  205. package/dist/ts/src/puck-manifest/read-wrapper.d.ts.map +1 -0
  206. package/dist/ts/src/puck-manifest/read-wrapper.js +889 -0
  207. package/dist/ts/src/puck-manifest/read-wrapper.js.map +1 -0
  208. package/dist/ts/src/puck-manifest/reading-budget.d.ts +50 -0
  209. package/dist/ts/src/puck-manifest/reading-budget.d.ts.map +1 -0
  210. package/dist/ts/src/puck-manifest/reading-budget.js +113 -0
  211. package/dist/ts/src/puck-manifest/reading-budget.js.map +1 -0
  212. package/dist/ts/src/puck-manifest/resolve-reference.d.ts +4 -0
  213. package/dist/ts/src/puck-manifest/resolve-reference.d.ts.map +1 -0
  214. package/dist/ts/src/puck-manifest/resolve-reference.js +4 -0
  215. package/dist/ts/src/puck-manifest/resolve-reference.js.map +1 -0
  216. package/dist/ts/src/puck-manifest/source-reference.d.ts +96 -0
  217. package/dist/ts/src/puck-manifest/source-reference.d.ts.map +1 -0
  218. package/dist/ts/src/puck-manifest/source-reference.js +424 -0
  219. package/dist/ts/src/puck-manifest/source-reference.js.map +1 -0
  220. package/dist/ts/src/puck-manifest/syntax.d.ts +29 -0
  221. package/dist/ts/src/puck-manifest/syntax.d.ts.map +1 -0
  222. package/dist/ts/src/puck-manifest/syntax.js +79 -0
  223. package/dist/ts/src/puck-manifest/syntax.js.map +1 -0
  224. package/dist/ts/src/puck-manifest/types.d.ts +145 -0
  225. package/dist/ts/src/puck-manifest/types.d.ts.map +1 -0
  226. package/dist/ts/src/puck-manifest/types.js +2 -0
  227. package/dist/ts/src/puck-manifest/types.js.map +1 -0
  228. package/dist/ts/src/safe-json-stringify.d.ts +13 -0
  229. package/dist/ts/src/safe-json-stringify.d.ts.map +1 -0
  230. package/dist/ts/src/safe-json-stringify.js +7 -0
  231. package/dist/ts/src/safe-json-stringify.js.map +1 -0
  232. package/dist/ts/src/sandbox-frame-handler.d.ts +19 -0
  233. package/dist/ts/src/sandbox-frame-handler.d.ts.map +1 -0
  234. package/dist/ts/src/sandbox-frame-handler.js +27 -0
  235. package/dist/ts/src/sandbox-frame-handler.js.map +1 -0
  236. package/dist/ts/src/site-styles/content-wrapper-endpoint.d.ts +73 -0
  237. package/dist/ts/src/site-styles/content-wrapper-endpoint.d.ts.map +1 -0
  238. package/dist/ts/src/site-styles/content-wrapper-endpoint.js +224 -0
  239. package/dist/ts/src/site-styles/content-wrapper-endpoint.js.map +1 -0
  240. package/dist/ts/src/site-styles/render-endpoint.d.ts +50 -0
  241. package/dist/ts/src/site-styles/render-endpoint.d.ts.map +1 -0
  242. package/dist/ts/src/site-styles/render-endpoint.js +264 -0
  243. package/dist/ts/src/site-styles/render-endpoint.js.map +1 -0
  244. package/dist/ts/src/site-styles/styles-endpoint.d.ts +59 -0
  245. package/dist/ts/src/site-styles/styles-endpoint.d.ts.map +1 -0
  246. package/dist/ts/src/site-styles/styles-endpoint.js +156 -0
  247. package/dist/ts/src/site-styles/styles-endpoint.js.map +1 -0
  248. package/dist/ts/src/sitemap-options.d.ts +21 -0
  249. package/dist/ts/src/sitemap-options.d.ts.map +1 -0
  250. package/dist/ts/src/sitemap-options.js +92 -0
  251. package/dist/ts/src/sitemap-options.js.map +1 -0
  252. package/dist/ts/src/tiptap-html-static.d.ts +15 -0
  253. package/dist/ts/src/tiptap-html-static.d.ts.map +1 -0
  254. package/dist/ts/src/tiptap-html-static.js +67 -0
  255. package/dist/ts/src/tiptap-html-static.js.map +1 -0
  256. package/dist/ts/src/types.d.ts +543 -0
  257. package/dist/ts/src/types.d.ts.map +1 -0
  258. package/dist/ts/src/types.js +2 -0
  259. package/dist/ts/src/types.js.map +1 -0
  260. package/dist/virtual-modules.d.ts +74 -0
  261. package/node/content.ts +14 -0
  262. package/node/index.ts +22 -0
  263. package/package.json +198 -56
  264. package/src/asset-ref-base.ts +48 -0
  265. package/src/checks.ts +10 -0
  266. package/src/cms-handler.ts +280 -0
  267. package/src/collections.ts +262 -0
  268. package/src/components/HydrationWrapper.tsx +41 -0
  269. package/src/components/RenderWithFragments.tsx +204 -0
  270. package/src/components/RenderWithHydration.tsx +55 -0
  271. package/src/components.ts +3 -0
  272. package/src/discovery/astro-frontmatter.ts +24 -0
  273. package/src/discovery/discover.ts +108 -0
  274. package/src/discovery/extract-props-ts.ts +255 -0
  275. package/src/discovery/merge-registry.ts +411 -0
  276. package/src/discovery/registry-endpoint.ts +80 -0
  277. package/src/discovery/scan-components.ts +458 -0
  278. package/src/discovery/scan-mdx.ts +190 -0
  279. package/src/discovery/scan-overrides.ts +92 -0
  280. package/src/editor-descriptors.ts +96 -0
  281. package/src/env.d.ts +31 -0
  282. package/src/handlers/collection-content-api.ts +196 -0
  283. package/src/handlers/page-handler.astro +320 -0
  284. package/src/handlers/page-render-core.ts +456 -0
  285. package/src/hydration.ts +7 -0
  286. package/src/index.ts +111 -0
  287. package/src/internal/acorn-default.mjs +37 -0
  288. package/src/internal/declared-collections.ts +98 -0
  289. package/src/internal/page-collection-schema.ts +210 -0
  290. package/src/lib/content-config-guard.ts +48 -0
  291. package/src/lib/hydration-scanner.ts +176 -0
  292. package/src/lib/hydration-script.ts +126 -0
  293. package/src/lib/hydration-utils.ts +120 -0
  294. package/src/lib/resolve-locale.ts +22 -0
  295. package/src/lib/resolve-site-name.ts +10 -0
  296. package/src/lib/route-utils.ts +106 -0
  297. package/src/lib/routing-config.ts +126 -0
  298. package/src/lib/serialize-props.ts +7 -0
  299. package/src/lib/unknown-components.ts +64 -0
  300. package/src/lib/virtual-module-generators.ts +58 -0
  301. package/src/lib/withHydration.ts +71 -0
  302. package/src/loader.ts +145 -0
  303. package/src/locales-helpers.ts +68 -0
  304. package/src/mime-types.ts +19 -0
  305. package/src/page-feed.ts +26 -0
  306. package/src/page-schemas.ts +19 -0
  307. package/src/path-validation.ts +13 -0
  308. package/src/plugin-spa.ts +1480 -0
  309. package/src/puck-manifest/components-endpoint.ts +55 -0
  310. package/src/puck-manifest/field-projection.ts +510 -0
  311. package/src/puck-manifest/index.ts +3 -0
  312. package/src/puck-manifest/literal.ts +459 -0
  313. package/src/puck-manifest/read-config.ts +577 -0
  314. package/src/puck-manifest/read-field.ts +19 -0
  315. package/src/puck-manifest/read-wrapper.ts +1056 -0
  316. package/src/puck-manifest/reading-budget.ts +127 -0
  317. package/src/puck-manifest/resolve-reference.ts +9 -0
  318. package/src/puck-manifest/source-reference.ts +484 -0
  319. package/src/puck-manifest/syntax.ts +104 -0
  320. package/src/puck-manifest/types.ts +139 -0
  321. package/src/safe-json-stringify.ts +17 -0
  322. package/src/sandbox-frame-handler.ts +31 -0
  323. package/src/site-styles/content-wrapper-endpoint.ts +327 -0
  324. package/src/site-styles/render-endpoint.ts +331 -0
  325. package/src/site-styles/styles-endpoint.ts +184 -0
  326. package/src/sitemap-options.ts +115 -0
  327. package/src/tiptap-html-static.ts +84 -0
  328. package/{dist/types-CVQNmPxF.d.mts → src/types.ts} +232 -79
  329. package/src/virtual-modules.d.ts +74 -0
  330. package/dist/collections.d.mts +0 -36
  331. package/dist/collections.d.mts.map +0 -1
  332. package/dist/collections.mjs +0 -65
  333. package/dist/collections.mjs.map +0 -1
  334. package/dist/components.d.mts +0 -46
  335. package/dist/components.d.mts.map +0 -1
  336. package/dist/components.mjs +0 -226
  337. package/dist/components.mjs.map +0 -1
  338. package/dist/hydration-scanner-B0NjYkZ_.mjs +0 -109
  339. package/dist/hydration-scanner-B0NjYkZ_.mjs.map +0 -1
  340. package/dist/hydration.d.mts +0 -4
  341. package/dist/hydration.mjs +0 -3
  342. package/dist/index.d.mts +0 -139
  343. package/dist/index.d.mts.map +0 -1
  344. package/dist/index.mjs +0 -66
  345. package/dist/index.mjs.map +0 -1
  346. package/dist/internal/cms-handler.d.mts +0 -26
  347. package/dist/internal/cms-handler.d.mts.map +0 -1
  348. package/dist/internal/cms-handler.mjs +0 -267
  349. package/dist/internal/cms-handler.mjs.map +0 -1
  350. package/dist/lib/hydration-script.d.mts.map +0 -1
  351. package/dist/lib/hydration-script.mjs +0 -85
  352. package/dist/lib/hydration-script.mjs.map +0 -1
  353. package/dist/loader-By-AQWHc.mjs +0 -68
  354. package/dist/loader-By-AQWHc.mjs.map +0 -1
  355. package/dist/node/content.d.mts +0 -19
  356. package/dist/node/content.d.mts.map +0 -1
  357. package/dist/node/content.mjs +0 -4
  358. package/dist/node/index.d.mts +0 -52
  359. package/dist/node/index.d.mts.map +0 -1
  360. package/dist/node/index.mjs +0 -753
  361. package/dist/node/index.mjs.map +0 -1
  362. package/dist/serialize-props-Dhv_MnkY.mjs +0 -73
  363. package/dist/serialize-props-Dhv_MnkY.mjs.map +0 -1
  364. package/dist/types-CVQNmPxF.d.mts.map +0 -1
  365. package/dist/withHydration-EzyzBQ-Y.mjs +0 -49
  366. package/dist/withHydration-EzyzBQ-Y.mjs.map +0 -1
  367. package/dist/withHydration-HIvO9ysY.d.mts.map +0 -1
@@ -0,0 +1,315 @@
1
+ /**
2
+ * Astro-free render core for the page handler.
3
+ *
4
+ * The pure frontmatter logic of `page-handler.astro` (entry shaping/filtering,
5
+ * data context assembly, puck-data resolution, MDX fragment loading) lives here,
6
+ * parameterized over a narrow {@link PageContentSource} so the same logic runs
7
+ * against two backends: Astro content collections, and a ContentAPI reader a
8
+ * caller installs on `Astro.locals.contentApi`. No `astro:content` import and
9
+ * no `import.meta.env` — the `.astro` file injects `getCollection` (via
10
+ * {@link createCollectionContentSource}) and the dev flag, so this module is
11
+ * importable outside an Astro page.
12
+ */
13
+ import { mergeDefaultProps } from '@conloca/cms-spa/merge-default-props';
14
+ import { isContentPublished, pageTimestampsOf, selectPagesByPrefix, } from '@conloca/content-api';
15
+ import { resolveAllData } from '@puckeditor/core';
16
+ import React from 'react';
17
+ // Re-exported so the copied `dist/internal/page-handler.astro` reaches
18
+ // everything it renders with through this one module.
19
+ export { findUnknownComponentTypes } from '../lib/unknown-components.js';
20
+ /**
21
+ * Synthetic collection every discovered fragment lands in (the loader flattens
22
+ * all fragment collections into one). Owned here — rather than imported from
23
+ * `collections.ts` — so this core stays free of the `astro:content` that module
24
+ * pulls in; `collections.ts` re-exports it to keep the public name stable.
25
+ */
26
+ export const ALL_FRAGMENTS_COLLECTION = '__conloca_fragments';
27
+ /**
28
+ * Collection-backed {@link PageContentSource}. The production render path
29
+ * injects Astro's `getCollection`; the dev flag preserves the handler's
30
+ * cache-bypass-in-DEV behaviour and the per-render dedup cache. Kept identical
31
+ * to the handler's former inline `loadCollectionEntries`/`getCollectionEntries`
32
+ * so the built page HTML is byte-for-byte unchanged.
33
+ */
34
+ export function createCollectionContentSource(deps) {
35
+ const collectionCache = new Map();
36
+ async function getCollectionEntries(collectionName) {
37
+ return deps.getCollection(collectionName).catch((error) => {
38
+ if (error instanceof Error &&
39
+ error.message.includes(`The collection "${collectionName}" does not exist or is empty`)) {
40
+ return [];
41
+ }
42
+ throw error;
43
+ });
44
+ }
45
+ async function loadCollectionEntries(collectionName) {
46
+ if (deps.isDev) {
47
+ return getCollectionEntries(collectionName);
48
+ }
49
+ let entriesPromise = collectionCache.get(collectionName);
50
+ if (!entriesPromise) {
51
+ entriesPromise = getCollectionEntries(collectionName);
52
+ collectionCache.set(collectionName, entriesPromise);
53
+ }
54
+ return entriesPromise;
55
+ }
56
+ return {
57
+ async listEntries(collection) {
58
+ const entries = await loadCollectionEntries(collection);
59
+ return entries.map((entry) => entry.data);
60
+ },
61
+ };
62
+ }
63
+ /**
64
+ * Canonical pathname form: no trailing slash, except the root itself. Site
65
+ * nav links carry trailing slashes ('/faq/') while entry pathnames are
66
+ * canonical ('/faq'); every exact-equality match must go through this.
67
+ */
68
+ export function normalizePathname(pathname) {
69
+ const stripped = pathname.replace(/\/+$/u, '');
70
+ return stripped === '' ? '/' : stripped;
71
+ }
72
+ /**
73
+ * Response for a matched route whose content lookup found nothing. The
74
+ * 'passthrough' body is deliberately null: Astro only reroutes a 404 to the
75
+ * site's own /404 route when the body is empty, and that reroute serves even a
76
+ * prerendered /404 page with a real 404 status — so the site keeps its designed
77
+ * not-found page without a soft-404 redirect.
78
+ */
79
+ export function pageNotFoundResponse(fallback) {
80
+ if (fallback === 'passthrough') {
81
+ return new Response(null, { status: 404 });
82
+ }
83
+ return new Response('Page not found', { status: 404 });
84
+ }
85
+ /**
86
+ * Runtime narrow from a raw loader record to a page entry. Checks the fields
87
+ * a {@link PageReference} is built from, so nothing downstream carries a type
88
+ * the record never had — a record without a string id is dropped here instead
89
+ * of becoming a PageReference whose `id: string` is a lie.
90
+ */
91
+ function isPageEntryRecord(data) {
92
+ return typeof data.id === 'string' && typeof data.locale === 'string' && typeof data.pathname === 'string';
93
+ }
94
+ /**
95
+ * Published page entries for a collection/locale, shaped for downstream use.
96
+ * The narrowing `isPageEntryRecord` performs is kept in the return type, so
97
+ * callers read `pathname` as the string the filter already guaranteed.
98
+ */
99
+ export async function getPageEntries(source, collectionName, locale) {
100
+ const entries = await source.listEntries(collectionName);
101
+ return entries.filter(isPageEntryRecord).filter((data) => data.locale === locale && isContentPublished(data));
102
+ }
103
+ function toPageReference(entry, collection) {
104
+ // The content loader flattens localeVersion.meta into the entry record, so
105
+ // everything that isn't a structural field IS the page's metadata: the rest
106
+ // element peels the structural fields off rather than allowlisting meta
107
+ // keys — host page schemas add arbitrary fields (author, tags, …) that
108
+ // listing components read via `page.meta`, and the editor's page feed
109
+ // (`pageReferenceOf`) passes the full meta; the rendered site must match it.
110
+ const { id, locale, pathname, name, created, modified, publishAt, unpublishAt, puckData, mdx, data, ...rest } = entry;
111
+ // `pageMetaSchema` makes `title` required, so a page that reached the
112
+ // collection carries one; the loader-record type marks it optional because it
113
+ // describes the raw flattened shape, before that schema runs. Assert the
114
+ // narrower ContentMeta here rather than inventing an empty title downstream.
115
+ const meta = rest;
116
+ return {
117
+ id,
118
+ pathname: pathname || '/',
119
+ title: meta.title,
120
+ collection,
121
+ meta,
122
+ timestamps: pageTimestampsOf({ created, modified, publishAt }),
123
+ };
124
+ }
125
+ export async function getPagesByPrefix(source, prefix, locale, config, options) {
126
+ const pageCollections = Array.from(new Set(Object.values(config.routes).map((route) => route.collection)));
127
+ const pages = (await Promise.all(pageCollections.map(async (collectionName) => {
128
+ const entries = await getPageEntries(source, collectionName, locale);
129
+ return entries.map((data) => toPageReference(data, collectionName));
130
+ }))).flat();
131
+ return selectPagesByPrefix(pages, prefix, options);
132
+ }
133
+ export async function getDataCollectionEntries(source, collectionName, locale) {
134
+ const entries = await source.listEntries(collectionName);
135
+ return entries
136
+ .map((data) => data)
137
+ .filter((data) => data.locale === locale && typeof data.name === 'string' && isContentPublished(data))
138
+ .map((data) => ({
139
+ id: data.id || '',
140
+ name: data.name || '',
141
+ data: data.data || {},
142
+ meta: {
143
+ title: data.title,
144
+ description: data.description,
145
+ },
146
+ }));
147
+ }
148
+ /**
149
+ * Evaluate every published MDX fragment for a locale into a renderable React
150
+ * component. `evaluateMDXToComponent` and `isDev` are injected so the core
151
+ * stays astro/vite-free.
152
+ */
153
+ export async function loadMdxComponents(source, locale, evaluateMDXToComponent, isDev) {
154
+ const entries = (await source.listEntries(ALL_FRAGMENTS_COLLECTION)).map((data) => data);
155
+ return Promise.all(entries
156
+ .filter((data) => data.locale === locale && typeof data.id === 'string' && isContentPublished(data))
157
+ .map(async (data) => {
158
+ const title = data.title || data.name || data.id;
159
+ const mdx = data.mdx;
160
+ if (!mdx) {
161
+ if (isDev) {
162
+ console.warn(`[Conloca] No MDX content found for fragment: ${title}`);
163
+ }
164
+ return {
165
+ id: data.id || title,
166
+ title,
167
+ Component: () => null,
168
+ outline: [],
169
+ };
170
+ }
171
+ const { Component, error, outline } = await evaluateMDXToComponent(mdx);
172
+ if (!Component || error) {
173
+ const errorMessage = error?.message || 'MDX evaluation failed';
174
+ console.error(`[Conloca] MDX compilation error in fragment "${title}": ${errorMessage}`);
175
+ return {
176
+ id: data.id || title,
177
+ title,
178
+ Component: isDev
179
+ ? () => React.createElement('div', { className: 'p-4 bg-red-50 border border-red-200 rounded text-red-600' }, React.createElement('p', { className: 'font-semibold mb-2' }, 'MDX Compilation Error'), React.createElement('p', { className: 'text-sm' }, `Fragment: ${title}`), React.createElement('p', { className: 'text-xs mt-2' }, errorMessage))
180
+ : () => null,
181
+ outline: [],
182
+ };
183
+ }
184
+ return {
185
+ id: data.id || title,
186
+ title,
187
+ Component,
188
+ outline,
189
+ };
190
+ }));
191
+ }
192
+ /**
193
+ * Assemble the data context every block of `entry` is rendered with: the page
194
+ * itself, plus the collections and pages-by-prefix its route's data bindings
195
+ * declare.
196
+ */
197
+ export async function buildDataContext(source, routeConfig, config, entry) {
198
+ const dataBindings = routeConfig.dataBindings;
199
+ const collectionNames = dataBindings.collections;
200
+ const pagesConfig = dataBindings.pages;
201
+ const hasCollections = collectionNames !== undefined && collectionNames.length > 0;
202
+ const hasPages = pagesConfig?.prefix !== undefined && pagesConfig.prefix !== '';
203
+ const bindingsLocale = dataBindings.locale ?? config.locale;
204
+ const collections = {};
205
+ let pages;
206
+ if (hasCollections) {
207
+ for (const collectionName of collectionNames) {
208
+ try {
209
+ collections[collectionName] = await getDataCollectionEntries(source, collectionName, bindingsLocale);
210
+ }
211
+ catch (error) {
212
+ console.error(`[Conloca] Failed to fetch collection '${collectionName}':`, error);
213
+ collections[collectionName] = [];
214
+ }
215
+ }
216
+ }
217
+ if (hasPages && pagesConfig) {
218
+ try {
219
+ pages = await getPagesByPrefix(source, pagesConfig.prefix, bindingsLocale, config, {
220
+ sort: pagesConfig.sort,
221
+ limit: pagesConfig.limit,
222
+ });
223
+ }
224
+ catch (error) {
225
+ console.error(`[Conloca] Failed to fetch pages with prefix '${pagesConfig.prefix}':`, error);
226
+ pages = [];
227
+ }
228
+ }
229
+ return {
230
+ collections,
231
+ ...(pages && { pages }),
232
+ locale: bindingsLocale,
233
+ siteName: config.siteName,
234
+ page: toPageReference(entry, routeConfig.collection),
235
+ };
236
+ }
237
+ /**
238
+ * Resolve a page's Puck data for render: apply component defaultProps, then run
239
+ * Puck's async data-resolution with the data context as each resolver's
240
+ * `metadata`. Falls back to the merged (unresolved) data on a resolver error,
241
+ * matching the handler's former behaviour.
242
+ */
243
+ export async function resolvePuckData(puckData, puckConfig, dataContext) {
244
+ const mergedData = mergeDefaultProps(puckData, puckConfig);
245
+ try {
246
+ return await resolveAllData(mergedData, puckConfig, dataContext);
247
+ }
248
+ catch (error) {
249
+ console.error('[Conloca] resolveAllData failed:', error);
250
+ return mergedData;
251
+ }
252
+ }
253
+ /**
254
+ * Reader-backed {@link PageContentSource} over a {@link ContentAPI}, the one a
255
+ * caller installs on `Astro.locals.contentApi`. It projects the reader's
256
+ * manifest listing + per-locale content into the SAME record shape the
257
+ * collection-backed source (and the Astro loader) produce, so the render core
258
+ * is oblivious to which backend served it: the page shows whatever that
259
+ * reader returns.
260
+ *
261
+ * The synthetic `__conloca_fragments` collection is not a real ContentAPI
262
+ * collection (the loader flattens every fragment collection into it), so it maps
263
+ * to a `kind: 'fragment'` query; `type: 'mdx'` PAGES are skipped exactly as the
264
+ * loader skips them (they belong to an external renderer).
265
+ */
266
+ export function createReaderContentSource(api, renderLocale) {
267
+ const filtersFor = (collection) => collection === ALL_FRAGMENTS_COLLECTION ? { kind: 'fragment' } : { collection };
268
+ const shapeEntry = async (manifest, locale) => {
269
+ const localeVersion = manifest.locales[locale];
270
+ if (!localeVersion)
271
+ return null;
272
+ const localized = await api.getLocalized(manifest.id, locale);
273
+ const content = localized?.localized.content;
274
+ const record = {
275
+ id: manifest.id,
276
+ locale,
277
+ ...(localeVersion.pathname !== undefined && { pathname: localeVersion.pathname }),
278
+ ...(localeVersion.name !== undefined && { name: localeVersion.name }),
279
+ ...localeVersion.meta,
280
+ created: localeVersion.created,
281
+ modified: localeVersion.modified,
282
+ publishAt: localeVersion.publishAt,
283
+ unpublishAt: localeVersion.unpublishAt,
284
+ ...(content?.data !== undefined && { data: content.data }),
285
+ };
286
+ if (content?.mdx !== undefined)
287
+ record.mdx = content.mdx;
288
+ if (content?.puckData !== undefined)
289
+ record.puckData = content.puckData;
290
+ return record;
291
+ };
292
+ return {
293
+ async listEntries(collection) {
294
+ const records = [];
295
+ for (const manifest of api.listAllContent(filtersFor(collection))) {
296
+ // Mirror the loader's skip: `type: 'mdx'` pages are owned by an
297
+ // external renderer, not this puck-page handler.
298
+ if (manifest.kind === 'page' && manifest.type === 'mdx')
299
+ continue;
300
+ // Every consumer filters records to one locale, and each shaped
301
+ // locale is one getLocalized read, so with a render locale known,
302
+ // shaping the others is wasted work.
303
+ for (const locale of Object.keys(manifest.locales)) {
304
+ if (renderLocale !== undefined && locale !== renderLocale)
305
+ continue;
306
+ const record = await shapeEntry(manifest, locale);
307
+ if (record)
308
+ records.push(record);
309
+ }
310
+ }
311
+ return records;
312
+ },
313
+ };
314
+ }
315
+ //# sourceMappingURL=page-render-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-render-core.js","sourceRoot":"","sources":["../../../../src/handlers/page-render-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAIL,kBAAkB,EAElB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAa,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,uEAAuE;AACvE,sDAAsD;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAsD9D;;;;;;G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E;gBAChE,iDAAiD;gBACjD,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,KAAK;oBAAE,SAAS;gBAClE,gEAAgE;gBAChE,kEAAkE;gBAClE,qCAAqC;gBACrC,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;oBACnD,IAAI,YAAY,KAAK,SAAS,IAAI,MAAM,KAAK,YAAY;wBAAE,SAAS;oBACpE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;oBAClD,IAAI,MAAM;wBAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACnC,CAAC;YACH,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type { ComponentRegistry } from './lib/hydration-script.js';
2
+ export { type HydrationMeta, type WithHydrationStrategy, withHydration } from './lib/withHydration.js';
3
+ export type { HydrationStrategy } from './types.js';
4
+ //# sourceMappingURL=hydration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydration.d.ts","sourceRoot":"","sources":["../../../src/hydration.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,qBAAqB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvG,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ // Browser-safe exports for @conloca/astro-cms
2
+ // This entry point contains ONLY code that can run in the browser.
3
+ // Import from '@conloca/astro-cms/client' in component files that need hydration.
4
+ export { withHydration } from './lib/withHydration.js';
5
+ //# sourceMappingURL=hydration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydration.js","sourceRoot":"","sources":["../../../src/hydration.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,mEAAmE;AACnE,kFAAkF;AAGlF,OAAO,EAAkD,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,21 @@
1
+ export { defineMdxComponents, type MdxComponentDescriptor, type MdxComponentInsertHint, type MdxComponentProp, type MdxComponents, type MdxJsxComponentDescriptor, type MdxSnippetDescriptor, readStringAttribute, writeStringAttribute, } from '@conloca/cms-spa/mdx-components-define';
2
+ export { type CoreFieldsMode, definePageSchema, type FieldHint, type FieldHintCommon, type FieldHints, type FieldHintVariant, type PageSchemaDescriptor, type PageSchemaEntry, type PageSchemaGroup, type PageSchemas, } from '@conloca/cms-spa/page-schema-define';
3
+ export { type PageSettingAttributes, type PageSettingName, pageSettingAttributes, } from '@conloca/cms-spa/page-setting-attributes';
4
+ export { type FragmentMeta, fragmentMetaSchema, type PageMeta, pageMetaSchema, } from '@conloca/content-api/schemas';
5
+ export { type CollectionBackedContentAPIOptions, createCollectionBackedContentAPI, } from './handlers/collection-content-api.js';
6
+ export type { ComponentRegistry } from './lib/hydration-script.js';
7
+ export { findHydratableComponents, type HydratableComponent, type HydratableComponentConfig, hasHydratableComponents, isHydratable, } from './lib/hydration-utils.js';
8
+ export { entryIdFromPath, extractSlugFromPathname, isPublished, pathnameFromSlug, staticPathParams, toDate, } from './lib/route-utils.js';
9
+ export { serializeProps } from './lib/serialize-props.js';
10
+ export { type HydrationMeta, type WithHydrationStrategy, withHydration } from './lib/withHydration.js';
11
+ export { type ConlocaLocales, localesFromAstroI18n, localesFromStarlight } from './locales-helpers.js';
12
+ /**
13
+ * Migration stub: the integration moved to '@conloca/astro-cms/node' so the
14
+ * root entry stays static-safe. Published 0.1.x exported it from the root —
15
+ * without this stub those configs fail with an opaque "not a function".
16
+ *
17
+ * @deprecated Import { conlocaCMS } from '@conloca/astro-cms/node' instead.
18
+ */
19
+ export declare function conlocaCMS(_options?: unknown): never;
20
+ export type { ContentFragmentSectionProps, DataCollectionEntry, DataContext, HydrationStrategy, LayoutProps, PageData, PageReference, ResolvedRoutingConfig, TemplateConfig, } from './types.js';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,mBAAmB,EACnB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAIhD,OAAO,EACL,KAAK,cAAc,EACnB,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,qBAAqB,GACtB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACL,KAAK,YAAY,EACjB,kBAAkB,EAClB,KAAK,QAAQ,EACb,cAAc,GACf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,KAAK,iCAAiC,EACtC,gCAAgC,GACjC,MAAM,sCAAsC,CAAC;AAM9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACL,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,uBAAuB,EACvB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,GACP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,qBAAqB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvG,OAAO,EAAE,KAAK,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAKvG;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAKpD;AACD,YAAY,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC"}
@@ -0,0 +1,45 @@
1
+ // Astro integration for Conloca CMS
2
+ // MDX component registry plugin API — hosts use these to register JSX
3
+ // components (e.g. Starlight's Steps/Tabs/Card) with typed insert editors
4
+ // and opt-in auto-import injection. Runtime registry also wires through
5
+ // the schemasPath option; hosts export `mdxComponents` from the same file.
6
+ //
7
+ // `readStringAttribute` / `writeStringAttribute` are mdast-level helpers
8
+ // for hosts writing their own typed `Editor` components — controlled
9
+ // inputs against a string prop. Re-exported here so a host's editor file
10
+ // can pull everything it needs from one place.
11
+ export { defineMdxComponents, readStringAttribute, writeStringAttribute, } from '@conloca/cms-spa/mdx-components-define';
12
+ // Page-schema plugin API — hosts use these to declare frontmatter form UI
13
+ // for the CMS page-settings dialog. Runtime registry lives in @conloca/cms-spa
14
+ // and is wired by the schemasPath option (see ConlocaCMSOptions).
15
+ export { definePageSchema, } from '@conloca/cms-spa/page-schema-define';
16
+ // Blocks mark the parts they render from the page's settings, so a click on
17
+ // the editor canvas opens Page settings at that field.
18
+ export { pageSettingAttributes, } from '@conloca/cms-spa/page-setting-attributes';
19
+ // Re-export Zod schemas and types for convenience
20
+ export { fragmentMetaSchema, pageMetaSchema, } from '@conloca/content-api/schemas';
21
+ // Read-only ContentAPI over the build's content collections.
22
+ export { createCollectionBackedContentAPI, } from './handlers/collection-content-api.js';
23
+ export { findHydratableComponents, hasHydratableComponents, isHydratable, } from './lib/hydration-utils.js';
24
+ export { entryIdFromPath, extractSlugFromPathname, isPublished, pathnameFromSlug, staticPathParams, toDate, } from './lib/route-utils.js';
25
+ export { serializeProps } from './lib/serialize-props.js';
26
+ // New hydration API: withHydration wrapper and build-time scanner
27
+ export { withHydration } from './lib/withHydration.js';
28
+ // Locale plumbing helpers — translate framework-native i18n configs
29
+ // into Conloca's locale shape. See locales-helpers.ts for the contract.
30
+ export { localesFromAstroI18n, localesFromStarlight } from './locales-helpers.js';
31
+ // Hydration support for interactive components
32
+ // NOTE: The root entry point is intentionally static-safe.
33
+ // Node/Astro integration APIs live under '@conloca/astro-cms/node'.
34
+ /**
35
+ * Migration stub: the integration moved to '@conloca/astro-cms/node' so the
36
+ * root entry stays static-safe. Published 0.1.x exported it from the root —
37
+ * without this stub those configs fail with an opaque "not a function".
38
+ *
39
+ * @deprecated Import { conlocaCMS } from '@conloca/astro-cms/node' instead.
40
+ */
41
+ export function conlocaCMS(_options) {
42
+ throw new Error("conlocaCMS moved: import { conlocaCMS } from '@conloca/astro-cms/node'. " +
43
+ 'The package root stays free of Node-only code so it can load in any runtime.');
44
+ }
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,sEAAsE;AACtE,0EAA0E;AAC1E,wEAAwE;AACxE,2EAA2E;AAC3E,EAAE;AACF,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,+CAA+C;AAC/C,OAAO,EACL,mBAAmB,EAOnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAChD,0EAA0E;AAC1E,+EAA+E;AAC/E,kEAAkE;AAClE,OAAO,EAEL,gBAAgB,GASjB,MAAM,qCAAqC,CAAC;AAC7C,4EAA4E;AAC5E,uDAAuD;AACvD,OAAO,EAGL,qBAAqB,GACtB,MAAM,0CAA0C,CAAC;AAClD,kDAAkD;AAClD,OAAO,EAEL,kBAAkB,EAElB,cAAc,GACf,MAAM,8BAA8B,CAAC;AACtC,6DAA6D;AAC7D,OAAO,EAEL,gCAAgC,GACjC,MAAM,sCAAsC,CAAC;AAO9C,OAAO,EACL,wBAAwB,EAGxB,uBAAuB,EACvB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,GACP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,kEAAkE;AAClE,OAAO,EAAkD,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvG,oEAAoE;AACpE,wEAAwE;AACxE,OAAO,EAAuB,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACvG,+CAA+C;AAC/C,2DAA2D;AAC3D,oEAAoE;AAEpE;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,QAAkB;IAC3C,MAAM,IAAI,KAAK,CACb,0EAA0E;QACxE,8EAA8E,CACjF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { Loader } from 'astro/loaders';
2
+ export type ConlocaCollectionKind = 'page' | 'data' | 'fragment';
3
+ /** Registry entries carry their kind: a data collection `general` must not cover an undeclared fragment FOLDER `general`. */
4
+ export type QualifiedCollectionName = `${ConlocaCollectionKind}:${string}`;
5
+ /** Factories call this as content.config evaluates; the registry is complete before any loader runs. */
6
+ export declare function declareConlocaCollection(kind: ConlocaCollectionKind, name: string): void;
7
+ /** Test hook — the registry is module state shared across a config evaluation. */
8
+ export declare function resetDeclaredCollections(): void;
9
+ /**
10
+ * Every Conloca collection on disk must be declared in content.config, or its
11
+ * entries silently never build. The reverse — declared with no directory yet —
12
+ * is the schema-first workflow (the directory appears with the first saved
13
+ * entry) and is allowed.
14
+ */
15
+ export declare function assertCollectionsDeclared(onDisk: Iterable<QualifiedCollectionName>): void;
16
+ /**
17
+ * Wraps a factory-created loader so a config evaluation checks the disk once
18
+ * per content root and site. createConlocaCollections' loaders are not wrapped
19
+ * — its contract IS discovery.
20
+ *
21
+ * Astro runs every loader concurrently through one Promise.all, so the check is
22
+ * memoised as a promise rather than a done-flag: one scan per root and site,
23
+ * and every loader awaits the same result instead of racing past a check still
24
+ * running.
25
+ */
26
+ export declare function withDeclarationCheck(loader: Loader, options: {
27
+ contentRoot: string;
28
+ site: string;
29
+ }): Loader;
30
+ //# sourceMappingURL=declared-collections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-collections.d.ts","sourceRoot":"","sources":["../../../../src/internal/declared-collections.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAa3D,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAEjE,6HAA6H;AAC7H,MAAM,MAAM,uBAAuB,GAAG,GAAG,qBAAqB,IAAI,MAAM,EAAE,CAAC;AAU3E,wGAAwG;AACxG,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAExF;AAED,kFAAkF;AAClF,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAUzF;AAYD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAqB3G"}
@@ -0,0 +1,84 @@
1
+ import { createContentAPI } from '@conloca/content-api/reader';
2
+ // Both registries are per-process, not per-config-evaluation: a dev-server
3
+ // config reload re-runs content.config without clearing them. So a collection
4
+ // dropped from the config stays declared, and a passing check is not repeated
5
+ // for a directory that appears later — not until the server restarts. Both are
6
+ // deliberately open: a stale registry can only miss a complaint, never invent
7
+ // one. Only successful checks are memoised, so a failing one is retried on the
8
+ // next load and a leftover can never keep failing a build the user has since
9
+ // fixed in content.config.ts.
10
+ const declared = new Set();
11
+ const checks = new Map();
12
+ const qualifiedName = (kind, name) => `${kind}:${name}`;
13
+ /** 'data:faqs' → 'the data collection "faqs"' — the registry key is internal, the error is for a human. */
14
+ function describeQualified(qualified) {
15
+ const separator = qualified.indexOf(':');
16
+ return `the ${qualified.slice(0, separator)} collection "${qualified.slice(separator + 1)}"`;
17
+ }
18
+ /** Factories call this as content.config evaluates; the registry is complete before any loader runs. */
19
+ export function declareConlocaCollection(kind, name) {
20
+ declared.add(qualifiedName(kind, name));
21
+ }
22
+ /** Test hook — the registry is module state shared across a config evaluation. */
23
+ export function resetDeclaredCollections() {
24
+ declared.clear();
25
+ checks.clear();
26
+ }
27
+ /**
28
+ * Every Conloca collection on disk must be declared in content.config, or its
29
+ * entries silently never build. The reverse — declared with no directory yet —
30
+ * is the schema-first workflow (the directory appears with the first saved
31
+ * entry) and is allowed.
32
+ */
33
+ export function assertCollectionsDeclared(onDisk) {
34
+ // A qualified name repeats only when one iterable carries duplicates —
35
+ // dedupe so nothing is ever reported twice.
36
+ const undeclared = [...new Set(onDisk)].filter((name) => !declared.has(name));
37
+ if (undeclared.length === 0)
38
+ return;
39
+ throw new Error(`[conloca] content on disk has collections that content.config.ts does not declare: ${undeclared
40
+ .map(describeQualified)
41
+ .join(', ')}. Declare each one (conlocaPages / conlocaData / conlocaFragments) or its entries will not be built.`);
42
+ }
43
+ /** Enumerates every collection kind on disk and checks the registry covers them. */
44
+ async function assertDiskDeclared(options) {
45
+ const api = await createContentAPI({ contentRoot: options.contentRoot });
46
+ assertCollectionsDeclared([
47
+ ...[...(api.getSite(options.site)?.collections ?? [])].map((name) => qualifiedName('page', name)),
48
+ ...[...api.data.collections].map((name) => qualifiedName('data', name)),
49
+ ...[...api.fragments.collections].map((name) => qualifiedName('fragment', name)),
50
+ ]);
51
+ }
52
+ /**
53
+ * Wraps a factory-created loader so a config evaluation checks the disk once
54
+ * per content root and site. createConlocaCollections' loaders are not wrapped
55
+ * — its contract IS discovery.
56
+ *
57
+ * Astro runs every loader concurrently through one Promise.all, so the check is
58
+ * memoised as a promise rather than a done-flag: one scan per root and site,
59
+ * and every loader awaits the same result instead of racing past a check still
60
+ * running.
61
+ */
62
+ export function withDeclarationCheck(loader, options) {
63
+ return {
64
+ ...loader,
65
+ async load(context) {
66
+ // NUL separates the two halves — a space collides with paths containing spaces.
67
+ const key = `${options.contentRoot}\0${options.site}`;
68
+ let check = checks.get(key);
69
+ if (!check) {
70
+ check = assertDiskDeclared(options).catch((error) => {
71
+ // Only a successful check is memoised: module state outlives a
72
+ // dev-server config reload, so a cached rejection would keep failing
73
+ // after the user has declared the collection it asked for.
74
+ checks.delete(key);
75
+ throw error;
76
+ });
77
+ checks.set(key, check);
78
+ }
79
+ await check;
80
+ return loader.load(context);
81
+ },
82
+ };
83
+ }
84
+ //# sourceMappingURL=declared-collections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-collections.js","sourceRoot":"","sources":["../../../../src/internal/declared-collections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,2EAA2E;AAC3E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,8BAA8B;AAC9B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;AACnC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAC;AAOhD,MAAM,aAAa,GAAG,CAAC,IAA2B,EAAE,IAAY,EAA2B,EAAE,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;AAEhH,2GAA2G;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0 +1,44 @@
1
+ import { type PageSchemas } from '@conloca/cms-spa/page-schema-define';
2
+ import type { ContentMeta } from '@conloca/content-api';
3
+ import { type PageMeta } from '@conloca/content-api/schemas';
4
+ import { z } from 'zod';
5
+ /**
6
+ * Fold every page-schema descriptor into one Zod object of host meta fields.
7
+ * Requiredness is not preserved — the caller always `.partial()`s this for the
8
+ * collection, because Astro validates the whole `pages` pile.
9
+ *
10
+ * The merged object has one slot per field name, so two descriptors may only
11
+ * declare the same name by sharing the same field schema instance — last-wins
12
+ * would silently rewrite what the earlier prefix's pages are validated
13
+ * against, failing them with a Zod error that names neither descriptor.
14
+ */
15
+ export declare function hostFieldsFromPageSchemas(pageSchemas: PageSchemas): z.ZodObject<z.ZodRawShape>;
16
+ /**
17
+ * A page collection entry as the loader delivers it: the validated
18
+ * `pageMetaSchema` fields, the loader-written record fields (`created`,
19
+ * `modified`, `name`, `puckData` — admitted by the loose index at runtime),
20
+ * and the host's meta fields through `ContentMeta`/`HostPageMeta`.
21
+ */
22
+ export type ConlocaPageEntry = ContentMeta & PageMeta & {
23
+ created?: string | Date;
24
+ modified?: string | Date;
25
+ name?: string;
26
+ puckData?: unknown;
27
+ };
28
+ /**
29
+ * The schema Astro validates page entries against: the host's page-meta fields
30
+ * (all optional) with conloca's structural fields layered over them, loose so
31
+ * undeclared top-level fields still reach the rendered page.
32
+ *
33
+ * Looseness is TOP-LEVEL ONLY. A nested `z.object()` still strips undeclared
34
+ * nested keys; a host that wants them preserved has to write `z.looseObject()`.
35
+ *
36
+ * Rewrite bans (.default / .coerce / .transform / .catch) walk nested objects,
37
+ * arrays, and unions. `.partial()` is still shallow.
38
+ *
39
+ * Internal on purpose: `src/collections.ts` is a published entry (the
40
+ * `./collections` subpath), so anything exported from there is frozen under
41
+ * semver. Nothing outside this package consumes it.
42
+ */
43
+ export declare function buildPageCollectionSchema(hostFields: z.ZodObject<z.ZodRawShape>): z.ZodType<ConlocaPageEntry>;
44
+ //# sourceMappingURL=page-collection-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-collection-schema.d.ts","sourceRoot":"","sources":["../../../../src/internal/page-collection-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,qCAAqC,CAAC;AAC/F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwGxB;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CA4B9F;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GACxC,QAAQ,GAAG;IACT,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEJ;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAc7G"}