@lupinum/ginko-content 0.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 (512) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/compatibility.json +27 -0
  4. package/dist/cli.d.mts +1 -0
  5. package/dist/cli.mjs +690 -0
  6. package/dist/cms-contract/build +1 -0
  7. package/dist/cms-contract/build.d.ts +44 -0
  8. package/dist/cms-contract/build.js +513 -0
  9. package/dist/cms-contract/index +1 -0
  10. package/dist/cms-contract/index.d.ts +25 -0
  11. package/dist/cms-contract/index.js +37 -0
  12. package/dist/cms-contract/mdc +1 -0
  13. package/dist/cms-contract/mdc.d.ts +32 -0
  14. package/dist/cms-contract/mdc.js +52 -0
  15. package/dist/cms-contract/path +1 -0
  16. package/dist/cms-contract/path.d.ts +12 -0
  17. package/dist/cms-contract/path.js +18 -0
  18. package/dist/cms-contract/schema +1 -0
  19. package/dist/cms-contract/schema.d.ts +18 -0
  20. package/dist/cms-contract/schema.js +13 -0
  21. package/dist/cms-contract/types +1 -0
  22. package/dist/cms-contract/types.d.ts +177 -0
  23. package/dist/cms-contract/types.js +0 -0
  24. package/dist/cms-import/index +1 -0
  25. package/dist/cms-import/index.d.ts +21 -0
  26. package/dist/cms-import/index.js +57 -0
  27. package/dist/config.d.mts +3 -0
  28. package/dist/config.mjs +3 -0
  29. package/dist/core/cache +1 -0
  30. package/dist/core/cache-hints +1 -0
  31. package/dist/core/cache-hints.d.ts +3 -0
  32. package/dist/core/cache-hints.js +55 -0
  33. package/dist/core/cache.d.ts +29 -0
  34. package/dist/core/cache.js +0 -0
  35. package/dist/core/content/collection +1 -0
  36. package/dist/core/content/collection.d.ts +3 -0
  37. package/dist/core/content/collection.js +52 -0
  38. package/dist/core/content/graph +1 -0
  39. package/dist/core/content/graph.d.ts +147 -0
  40. package/dist/core/content/graph.js +189 -0
  41. package/dist/core/content/ignore +1 -0
  42. package/dist/core/content/ignore.d.ts +5 -0
  43. package/dist/core/content/ignore.js +10 -0
  44. package/dist/core/content/locale +1 -0
  45. package/dist/core/content/locale.d.ts +61 -0
  46. package/dist/core/content/locale.js +77 -0
  47. package/dist/core/content/path +1 -0
  48. package/dist/core/content/path.d.ts +36 -0
  49. package/dist/core/content/path.js +143 -0
  50. package/dist/core/content/slug +1 -0
  51. package/dist/core/content/slug.d.ts +4 -0
  52. package/dist/core/content/slug.js +41 -0
  53. package/dist/core/content/sources +1 -0
  54. package/dist/core/content/sources.d.ts +2 -0
  55. package/dist/core/content/sources.js +6 -0
  56. package/dist/core/errors +1 -0
  57. package/dist/core/errors.d.ts +15 -0
  58. package/dist/core/errors.js +10 -0
  59. package/dist/core/markdown/tree +1 -0
  60. package/dist/core/markdown/tree.d.ts +9 -0
  61. package/dist/core/markdown/tree.js +47 -0
  62. package/dist/core/query/builder +1 -0
  63. package/dist/core/query/builder.d.ts +18 -0
  64. package/dist/core/query/builder.js +186 -0
  65. package/dist/core/query/execute +1 -0
  66. package/dist/core/query/execute.d.ts +52 -0
  67. package/dist/core/query/execute.js +304 -0
  68. package/dist/core/query/filter +1 -0
  69. package/dist/core/query/filter.d.ts +42 -0
  70. package/dist/core/query/filter.js +118 -0
  71. package/dist/core/query/json +1 -0
  72. package/dist/core/query/json.d.ts +2 -0
  73. package/dist/core/query/json.js +20 -0
  74. package/dist/core/query/lower +1 -0
  75. package/dist/core/query/lower.d.ts +14 -0
  76. package/dist/core/query/lower.js +121 -0
  77. package/dist/core/query/operators +1 -0
  78. package/dist/core/query/operators.d.ts +23 -0
  79. package/dist/core/query/operators.js +126 -0
  80. package/dist/core/query/params +1 -0
  81. package/dist/core/query/params.d.ts +15 -0
  82. package/dist/core/query/params.js +83 -0
  83. package/dist/core/query/plan +1 -0
  84. package/dist/core/query/plan.d.ts +110 -0
  85. package/dist/core/query/plan.js +0 -0
  86. package/dist/core/references/resolve +1 -0
  87. package/dist/core/references/resolve.d.ts +31 -0
  88. package/dist/core/references/resolve.js +121 -0
  89. package/dist/core/references/schema +1 -0
  90. package/dist/core/references/schema.d.ts +8 -0
  91. package/dist/core/references/schema.js +70 -0
  92. package/dist/core/result +1 -0
  93. package/dist/core/result.d.ts +27 -0
  94. package/dist/core/result.js +2 -0
  95. package/dist/features/collections/resolve +1 -0
  96. package/dist/features/collections/resolve.d.ts +63 -0
  97. package/dist/features/collections/resolve.js +76 -0
  98. package/dist/features/localization/config +1 -0
  99. package/dist/features/localization/config.d.ts +18 -0
  100. package/dist/features/localization/config.js +25 -0
  101. package/dist/features/localization/links +1 -0
  102. package/dist/features/localization/links.d.ts +1 -0
  103. package/dist/features/localization/links.js +69 -0
  104. package/dist/features/localization/path +1 -0
  105. package/dist/features/localization/path.d.ts +32 -0
  106. package/dist/features/localization/path.js +80 -0
  107. package/dist/features/localization/results +1 -0
  108. package/dist/features/localization/results.d.ts +42 -0
  109. package/dist/features/localization/results.js +149 -0
  110. package/dist/features/localization/translated-slugs +1 -0
  111. package/dist/features/localization/translated-slugs.d.ts +11 -0
  112. package/dist/features/localization/translated-slugs.js +80 -0
  113. package/dist/features/navigation/build +1 -0
  114. package/dist/features/navigation/build.d.ts +28 -0
  115. package/dist/features/navigation/build.js +104 -0
  116. package/dist/features/navigation/canonical +1 -0
  117. package/dist/features/navigation/canonical.d.ts +33 -0
  118. package/dist/features/navigation/canonical.js +149 -0
  119. package/dist/features/navigation/query +1 -0
  120. package/dist/features/navigation/query.d.ts +19 -0
  121. package/dist/features/navigation/query.js +51 -0
  122. package/dist/features/navigation/resolve +1 -0
  123. package/dist/features/navigation/resolve.d.ts +20 -0
  124. package/dist/features/navigation/resolve.js +79 -0
  125. package/dist/features/navigation/tree +1 -0
  126. package/dist/features/navigation/tree.d.ts +6 -0
  127. package/dist/features/navigation/tree.js +32 -0
  128. package/dist/features/search/navigation +1 -0
  129. package/dist/features/search/navigation.d.ts +6 -0
  130. package/dist/features/search/navigation.js +21 -0
  131. package/dist/features/search/sections +1 -0
  132. package/dist/features/search/sections.d.ts +21 -0
  133. package/dist/features/search/sections.js +98 -0
  134. package/dist/features/sitemap/query +1 -0
  135. package/dist/features/sitemap/query.d.ts +68 -0
  136. package/dist/features/sitemap/query.js +171 -0
  137. package/dist/integrations/nitro/context +1 -0
  138. package/dist/integrations/nitro/context.d.ts +63 -0
  139. package/dist/integrations/nitro/context.js +28 -0
  140. package/dist/integrations/nitro/ingest +1 -0
  141. package/dist/integrations/nitro/ingest.d.ts +18 -0
  142. package/dist/integrations/nitro/ingest.js +120 -0
  143. package/dist/integrations/nitro/preview +1 -0
  144. package/dist/integrations/nitro/preview.d.ts +5 -0
  145. package/dist/integrations/nitro/preview.js +21 -0
  146. package/dist/integrations/nitro/runtime-config +1 -0
  147. package/dist/integrations/nitro/runtime-config.d.ts +1 -0
  148. package/dist/integrations/nitro/runtime-config.js +4 -0
  149. package/dist/integrations/nitro/storage +1 -0
  150. package/dist/integrations/nitro/storage.d.ts +9 -0
  151. package/dist/integrations/nitro/storage.js +113 -0
  152. package/dist/integrations/vue/content-components +1 -0
  153. package/dist/integrations/vue/content-components.d.ts +24 -0
  154. package/dist/integrations/vue/content-components.js +67 -0
  155. package/dist/integrations/vue/html-tags +1 -0
  156. package/dist/integrations/vue/html-tags.d.ts +2 -0
  157. package/dist/integrations/vue/html-tags.js +119 -0
  158. package/dist/integrations/vue/markdown-refs +1 -0
  159. package/dist/integrations/vue/markdown-refs.d.ts +1 -0
  160. package/dist/integrations/vue/markdown-refs.js +1 -0
  161. package/dist/module.d.mts +2044 -0
  162. package/dist/module.json +12 -0
  163. package/dist/module.mjs +1381 -0
  164. package/dist/parsers/csv +1 -0
  165. package/dist/parsers/csv.d.ts +2 -0
  166. package/dist/parsers/csv.js +38 -0
  167. package/dist/parsers/from-csv +1 -0
  168. package/dist/parsers/from-csv.d.ts +20 -0
  169. package/dist/parsers/from-csv.js +85 -0
  170. package/dist/parsers/index +1 -0
  171. package/dist/parsers/index.d.ts +10 -0
  172. package/dist/parsers/index.js +50 -0
  173. package/dist/parsers/json +1 -0
  174. package/dist/parsers/json.d.ts +2 -0
  175. package/dist/parsers/json.js +29 -0
  176. package/dist/parsers/markdown +1 -0
  177. package/dist/parsers/markdown-plugins +1 -0
  178. package/dist/parsers/markdown-plugins.d.ts +3 -0
  179. package/dist/parsers/markdown-plugins.js +58 -0
  180. package/dist/parsers/markdown.d.ts +2 -0
  181. package/dist/parsers/markdown.js +64 -0
  182. package/dist/parsers/path-meta +1 -0
  183. package/dist/parsers/path-meta.d.ts +4 -0
  184. package/dist/parsers/path-meta.js +37 -0
  185. package/dist/parsers/utils +1 -0
  186. package/dist/parsers/utils.d.ts +2 -0
  187. package/dist/parsers/utils.js +3 -0
  188. package/dist/parsers/yaml +1 -0
  189. package/dist/parsers/yaml.d.ts +2 -0
  190. package/dist/parsers/yaml.js +19 -0
  191. package/dist/public/client +1 -0
  192. package/dist/public/client.d.ts +19 -0
  193. package/dist/public/client.js +26 -0
  194. package/dist/public/provider +1 -0
  195. package/dist/public/provider-errors +1 -0
  196. package/dist/public/provider-errors.d.ts +4 -0
  197. package/dist/public/provider-errors.js +28 -0
  198. package/dist/public/provider.d.ts +74 -0
  199. package/dist/public/provider.js +6 -0
  200. package/dist/public/server +1 -0
  201. package/dist/public/server.d.ts +19 -0
  202. package/dist/public/server.js +28 -0
  203. package/dist/runtime/app/components/ContentRenderer.d.vue.ts +62 -0
  204. package/dist/runtime/app/components/ContentRenderer.vue +84 -0
  205. package/dist/runtime/app/components/ContentRenderer.vue.d.ts +62 -0
  206. package/dist/runtime/app/components/ContentRendererInline.d.vue.ts +50 -0
  207. package/dist/runtime/app/components/ContentRendererInline.vue +97 -0
  208. package/dist/runtime/app/components/ContentRendererInline.vue.d.ts +50 -0
  209. package/dist/runtime/app/components/Prose/ProseCode.d.vue.ts +61 -0
  210. package/dist/runtime/app/components/Prose/ProseCode.vue +32 -0
  211. package/dist/runtime/app/components/Prose/ProseCode.vue.d.ts +61 -0
  212. package/dist/runtime/app/components/Prose/ProseCodeInline.d.vue.ts +13 -0
  213. package/dist/runtime/app/components/Prose/ProseCodeInline.vue +3 -0
  214. package/dist/runtime/app/components/Prose/ProseCodeInline.vue.d.ts +13 -0
  215. package/dist/runtime/app/components/Prose/ProseImg.d.vue.ts +59 -0
  216. package/dist/runtime/app/components/Prose/ProseImg.vue +59 -0
  217. package/dist/runtime/app/components/Prose/ProseImg.vue.d.ts +59 -0
  218. package/dist/runtime/app/components/Prose/ProsePre.d.vue.ts +79 -0
  219. package/dist/runtime/app/components/Prose/ProsePre.vue +42 -0
  220. package/dist/runtime/app/components/Prose/ProsePre.vue.d.ts +79 -0
  221. package/dist/runtime/app/components/internal/ContentRendererMarkdown.d.vue.ts +68 -0
  222. package/dist/runtime/app/components/internal/ContentRendererMarkdown.vue +99 -0
  223. package/dist/runtime/app/components/internal/ContentRendererMarkdown.vue.d.ts +68 -0
  224. package/dist/runtime/app/components/internal/MarkdownRenderer +1 -0
  225. package/dist/runtime/app/components/internal/MarkdownRenderer.d.ts +90 -0
  226. package/dist/runtime/app/components/internal/MarkdownRenderer.js +191 -0
  227. package/dist/runtime/app/composables/async-data +1 -0
  228. package/dist/runtime/app/composables/async-data.d.ts +2 -0
  229. package/dist/runtime/app/composables/async-data.js +4 -0
  230. package/dist/runtime/app/composables/content-i18n +1 -0
  231. package/dist/runtime/app/composables/content-i18n.d.ts +5 -0
  232. package/dist/runtime/app/composables/content-i18n.js +1 -0
  233. package/dist/runtime/app/composables/head +1 -0
  234. package/dist/runtime/app/composables/head.d.ts +11 -0
  235. package/dist/runtime/app/composables/head.js +98 -0
  236. package/dist/runtime/app/composables/locale +1 -0
  237. package/dist/runtime/app/composables/locale-context +1 -0
  238. package/dist/runtime/app/composables/locale-context.d.ts +5 -0
  239. package/dist/runtime/app/composables/locale-context.js +8 -0
  240. package/dist/runtime/app/composables/locale.d.ts +8 -0
  241. package/dist/runtime/app/composables/locale.js +15 -0
  242. package/dist/runtime/app/composables/navigation +1 -0
  243. package/dist/runtime/app/composables/navigation.d.ts +3 -0
  244. package/dist/runtime/app/composables/navigation.js +7 -0
  245. package/dist/runtime/app/composables/preview +1 -0
  246. package/dist/runtime/app/composables/preview.d.ts +5 -0
  247. package/dist/runtime/app/composables/preview.js +52 -0
  248. package/dist/runtime/app/composables/query-api +1 -0
  249. package/dist/runtime/app/composables/query-api.d.ts +27 -0
  250. package/dist/runtime/app/composables/query-api.js +46 -0
  251. package/dist/runtime/app/composables/route +1 -0
  252. package/dist/runtime/app/composables/route.d.ts +11 -0
  253. package/dist/runtime/app/composables/route.js +150 -0
  254. package/dist/runtime/app/composables/runtime +1 -0
  255. package/dist/runtime/app/composables/runtime.d.ts +2 -0
  256. package/dist/runtime/app/composables/runtime.js +7 -0
  257. package/dist/runtime/app/composables/search +1 -0
  258. package/dist/runtime/app/composables/search.d.ts +58 -0
  259. package/dist/runtime/app/composables/search.js +321 -0
  260. package/dist/runtime/app/composables/site-data +1 -0
  261. package/dist/runtime/app/composables/site-data.d.ts +12 -0
  262. package/dist/runtime/app/composables/site-data.js +12 -0
  263. package/dist/runtime/app/composables/toc +1 -0
  264. package/dist/runtime/app/composables/toc.d.ts +10 -0
  265. package/dist/runtime/app/composables/toc.js +31 -0
  266. package/dist/runtime/app/composables/use-content +1 -0
  267. package/dist/runtime/app/composables/use-content.d.ts +188 -0
  268. package/dist/runtime/app/composables/use-content.js +307 -0
  269. package/dist/runtime/app/composables/useUnwrap +1 -0
  270. package/dist/runtime/app/composables/useUnwrap.d.ts +8 -0
  271. package/dist/runtime/app/composables/useUnwrap.js +35 -0
  272. package/dist/runtime/app/composables/utils +1 -0
  273. package/dist/runtime/app/composables/utils.d.ts +22 -0
  274. package/dist/runtime/app/composables/utils.js +76 -0
  275. package/dist/runtime/app/composables/web-socket +1 -0
  276. package/dist/runtime/app/composables/web-socket.d.ts +3 -0
  277. package/dist/runtime/app/composables/web-socket.js +65 -0
  278. package/dist/runtime/app/pages/content.d.vue.ts +3 -0
  279. package/dist/runtime/app/pages/content.vue +14 -0
  280. package/dist/runtime/app/pages/content.vue.d.ts +3 -0
  281. package/dist/runtime/app/plugins/markdown-components +1 -0
  282. package/dist/runtime/app/plugins/markdown-components.d.ts +2 -0
  283. package/dist/runtime/app/plugins/markdown-components.js +19 -0
  284. package/dist/runtime/app/plugins/ws +1 -0
  285. package/dist/runtime/app/plugins/ws.d.ts +2 -0
  286. package/dist/runtime/app/plugins/ws.js +7 -0
  287. package/dist/runtime/app.d.vue.ts +3 -0
  288. package/dist/runtime/app.vue +3 -0
  289. package/dist/runtime/app.vue.d.ts +3 -0
  290. package/dist/runtime/markdown/plugins +1 -0
  291. package/dist/runtime/markdown/plugins.d.ts +3 -0
  292. package/dist/runtime/markdown/plugins.js +39 -0
  293. package/dist/runtime/query/public-limits +1 -0
  294. package/dist/runtime/query/public-limits.d.ts +2 -0
  295. package/dist/runtime/query/public-limits.js +2 -0
  296. package/dist/runtime/query/resolve +1 -0
  297. package/dist/runtime/query/resolve.d.ts +5 -0
  298. package/dist/runtime/query/resolve.js +9 -0
  299. package/dist/runtime/query/routes +1 -0
  300. package/dist/runtime/query/routes.d.ts +33 -0
  301. package/dist/runtime/query/routes.js +21 -0
  302. package/dist/runtime/query/unified +1 -0
  303. package/dist/runtime/query/unified.d.ts +94 -0
  304. package/dist/runtime/query/unified.js +473 -0
  305. package/dist/runtime/server/api/cache +1 -0
  306. package/dist/runtime/server/api/cache.d.ts +8 -0
  307. package/dist/runtime/server/api/cache.js +26 -0
  308. package/dist/runtime/server/api/locales +1 -0
  309. package/dist/runtime/server/api/locales.d.ts +6 -0
  310. package/dist/runtime/server/api/locales.js +28 -0
  311. package/dist/runtime/server/api/navigation +1 -0
  312. package/dist/runtime/server/api/navigation.d.ts +2 -0
  313. package/dist/runtime/server/api/navigation.js +21 -0
  314. package/dist/runtime/server/api/query +1 -0
  315. package/dist/runtime/server/api/query.d.ts +2 -0
  316. package/dist/runtime/server/api/query.js +6 -0
  317. package/dist/runtime/server/api/revalidate +1 -0
  318. package/dist/runtime/server/api/revalidate.d.ts +6 -0
  319. package/dist/runtime/server/api/revalidate.js +156 -0
  320. package/dist/runtime/server/api/search +1 -0
  321. package/dist/runtime/server/api/search-index +1 -0
  322. package/dist/runtime/server/api/search-index.d.ts +2 -0
  323. package/dist/runtime/server/api/search-index.js +20 -0
  324. package/dist/runtime/server/api/search.d.ts +2 -0
  325. package/dist/runtime/server/api/search.js +40 -0
  326. package/dist/runtime/server/api/site-data +1 -0
  327. package/dist/runtime/server/api/site-data.d.ts +2 -0
  328. package/dist/runtime/server/api/site-data.js +22 -0
  329. package/dist/runtime/server/api/sitemap +1 -0
  330. package/dist/runtime/server/api/sitemap.d.ts +2 -0
  331. package/dist/runtime/server/api/sitemap.js +11 -0
  332. package/dist/runtime/server/cache-adapter +1 -0
  333. package/dist/runtime/server/cache-adapter.d.ts +2 -0
  334. package/dist/runtime/server/cache-adapter.js +11 -0
  335. package/dist/runtime/server/cache-adapters +1 -0
  336. package/dist/runtime/server/cache-adapters.d.ts +9 -0
  337. package/dist/runtime/server/cache-adapters.js +50 -0
  338. package/dist/runtime/server/cache-hints +1 -0
  339. package/dist/runtime/server/cache-hints.d.ts +5 -0
  340. package/dist/runtime/server/cache-hints.js +17 -0
  341. package/dist/runtime/server/collection-helpers +1 -0
  342. package/dist/runtime/server/collection-helpers.d.ts +13 -0
  343. package/dist/runtime/server/collection-helpers.js +99 -0
  344. package/dist/runtime/server/index +1 -0
  345. package/dist/runtime/server/index.d.ts +9 -0
  346. package/dist/runtime/server/index.js +15 -0
  347. package/dist/runtime/server/manifest +1 -0
  348. package/dist/runtime/server/manifest.d.ts +1 -0
  349. package/dist/runtime/server/manifest.js +1 -0
  350. package/dist/runtime/server/navigation +1 -0
  351. package/dist/runtime/server/navigation-query +1 -0
  352. package/dist/runtime/server/navigation-query.d.ts +4 -0
  353. package/dist/runtime/server/navigation-query.js +80 -0
  354. package/dist/runtime/server/navigation.d.ts +2 -0
  355. package/dist/runtime/server/navigation.js +9 -0
  356. package/dist/runtime/server/pagefind +1 -0
  357. package/dist/runtime/server/pagefind.d.ts +2 -0
  358. package/dist/runtime/server/pagefind.js +30 -0
  359. package/dist/runtime/server/plugins/cache +1 -0
  360. package/dist/runtime/server/plugins/cache.d.ts +2 -0
  361. package/dist/runtime/server/plugins/cache.js +17 -0
  362. package/dist/runtime/server/plugins/sitemap +1 -0
  363. package/dist/runtime/server/plugins/sitemap.d.ts +2 -0
  364. package/dist/runtime/server/plugins/sitemap.js +25 -0
  365. package/dist/runtime/server/preview +1 -0
  366. package/dist/runtime/server/preview.d.ts +1 -0
  367. package/dist/runtime/server/preview.js +1 -0
  368. package/dist/runtime/server/provider-query +1 -0
  369. package/dist/runtime/server/provider-query.d.ts +27 -0
  370. package/dist/runtime/server/provider-query.js +131 -0
  371. package/dist/runtime/server/provider-result +1 -0
  372. package/dist/runtime/server/provider-result.d.ts +10 -0
  373. package/dist/runtime/server/provider-result.js +30 -0
  374. package/dist/runtime/server/providers/filesystem +1 -0
  375. package/dist/runtime/server/providers/filesystem.d.ts +2 -0
  376. package/dist/runtime/server/providers/filesystem.js +47 -0
  377. package/dist/runtime/server/providers/index +1 -0
  378. package/dist/runtime/server/providers/index.d.ts +3 -0
  379. package/dist/runtime/server/providers/index.js +190 -0
  380. package/dist/runtime/server/query-api +1 -0
  381. package/dist/runtime/server/query-api.d.ts +28 -0
  382. package/dist/runtime/server/query-api.js +54 -0
  383. package/dist/runtime/server/query-executor +1 -0
  384. package/dist/runtime/server/query-executor.d.ts +4 -0
  385. package/dist/runtime/server/query-executor.js +121 -0
  386. package/dist/runtime/server/runtime-config +1 -0
  387. package/dist/runtime/server/runtime-config.d.ts +1 -0
  388. package/dist/runtime/server/runtime-config.js +1 -0
  389. package/dist/runtime/server/search +1 -0
  390. package/dist/runtime/server/search.d.ts +18 -0
  391. package/dist/runtime/server/search.js +134 -0
  392. package/dist/runtime/server/sitemap +1 -0
  393. package/dist/runtime/server/sitemap-provider +1 -0
  394. package/dist/runtime/server/sitemap-provider.d.ts +10 -0
  395. package/dist/runtime/server/sitemap-provider.js +11 -0
  396. package/dist/runtime/server/sitemap.d.ts +6 -0
  397. package/dist/runtime/server/sitemap.js +45 -0
  398. package/dist/runtime/server/storage +1 -0
  399. package/dist/runtime/server/storage-access +1 -0
  400. package/dist/runtime/server/storage-access.d.ts +1 -0
  401. package/dist/runtime/server/storage-access.js +9 -0
  402. package/dist/runtime/server/storage.d.ts +2 -0
  403. package/dist/runtime/server/storage.js +2 -0
  404. package/dist/runtime/server/validation +1 -0
  405. package/dist/runtime/server/validation.d.ts +1 -0
  406. package/dist/runtime/server/validation.js +6 -0
  407. package/dist/runtime/shared/search +1 -0
  408. package/dist/runtime/shared/search.d.ts +2 -0
  409. package/dist/runtime/shared/search.js +89 -0
  410. package/dist/runtime/transformers/component-resolver +1 -0
  411. package/dist/runtime/transformers/component-resolver.d.ts +10 -0
  412. package/dist/runtime/transformers/component-resolver.js +30 -0
  413. package/dist/runtime/transformers/csv/from-csv +1 -0
  414. package/dist/runtime/transformers/csv/from-csv.d.ts +1 -0
  415. package/dist/runtime/transformers/csv/from-csv.js +1 -0
  416. package/dist/runtime/transformers/csv/index +1 -0
  417. package/dist/runtime/transformers/csv/index.d.ts +1 -0
  418. package/dist/runtime/transformers/csv/index.js +1 -0
  419. package/dist/runtime/transformers/define +1 -0
  420. package/dist/runtime/transformers/define.d.ts +1 -0
  421. package/dist/runtime/transformers/define.js +1 -0
  422. package/dist/runtime/transformers/index +1 -0
  423. package/dist/runtime/transformers/index.d.ts +1 -0
  424. package/dist/runtime/transformers/index.js +1 -0
  425. package/dist/runtime/transformers/json +1 -0
  426. package/dist/runtime/transformers/json.d.ts +1 -0
  427. package/dist/runtime/transformers/json.js +1 -0
  428. package/dist/runtime/transformers/markdown +1 -0
  429. package/dist/runtime/transformers/markdown.d.ts +1 -0
  430. package/dist/runtime/transformers/markdown.js +1 -0
  431. package/dist/runtime/transformers/path-meta +1 -0
  432. package/dist/runtime/transformers/path-meta.d.ts +2 -0
  433. package/dist/runtime/transformers/path-meta.js +2 -0
  434. package/dist/runtime/transformers/utils +1 -0
  435. package/dist/runtime/transformers/utils.d.ts +1 -0
  436. package/dist/runtime/transformers/utils.js +1 -0
  437. package/dist/runtime/transformers/yaml +1 -0
  438. package/dist/runtime/transformers/yaml.d.ts +1 -0
  439. package/dist/runtime/transformers/yaml.js +1 -0
  440. package/dist/runtime/utils/content-components +1 -0
  441. package/dist/runtime/utils/content-components.d.ts +9 -0
  442. package/dist/runtime/utils/content-components.js +16 -0
  443. package/dist/runtime/utils/query +1 -0
  444. package/dist/runtime/utils/query.d.ts +5 -0
  445. package/dist/runtime/utils/query.js +18 -0
  446. package/dist/runtime/virtual/transformers.d.ts +4 -0
  447. package/dist/runtime/virtual.d.ts +7 -0
  448. package/dist/storage/cache +1 -0
  449. package/dist/storage/cache.d.ts +32 -0
  450. package/dist/storage/cache.js +42 -0
  451. package/dist/storage/content +1 -0
  452. package/dist/storage/content.d.ts +41 -0
  453. package/dist/storage/content.js +86 -0
  454. package/dist/storage/contents +1 -0
  455. package/dist/storage/contents.d.ts +5 -0
  456. package/dist/storage/contents.js +116 -0
  457. package/dist/storage/driver +1 -0
  458. package/dist/storage/driver.d.ts +28 -0
  459. package/dist/storage/driver.js +22 -0
  460. package/dist/storage/graph +1 -0
  461. package/dist/storage/graph.d.ts +3 -0
  462. package/dist/storage/graph.js +14 -0
  463. package/dist/storage/manifest +1 -0
  464. package/dist/storage/manifest.d.ts +18 -0
  465. package/dist/storage/manifest.js +68 -0
  466. package/dist/storage/references +1 -0
  467. package/dist/storage/references.d.ts +13 -0
  468. package/dist/storage/references.js +78 -0
  469. package/dist/storage/validation +1 -0
  470. package/dist/storage/validation.d.ts +46 -0
  471. package/dist/storage/validation.js +341 -0
  472. package/dist/testing/provider-contract +1 -0
  473. package/dist/testing/provider-contract.d.ts +31 -0
  474. package/dist/testing/provider-contract.js +237 -0
  475. package/dist/testing/provider-fixture +1 -0
  476. package/dist/testing/provider-fixture.d.ts +65 -0
  477. package/dist/testing/provider-fixture.js +606 -0
  478. package/dist/types/api +1 -0
  479. package/dist/types/api.d.ts +47 -0
  480. package/dist/types/api.js +1 -0
  481. package/dist/types/config +1 -0
  482. package/dist/types/config.d.ts +281 -0
  483. package/dist/types/config.js +28 -0
  484. package/dist/types/content +1 -0
  485. package/dist/types/content.d.ts +311 -0
  486. package/dist/types/content.js +1 -0
  487. package/dist/types/fields +1 -0
  488. package/dist/types/fields.d.ts +81 -0
  489. package/dist/types/fields.js +146 -0
  490. package/dist/types/index +1 -0
  491. package/dist/types/index.d.ts +6 -0
  492. package/dist/types/index.js +6 -0
  493. package/dist/types/module +1 -0
  494. package/dist/types/module.d.ts +428 -0
  495. package/dist/types/module.js +0 -0
  496. package/dist/types/picomatch.d.ts +8 -0
  497. package/dist/types/query +1 -0
  498. package/dist/types/query.d.ts +862 -0
  499. package/dist/types/query.js +1 -0
  500. package/dist/types/reference +1 -0
  501. package/dist/types/reference.d.ts +1 -0
  502. package/dist/types/reference.js +1 -0
  503. package/dist/types/runtime +1 -0
  504. package/dist/types/runtime.d.ts +45 -0
  505. package/dist/types/runtime.js +1 -0
  506. package/dist/types/search +1 -0
  507. package/dist/types/search.d.ts +64 -0
  508. package/dist/types/search.js +0 -0
  509. package/dist/types/virtual.d.ts +19 -0
  510. package/dist/types.d.mts +11 -0
  511. package/dist/web-types.json +466 -0
  512. package/package.json +135 -0
@@ -0,0 +1,44 @@
1
+ /**
2
+ * `buildCmsContract` — deterministic normalization of a host's
3
+ * `content.config.ts` output into the shape `@lupinum/ginko-cms` consumes.
4
+ *
5
+ * Per the refactor plan: the CMS used to *infer* labels, types, locales,
6
+ * routing, and field shape from a content collection's loose config. That
7
+ * inference produced misclassifications (data collections rendered as
8
+ * route-backed, singletons treated as flat, fields losing media metadata).
9
+ *
10
+ * `buildCmsContract` instead produces a single normalized artifact. Anything
11
+ * the CMS needs to know is recorded explicitly. The CMS is forbidden from
12
+ * inferring on its own; it just reads this contract.
13
+ *
14
+ * This is a Gate 0 spike: the function is shaped end-to-end so the CMS can
15
+ * import and call it, but the schema-introspection branches are intentionally
16
+ * minimal. Gate 1 will fill them in against real fixtures.
17
+ */
18
+ import type { ContentCollectionConfig } from '../types/config.js';
19
+ import type { CmsContract, CmsSchemaCapabilities } from './types.js';
20
+ /** Stable contract version. Bump when the CMS-facing artifact shape changes. */
21
+ export declare const CMS_CONTRACT_VERSION = "v1";
22
+ export declare class CmsContractSchemaUnsupportedError extends Error {
23
+ readonly collectionSlug: string;
24
+ readonly unsupported: CmsSchemaCapabilities['unsupported'];
25
+ constructor(collectionSlug: string, unsupported: CmsSchemaCapabilities['unsupported']);
26
+ }
27
+ export interface BuildCmsContractOptions {
28
+ /** Site default locale, e.g. `'en'`. */
29
+ defaultLocale: string;
30
+ /** All locale codes the site can serve. */
31
+ locales: string[];
32
+ /** Optional include filter — when set, only listed collections are emitted. */
33
+ include?: string[];
34
+ }
35
+ export interface BuildCmsContractInput {
36
+ collections: Record<string, ContentCollectionConfig>;
37
+ }
38
+ /**
39
+ * Build a normalized CMS contract from a host's `content.config.ts` output.
40
+ *
41
+ * The function is deterministic: same input yields byte-identical output. The
42
+ * CMS hashes the result to detect contract changes between deployments.
43
+ */
44
+ export declare function buildCmsContract(config: BuildCmsContractInput, options: BuildCmsContractOptions): CmsContract;
@@ -0,0 +1,513 @@
1
+ import {
2
+ getSchemaDef,
3
+ getObjectShape,
4
+ getReferenceDescriptor,
5
+ getSchemaTypeName,
6
+ unwrapSchema
7
+ } from "../core/references/schema.js";
8
+ import { getContentFieldMetadata } from "../types/fields.js";
9
+ export const CMS_CONTRACT_VERSION = "v1";
10
+ const IMPLICIT_PAGE_FIELDS = /* @__PURE__ */ new Set(["title", "description", "body", "bodyMdc"]);
11
+ const SUPPORTED_TYPENAMES = /* @__PURE__ */ new Set([
12
+ "ZodObject",
13
+ "ZodArray",
14
+ "ZodString",
15
+ "ZodNumber",
16
+ "ZodBoolean",
17
+ "ZodDate",
18
+ "ZodEnum",
19
+ "ZodOptional",
20
+ "ZodNullable",
21
+ "ZodDefault"
22
+ ]);
23
+ const WRAPPER_TYPENAMES = /* @__PURE__ */ new Set(["ZodOptional", "ZodNullable", "ZodDefault"]);
24
+ export class CmsContractSchemaUnsupportedError extends Error {
25
+ constructor(collectionSlug, unsupported) {
26
+ super(
27
+ [
28
+ `CMS schema for collection "${collectionSlug}" contains unsupported Zod constructs.`,
29
+ ...unsupported.map((item) => `- ${item.path}: ${item.feature} (${item.reason})`)
30
+ ].join("\n")
31
+ );
32
+ this.collectionSlug = collectionSlug;
33
+ this.unsupported = unsupported;
34
+ this.name = "CmsContractSchemaUnsupportedError";
35
+ }
36
+ }
37
+ export function buildCmsContract(config, options) {
38
+ const include = options.include ? new Set(options.include) : null;
39
+ const collections = {};
40
+ for (const [slug, collection] of Object.entries(config.collections)) {
41
+ if (include && !include.has(slug)) continue;
42
+ collections[slug] = buildCollectionContract(slug, collection, options);
43
+ }
44
+ return {
45
+ contractVersion: CMS_CONTRACT_VERSION,
46
+ defaultLocale: options.defaultLocale,
47
+ locales: [...options.locales],
48
+ collections
49
+ };
50
+ }
51
+ function buildCollectionContract(slug, collection, options) {
52
+ const cms = collection.cms ?? {};
53
+ const locales = resolveLocales(collection, options);
54
+ const defaultLocale = resolveDefaultLocale(collection, options);
55
+ const isLocalized = locales.length > 1;
56
+ const routing = buildRouting(slug, collection, cms, options);
57
+ const fields = buildFields(collection, cms, isLocalized);
58
+ const schema = buildSchemaArtifactRef(slug, collection);
59
+ const contract = {
60
+ slug,
61
+ label: cms.label ?? deriveLabel(slug),
62
+ type: cms.type ?? deriveCollectionType(slug, collection),
63
+ icon: cms.icon ?? null,
64
+ locales,
65
+ defaultLocale,
66
+ routing,
67
+ fields
68
+ };
69
+ if (schema) contract.schema = schema;
70
+ if (cms.settings !== void 0) contract.settings = cms.settings;
71
+ return contract;
72
+ }
73
+ function resolveLocales(collection, options) {
74
+ if (collection.i18n === true) return [...options.locales];
75
+ if (collection.i18n && Array.isArray(collection.i18n.locales)) {
76
+ return [...collection.i18n.locales];
77
+ }
78
+ return [options.defaultLocale];
79
+ }
80
+ function resolveDefaultLocale(collection, options) {
81
+ if (collection.i18n && typeof collection.i18n === "object") {
82
+ return collection.i18n.defaultLocale ?? options.defaultLocale;
83
+ }
84
+ return options.defaultLocale;
85
+ }
86
+ function buildRouting(slug, collection, cms, options) {
87
+ const explicitMode = cms.route?.mode;
88
+ const localizedRoute = localizedRouteMap(collection.route);
89
+ const pathPrefix = cms.route?.pathPrefix ?? deriveRoutePathPrefix(slug, collection, options.defaultLocale);
90
+ const mode = explicitMode ?? (collection.sitemap === false && !pathPrefix ? "none" : "route");
91
+ const singleton = cms.route?.singleton ?? isSingleRouteSource(collection);
92
+ const routing = {
93
+ mode,
94
+ pathPrefix: mode === "none" ? "" : pathPrefix,
95
+ slugMode: cms.route?.slugMode ?? (collection.translatedSlugs ? "localized" : "shared"),
96
+ rootSlug: cms.route?.rootSlug ?? null,
97
+ singleton
98
+ };
99
+ if (mode !== "none" && localizedRoute) {
100
+ if (routing.singleton) {
101
+ routing.localizedSingletonPaths = localizedRoute;
102
+ } else {
103
+ routing.localizedPathPrefixes = localizedRoute;
104
+ }
105
+ }
106
+ return routing;
107
+ }
108
+ function deriveRoutePathPrefix(slug, collection, defaultLocale) {
109
+ const route = collection.route;
110
+ if (!route) return `/${slug}`;
111
+ if (typeof route === "string") return route;
112
+ const first = route[defaultLocale] ?? Object.values(route)[0];
113
+ return first ?? `/${slug}`;
114
+ }
115
+ function localizedRouteMap(route) {
116
+ if (!route || typeof route !== "object") return null;
117
+ return { ...route };
118
+ }
119
+ function isSingleRouteSource(collection) {
120
+ if (!collection.route) return false;
121
+ const sources = Array.isArray(collection.source) ? collection.source : [collection.source];
122
+ const routeSources = sources.filter((source) => typeof source === "string");
123
+ return routeSources.length === 1 && !/[{*?[\]]/.test(routeSources[0] ?? "");
124
+ }
125
+ function deriveCollectionType(slug, collection) {
126
+ if (collection.cms?.type) return collection.cms.type;
127
+ if (slug === "docs" || collection.cms?.route?.rootSlug) return "tree";
128
+ return "flat";
129
+ }
130
+ function deriveLabel(slug) {
131
+ return slug.split(/[-_]/g).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)).join(" ");
132
+ }
133
+ function buildFields(collection, cms, isLocalized) {
134
+ const fields = /* @__PURE__ */ new Map();
135
+ for (const field2 of implicitPageFields(collection, isLocalized)) {
136
+ fields.set(field2.key, field2);
137
+ }
138
+ for (const field2 of fieldsFromSchema(collection.schema, isLocalized)) {
139
+ fields.set(field2.key, field2);
140
+ }
141
+ for (const [key, override] of Object.entries(cms.fields ?? {})) {
142
+ const existing = fields.get(key);
143
+ fields.set(key, mergeField(existing, key, override, isLocalized));
144
+ }
145
+ return [...fields.values()].sort((a, b) => (a.order ?? 0) - (b.order ?? 0)).map((field2, index) => ({ ...field2, order: index }));
146
+ }
147
+ function implicitPageFields(collection, isLocalized) {
148
+ const fields = [
149
+ field({ key: "title", type: "text", required: true, localized: isLocalized }),
150
+ field({ key: "description", type: "textarea", localized: isLocalized })
151
+ ];
152
+ if (isMarkdownCollection(collection)) {
153
+ fields.push(field({ key: "bodyMdc", type: "richtext", localized: isLocalized }));
154
+ }
155
+ return fields;
156
+ }
157
+ function isMarkdownCollection(collection) {
158
+ if (collection.type === "page" || collection.route) return true;
159
+ const source = collection.source;
160
+ if (!source) return false;
161
+ const sources = Array.isArray(source) ? source : [source];
162
+ return sources.some((s) => typeof s === "string" && /\.(md|mdc|markdown)$/.test(s));
163
+ }
164
+ function fieldsFromSchema(schema, isLocalized) {
165
+ if (!schema) return [];
166
+ const shape = getObjectShape(schema);
167
+ if (!shape) return [];
168
+ const out = [];
169
+ for (const [key, child] of Object.entries(shape)) {
170
+ if (IMPLICIT_PAGE_FIELDS.has(key)) continue;
171
+ out.push(fieldFromSchema(key, child, isLocalized));
172
+ }
173
+ return out;
174
+ }
175
+ function fieldFromSchema(key, schema, isLocalized) {
176
+ const unwrapped = unwrapSchema(schema);
177
+ const required = !isOptional(schema);
178
+ const metadata = getContentFieldMetadata(schema) ?? getContentFieldMetadata(unwrapped);
179
+ if (metadata) {
180
+ return fieldFromMetadata(key, metadata, unwrapped, isLocalized, required);
181
+ }
182
+ const reference = getReferenceDescriptor(unwrapped);
183
+ if (reference) {
184
+ return field({
185
+ key,
186
+ type: "relation",
187
+ required,
188
+ localized: false,
189
+ relation: { collectionId: reference.collection ?? "", multiple: false }
190
+ });
191
+ }
192
+ const typeName = getSchemaTypeName(unwrapped);
193
+ if (typeName === "ZodArray") {
194
+ const element = getArrayElement(unwrapped);
195
+ const elementReference = getReferenceDescriptor(element);
196
+ if (elementReference) {
197
+ return field({
198
+ key,
199
+ type: "relations",
200
+ required,
201
+ localized: false,
202
+ relation: { collectionId: elementReference.collection ?? "", multiple: true }
203
+ });
204
+ }
205
+ const objectFields = fieldsFromArrayElement(element);
206
+ if (!objectFields) {
207
+ return field({
208
+ key,
209
+ type: "json",
210
+ required,
211
+ localized: isLocalized
212
+ });
213
+ }
214
+ return field({
215
+ key,
216
+ type: "array",
217
+ required,
218
+ localized: isLocalized,
219
+ fields: objectFields
220
+ });
221
+ }
222
+ if (typeName === "ZodObject") {
223
+ return field({
224
+ key,
225
+ type: "object",
226
+ required,
227
+ localized: isLocalized,
228
+ fields: fieldsFromObjectSchema(unwrapped, false)
229
+ });
230
+ }
231
+ if (typeName === "ZodString")
232
+ return field({ key, type: "text", required, localized: isLocalized });
233
+ if (typeName === "ZodNumber") return field({ key, type: "number", required, localized: false });
234
+ if (typeName === "ZodBoolean") return field({ key, type: "toggle", required, localized: false });
235
+ if (typeName === "ZodDate") return field({ key, type: "date", required, localized: false });
236
+ return field({ key, type: "json", required, localized: isLocalized });
237
+ }
238
+ function getArrayElement(schema) {
239
+ const def = getSchemaDef(schema);
240
+ return def?.element ?? def?.type ?? null;
241
+ }
242
+ function fieldsFromObjectSchema(schema, isLocalized) {
243
+ return Object.entries(getObjectShape(unwrapSchema(schema))).sort(([left], [right]) => left.localeCompare(right)).map(([key, child], index) => ({
244
+ ...fieldFromSchema(key, child, isLocalized),
245
+ order: index
246
+ }));
247
+ }
248
+ function fieldFromMetadata(key, metadata, schema, isLocalized, required) {
249
+ const localized = metadata.localized ?? isLocalized;
250
+ const result = field({
251
+ key,
252
+ type: metadataToContractType(metadata),
253
+ required: metadata.required ?? required,
254
+ localized,
255
+ label: metadata.label ?? null,
256
+ description: metadata.description ?? null,
257
+ options: metadata.options ?? null,
258
+ slugFrom: metadata.slugFrom ?? null
259
+ });
260
+ if (metadata.image) {
261
+ result.media = {
262
+ ...metadata.image.accept ? { accept: metadata.image.accept } : {},
263
+ aspectRatio: metadata.image.aspectRatio ?? null
264
+ };
265
+ }
266
+ if (metadata.asset) {
267
+ result.media = {
268
+ ...metadata.asset.accept ? { accept: metadata.asset.accept } : {},
269
+ aspectRatio: null
270
+ };
271
+ }
272
+ if (metadata.relation) {
273
+ result.relation = metadata.relation;
274
+ }
275
+ if (result.type === "object") {
276
+ result.fields = fieldsFromObjectSchema(schema, false);
277
+ }
278
+ if (result.type === "array") {
279
+ const element = getArrayElement(unwrapSchema(schema));
280
+ const objectFields = fieldsFromArrayElement(element);
281
+ if (!objectFields) {
282
+ result.type = "json";
283
+ result.fields = null;
284
+ } else {
285
+ result.fields = objectFields;
286
+ }
287
+ }
288
+ return result;
289
+ }
290
+ function fieldsFromArrayElement(element) {
291
+ return element && getSchemaTypeName(unwrapSchema(element)) === "ZodObject" ? fieldsFromObjectSchema(element, false) : null;
292
+ }
293
+ function metadataToContractType(metadata) {
294
+ switch (metadata.type) {
295
+ case "boolean":
296
+ return "toggle";
297
+ case "asset":
298
+ return "file";
299
+ default:
300
+ return metadata.type;
301
+ }
302
+ }
303
+ function isOptional(schema) {
304
+ const typeName = getSchemaTypeName(schema);
305
+ return typeName === "ZodOptional" || typeName === "ZodDefault" || typeName === "ZodNullable";
306
+ }
307
+ function mergeField(existing, key, override, isLocalized) {
308
+ const base = existing ?? field({ key, type: override.type ?? "text", localized: isLocalized });
309
+ return {
310
+ ...base,
311
+ ...override.type !== void 0 ? { type: override.type } : {},
312
+ ...override.label !== void 0 ? { label: override.label } : {},
313
+ ...override.description !== void 0 ? { description: override.description } : {},
314
+ ...override.required !== void 0 ? { required: override.required } : {},
315
+ ...override.localized !== void 0 ? { localized: override.localized } : {},
316
+ ...override.hidden !== void 0 ? { hidden: override.hidden } : {},
317
+ ...override.searchable !== void 0 ? { searchable: override.searchable } : {},
318
+ ...override.sortable !== void 0 ? { sortable: override.sortable } : {},
319
+ ...override.order !== void 0 ? { order: override.order } : {},
320
+ ...override.width !== void 0 ? { width: override.width } : {},
321
+ ...override.defaultValue !== void 0 ? { defaultValue: override.defaultValue } : {},
322
+ ...override.validation !== void 0 ? { validation: override.validation } : {},
323
+ ...override.condition !== void 0 ? { condition: override.condition } : {},
324
+ ...override.options !== void 0 ? { options: override.options } : {},
325
+ ...override.relation !== void 0 ? { relation: override.relation } : {},
326
+ ...override.min !== void 0 ? { min: override.min } : {},
327
+ ...override.max !== void 0 ? { max: override.max } : {},
328
+ ...override.step !== void 0 ? { step: override.step } : {},
329
+ ...override.slugFrom !== void 0 ? { slugFrom: override.slugFrom } : {},
330
+ ...override.language !== void 0 ? { language: override.language } : {}
331
+ };
332
+ }
333
+ function field(input) {
334
+ return {
335
+ key: input.key,
336
+ type: input.type,
337
+ label: input.label ?? null,
338
+ description: input.description ?? null,
339
+ required: input.required ?? false,
340
+ localized: input.localized ?? false,
341
+ hidden: input.hidden ?? false,
342
+ searchable: input.searchable ?? false,
343
+ sortable: input.sortable ?? false,
344
+ order: input.order ?? 0,
345
+ width: input.width ?? "full",
346
+ defaultValue: input.defaultValue,
347
+ options: input.options ?? null,
348
+ relation: input.relation ?? null,
349
+ media: input.media ?? null,
350
+ fields: input.fields ?? null,
351
+ validation: input.validation ?? null,
352
+ condition: input.condition ?? null,
353
+ min: input.min ?? null,
354
+ max: input.max ?? null,
355
+ step: input.step ?? null,
356
+ slugFrom: input.slugFrom ?? null,
357
+ language: input.language ?? null
358
+ };
359
+ }
360
+ function stableJson(value) {
361
+ if (value === void 0) return "null";
362
+ if (Array.isArray(value)) return `[${value.map(stableJson).join(",")}]`;
363
+ if (value && typeof value === "object") {
364
+ return `{${Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, entryValue]) => `${JSON.stringify(key)}:${stableJson(entryValue)}`).join(",")}}`;
365
+ }
366
+ return JSON.stringify(value);
367
+ }
368
+ function buildSchemaArtifactRef(slug, collection) {
369
+ const schema = collection.schema;
370
+ if (!schema) return void 0;
371
+ const capabilities = inspectSchemaCapabilities(schema);
372
+ if (capabilities.unsupported.length > 0) {
373
+ throw new CmsContractSchemaUnsupportedError(slug, capabilities.unsupported);
374
+ }
375
+ const artifact = buildSchemaValidationArtifact(schema);
376
+ const artifactBytes = stableJson(artifact);
377
+ return {
378
+ artifactId: `cms-schema:${slug}:${CMS_CONTRACT_VERSION}`,
379
+ checksum: checksumArtifactBytes(artifactBytes),
380
+ capabilities,
381
+ artifact: artifactBytes
382
+ };
383
+ }
384
+ function buildSchemaValidationArtifact(schema) {
385
+ return {
386
+ version: CMS_CONTRACT_VERSION,
387
+ root: schemaNode(schema)
388
+ };
389
+ }
390
+ function schemaNode(schema) {
391
+ const typeName = getSchemaTypeName(schema);
392
+ if (typeName === "ZodOptional") {
393
+ return { kind: "optional", inner: schemaNode(getSchemaDef(schema)?.innerType) };
394
+ }
395
+ if (typeName === "ZodNullable") {
396
+ return { kind: "nullable", inner: schemaNode(getSchemaDef(schema)?.innerType) };
397
+ }
398
+ if (typeName === "ZodDefault") {
399
+ return {
400
+ kind: "default",
401
+ inner: schemaNode(getSchemaDef(schema)?.innerType),
402
+ value: getSchemaDef(schema)?.defaultValue
403
+ };
404
+ }
405
+ if (typeName === "ZodObject") {
406
+ const shape = getObjectShape(schema);
407
+ return {
408
+ kind: "object",
409
+ required: Object.entries(shape).filter(([, child]) => !isOptional(child)).map(([key]) => key).sort((left, right) => left.localeCompare(right)),
410
+ shape: Object.fromEntries(
411
+ Object.entries(shape).sort(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, schemaNode(child)])
412
+ )
413
+ };
414
+ }
415
+ if (typeName === "ZodArray") {
416
+ return { kind: "array", element: schemaNode(getSchemaDef(schema)?.element) };
417
+ }
418
+ if (typeName === "ZodString") {
419
+ return { kind: "string", checks: stringChecks(schema) };
420
+ }
421
+ if (typeName === "ZodNumber") return { kind: "number" };
422
+ if (typeName === "ZodBoolean") return { kind: "boolean" };
423
+ if (typeName === "ZodDate") return { kind: "date" };
424
+ if (typeName === "ZodEnum") {
425
+ const entries = getSchemaDef(schema)?.entries;
426
+ return {
427
+ kind: "enum",
428
+ values: Object.values(entries ?? {}).filter((value) => typeof value === "string").sort((left, right) => left.localeCompare(right))
429
+ };
430
+ }
431
+ throw new Error(`Unsupported schema node ${typeName ?? "<unknown>"}.`);
432
+ }
433
+ function stringChecks(schema) {
434
+ const checks = [];
435
+ const value = schema;
436
+ if (typeof value.minLength === "number") checks.push({ kind: "min", value: value.minLength });
437
+ if (typeof value.maxLength === "number") checks.push({ kind: "max", value: value.maxLength });
438
+ if (value.format === "email") checks.push({ kind: "email" });
439
+ if (value.format === "url") checks.push({ kind: "url" });
440
+ return checks.length > 0 ? checks : void 0;
441
+ }
442
+ function checksumArtifactBytes(source) {
443
+ let hash = 2166136261;
444
+ for (let index = 0; index < source.length; index += 1) {
445
+ hash ^= source.charCodeAt(index);
446
+ hash = Math.imul(hash, 16777619);
447
+ }
448
+ return `fnv1a32:${(hash >>> 0).toString(16).padStart(8, "0")}`;
449
+ }
450
+ function inspectSchemaCapabilities(schema) {
451
+ const supports = /* @__PURE__ */ new Set();
452
+ const unsupported = [];
453
+ walkSchema(schema, "", supports, unsupported);
454
+ return {
455
+ supports: [...supports],
456
+ unsupported
457
+ };
458
+ }
459
+ function walkSchema(schema, path, supports, unsupported) {
460
+ const typeName = getSchemaTypeName(schema);
461
+ if (!typeName) return;
462
+ if (!SUPPORTED_TYPENAMES.has(typeName)) {
463
+ unsupported.push({
464
+ feature: typeName,
465
+ path: path || "<root>",
466
+ reason: `${typeName} is not yet supported by the validation artifact pipeline.`
467
+ });
468
+ return;
469
+ }
470
+ collectUnsupportedChecks(schema, path, unsupported);
471
+ if (typeName === "ZodOptional") supports.add("optional");
472
+ if (typeName === "ZodNullable") supports.add("nullable");
473
+ if (typeName === "ZodDefault") supports.add("default");
474
+ if (WRAPPER_TYPENAMES.has(typeName)) {
475
+ const inner = getSchemaDef(schema)?.innerType;
476
+ if (inner) walkSchema(inner, path, supports, unsupported);
477
+ return;
478
+ }
479
+ if (typeName === "ZodObject") {
480
+ supports.add("object");
481
+ const shape = getObjectShape(schema);
482
+ for (const [key, child] of Object.entries(shape)) {
483
+ walkSchema(child, path ? `${path}.${key}` : key, supports, unsupported);
484
+ }
485
+ }
486
+ if (typeName === "ZodArray") {
487
+ supports.add("array");
488
+ const element = getSchemaDef(schema)?.element;
489
+ if (element) walkSchema(element, `${path || "<root>"}[]`, supports, unsupported);
490
+ }
491
+ if (typeName === "ZodString") {
492
+ supports.add("string");
493
+ if (getReferenceDescriptor(schema)) supports.add("reference");
494
+ }
495
+ if (typeName === "ZodNumber") supports.add("number");
496
+ if (typeName === "ZodBoolean") supports.add("boolean");
497
+ if (typeName === "ZodDate") supports.add("date");
498
+ if (typeName === "ZodEnum") supports.add("enum");
499
+ }
500
+ function collectUnsupportedChecks(schema, path, unsupported) {
501
+ const checks = getSchemaDef(schema)?.checks;
502
+ if (!Array.isArray(checks)) return;
503
+ for (const check of checks) {
504
+ const def = check?._zod?.def ?? check?.def;
505
+ if (!def || def.check !== "custom" && def.type !== "custom") continue;
506
+ const isAsync = def.fn?.constructor?.name === "AsyncFunction";
507
+ unsupported.push({
508
+ feature: isAsync ? "ZodAsyncRefinement" : "ZodRefinement",
509
+ path: path || "<root>",
510
+ reason: "Custom Zod refinements are not supported by the validation artifact pipeline."
511
+ });
512
+ }
513
+ }
@@ -0,0 +1 @@
1
+ export * from './index.js'
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @lupinum/ginko-content/cms-contract
3
+ *
4
+ * Pure, runtime-safe surface that ginko-cms consumes. This subpath contains
5
+ * NO Node, Nuxt, h3, nitropack, filesystem, or @nuxt/kit dependencies. Every
6
+ * module re-exported from here MUST be importable from a V8 isolate (Convex
7
+ * component, Cloudflare Workers, browser).
8
+ *
9
+ * The CMS uses this surface to:
10
+ * - normalize a host's `content.config.ts` into a `CmsContract` artifact
11
+ * (`buildCmsContract`),
12
+ * - introspect Zod schemas without re-implementing the walker
13
+ * (`unwrapSchema`, `getObjectShape`, `getReferenceDescriptor`, ...),
14
+ * - generate paths consistently with how the filesystem provider does
15
+ * (`generatePath`, `generateCanonicalKey`, `slugifyUrlSegment`),
16
+ * - parse MDC into the same AST the filesystem provider uses (`parseMdcBody`).
17
+ *
18
+ * If a future change introduces a Node/Nuxt dependency anywhere in this
19
+ * tree, the CMS Convex build will break loudly. That's intentional.
20
+ */
21
+ export { CMS_CONTRACT_VERSION, CmsContractSchemaUnsupportedError, buildCmsContract, type BuildCmsContractInput, type BuildCmsContractOptions, } from './build.js';
22
+ export type { CmsCollectionContract, CmsCollectionRouting, CmsContract, CmsFieldContract, CmsSchemaArtifactRef, CmsSchemaCapabilities, ContentCmsCollectionConfig, ContentCmsFieldConfig, ContentCmsFieldType, ContentCmsRelationConfig, ContentCollectionConfig, ContentCollectionI18nConfig, } from './types.js';
23
+ export { describeId, generatePath, generateCanonicalKey, generateTitle, isDraftPath, isPartialPath, longestMountForPath, mountContentPath, normalizeContentPath, normalizeRouteMounts, prefixPathWithLocale, refineUrlPart, routeRemainder, routeToContentPathCandidates, slugifyUrlSegment, stripLocalePrefix, } from './path.js';
24
+ export { CONTENT_FIELD_METADATA_KEY, CONTENT_REFERENCE_PREFIX, collectTopLevelReferenceFields, getContentFieldMetadata, getObjectShape, getReferenceDescriptor, getSchemaDef, getSchemaTypeName, unwrapSchema, type ContentFieldMetadata, type ContentFieldSchema, } from './schema.js';
25
+ export { parseMdcBody, type ParseMdcBodyOptions, type ParseMdcBodyResult, } from './mdc.js';
@@ -0,0 +1,37 @@
1
+ export {
2
+ CMS_CONTRACT_VERSION,
3
+ CmsContractSchemaUnsupportedError,
4
+ buildCmsContract
5
+ } from "./build.js";
6
+ export {
7
+ describeId,
8
+ generatePath,
9
+ generateCanonicalKey,
10
+ generateTitle,
11
+ isDraftPath,
12
+ isPartialPath,
13
+ longestMountForPath,
14
+ mountContentPath,
15
+ normalizeContentPath,
16
+ normalizeRouteMounts,
17
+ prefixPathWithLocale,
18
+ refineUrlPart,
19
+ routeRemainder,
20
+ routeToContentPathCandidates,
21
+ slugifyUrlSegment,
22
+ stripLocalePrefix
23
+ } from "./path.js";
24
+ export {
25
+ CONTENT_FIELD_METADATA_KEY,
26
+ CONTENT_REFERENCE_PREFIX,
27
+ collectTopLevelReferenceFields,
28
+ getContentFieldMetadata,
29
+ getObjectShape,
30
+ getReferenceDescriptor,
31
+ getSchemaDef,
32
+ getSchemaTypeName,
33
+ unwrapSchema
34
+ } from "./schema.js";
35
+ export {
36
+ parseMdcBody
37
+ } from "./mdc.js";
@@ -0,0 +1 @@
1
+ export * from './mdc.js'
@@ -0,0 +1,32 @@
1
+ /**
2
+ * parseMdcBody - single canonical MDC parser entry point for the CMS.
3
+ *
4
+ * The CMS used to fake a parsed MDC body at read-time by wrapping the raw
5
+ * markdown string in a paragraph element and regexing headings. That broke
6
+ * MDC components, links, tables, and any non-trivial markdown.
7
+ *
8
+ * Per Gate 0: parse once at publish time using ginko-content's real parser,
9
+ * store the AST on `publicEntries`, and have the public provider return the
10
+ * stored AST verbatim. The CMS imports this function from the pure subpath.
11
+ */
12
+ import type { MarkdownRoot, Toc } from '../types/content.js';
13
+ export interface ParseMdcBodyOptions {
14
+ /** Maximum heading depth captured into `toc`. Default 3. */
15
+ tocDepth?: number;
16
+ }
17
+ export interface ParseMdcBodyResult {
18
+ /** Normalized MDC AST root. The public provider serves this verbatim. */
19
+ body: MarkdownRoot;
20
+ /** Table-of-contents extracted from headings in the parsed AST (NOT regex). */
21
+ toc: Toc | undefined;
22
+ /** Plain text rendering of the body, for search indexing. */
23
+ searchText: string;
24
+ }
25
+ /**
26
+ * Parse a raw MDC string into a normalized AST + TOC + searchable plaintext.
27
+ *
28
+ * The function is async because comark's parser is async (frontmatter
29
+ * extraction, plugin pipeline). It is safe to call from a Convex mutation
30
+ * handler — the V8 isolate supports async/await.
31
+ */
32
+ export declare function parseMdcBody(raw: string, options?: ParseMdcBodyOptions): Promise<ParseMdcBodyResult>;