@axerity/cli 0.1.4 → 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 (339) hide show
  1. package/bin/axerity.js +67 -218
  2. package/dist/client/_app/immutable/assets/0.jCJXzoiy.css +1 -0
  3. package/dist/client/_app/immutable/assets/2.DZRzHaE1.css +1 -0
  4. package/dist/client/_app/immutable/assets/geist-cyrillic-ext-wght-normal.DjL33-gN.woff2 +0 -0
  5. package/dist/client/_app/immutable/assets/geist-cyrillic-wght-normal.BEAKL7Jp.woff2 +0 -0
  6. package/dist/client/_app/immutable/assets/geist-latin-ext-wght-normal.DC-KSUi6.woff2 +0 -0
  7. package/dist/client/_app/immutable/assets/geist-latin-wght-normal.BgDaEnEv.woff2 +0 -0
  8. package/dist/client/_app/immutable/assets/geist-mono-cyrillic-ext-wght-normal.I4S5GZfc.woff2 +0 -0
  9. package/dist/client/_app/immutable/assets/geist-mono-cyrillic-wght-normal.BmXc_FBt.woff2 +0 -0
  10. package/dist/client/_app/immutable/assets/geist-mono-latin-ext-wght-normal.DrnZ1wKl.woff2 +0 -0
  11. package/dist/client/_app/immutable/assets/geist-mono-latin-wght-normal.B_7UjwxQ.woff2 +0 -0
  12. package/dist/client/_app/immutable/assets/geist-mono-symbols2-wght-normal.GZpp1pK2.woff2 +0 -0
  13. package/dist/client/_app/immutable/assets/geist-mono-vietnamese-wght-normal.D8KDMBhC.woff2 +0 -0
  14. package/dist/client/_app/immutable/assets/geist-vietnamese-wght-normal.6IgcOCM7.woff2 +0 -0
  15. package/dist/client/_app/immutable/chunks/0CIKaoUA.js +139 -0
  16. package/dist/client/_app/immutable/chunks/0tC8Ubqr.js +2 -0
  17. package/dist/client/_app/immutable/chunks/29nvmPLe2.js +1 -0
  18. package/dist/client/_app/immutable/chunks/9IV9o0dV2.js +4 -0
  19. package/dist/client/_app/immutable/chunks/B-elEOLV.js +24 -0
  20. package/dist/client/_app/immutable/chunks/B1R9-4vu.js +89 -0
  21. package/dist/client/_app/immutable/chunks/B1eXHGII2.js +10 -0
  22. package/dist/client/_app/immutable/chunks/B2NKIbe62.js +206 -0
  23. package/dist/client/_app/immutable/chunks/B5Brrqz92.js +1 -0
  24. package/dist/client/_app/immutable/chunks/B6nymVS3.js +1 -0
  25. package/dist/client/_app/immutable/chunks/B8E5l9fg2.js +1 -0
  26. package/dist/client/_app/immutable/chunks/B8gBHxth2.js +1 -0
  27. package/dist/client/_app/immutable/chunks/BC8A8xkk.js +2 -0
  28. package/dist/client/_app/immutable/chunks/BGU5ZGjx.js +1 -0
  29. package/dist/client/_app/immutable/chunks/BLhBgXDr2.js +1 -0
  30. package/dist/client/_app/immutable/chunks/BNdlLOgu2.js +2 -0
  31. package/dist/client/_app/immutable/chunks/BQyPqLag.js +84 -0
  32. package/dist/client/_app/immutable/chunks/BRQspS80.js +162 -0
  33. package/dist/client/_app/immutable/chunks/BVz-DmJs2.js +132 -0
  34. package/dist/client/_app/immutable/chunks/BWPyau1x.js +1 -0
  35. package/dist/client/_app/immutable/chunks/BXD4L9Ly.js +9 -0
  36. package/dist/client/_app/immutable/chunks/B_Yg36qy2.js +1 -0
  37. package/dist/client/_app/immutable/chunks/BcuUc08l.js +292 -0
  38. package/dist/client/_app/immutable/chunks/BdsP84LY.js +231 -0
  39. package/dist/client/_app/immutable/chunks/Bie0X5s02.js +62 -0
  40. package/dist/client/_app/immutable/chunks/BifhSqXX.js +1 -0
  41. package/dist/client/_app/immutable/chunks/BjVjgMFk2.js +15 -0
  42. package/dist/client/_app/immutable/chunks/BpwmCo88.js +1 -0
  43. package/dist/client/_app/immutable/chunks/BxQVBtgJ.js +1 -0
  44. package/dist/client/_app/immutable/chunks/C2oEw9bf.js +34 -0
  45. package/dist/client/_app/immutable/chunks/C6Oj8XFW.js +1 -0
  46. package/dist/client/_app/immutable/chunks/C6v0vZRT2.js +36 -0
  47. package/dist/client/_app/immutable/chunks/C7H7uo1r.js +70 -0
  48. package/dist/client/_app/immutable/chunks/C8Fc0cco.js +1 -0
  49. package/dist/client/_app/immutable/chunks/CDfHwfr9.js +1 -0
  50. package/dist/client/_app/immutable/chunks/CEW3xh3M.js +124 -0
  51. package/dist/client/_app/immutable/chunks/CFNmf5NX.js +1 -0
  52. package/dist/client/_app/immutable/chunks/CGhzzHe4.js +1 -0
  53. package/dist/client/_app/immutable/chunks/CJMWL00f.js +1 -0
  54. package/dist/client/_app/immutable/chunks/CLrCY0qQ2.js +1 -0
  55. package/dist/client/_app/immutable/chunks/COu5VFF2.js +78 -0
  56. package/dist/client/_app/immutable/chunks/CSKSodPl2.js +1 -0
  57. package/dist/client/_app/immutable/chunks/CVNFCEpi.js +1 -0
  58. package/dist/client/_app/immutable/chunks/CWUJwgR2.js +1 -0
  59. package/dist/client/_app/immutable/chunks/CXC42hVj.js +70 -0
  60. package/dist/client/_app/immutable/chunks/CZqBFf11.js +30 -0
  61. package/dist/client/_app/immutable/chunks/CaWcga612.js +1 -0
  62. package/dist/client/_app/immutable/chunks/CcX7Oofq.js +1 -0
  63. package/dist/client/_app/immutable/chunks/Chn8RaCU2.js +1 -0
  64. package/dist/client/_app/immutable/chunks/CtmfIXf-.js +161 -0
  65. package/dist/client/_app/immutable/chunks/D0Co2O6p.js +7 -0
  66. package/dist/client/_app/immutable/chunks/D1O9pT8r.js +1 -0
  67. package/dist/client/_app/immutable/chunks/D1z0eUZA.js +3 -0
  68. package/dist/client/_app/immutable/chunks/D5KVydqU.js +1 -0
  69. package/dist/client/_app/immutable/chunks/D6jRqBbL.js +1 -0
  70. package/dist/client/_app/immutable/chunks/DDXR3Aw12.js +1 -0
  71. package/dist/client/_app/immutable/chunks/DG5yTEkY.js +1 -0
  72. package/dist/client/_app/immutable/chunks/DGHybmkM2.js +1 -0
  73. package/dist/client/_app/immutable/chunks/DITdNjTm.js +7 -0
  74. package/dist/client/_app/immutable/chunks/D_nZbl6c.js +162 -0
  75. package/dist/client/_app/immutable/chunks/Dg6QheNk.js +85 -0
  76. package/dist/client/_app/immutable/chunks/Dn1BfjD4.js +1 -0
  77. package/dist/client/_app/immutable/chunks/DpEnPnBc.js +1 -0
  78. package/dist/client/_app/immutable/chunks/Drl36yuV.js +40 -0
  79. package/dist/client/_app/immutable/chunks/ED9-GWAc2.js +10 -0
  80. package/dist/client/_app/immutable/chunks/FqbQrHcz2.js +321 -0
  81. package/dist/client/_app/immutable/chunks/PLsDE8Xa.js +24 -0
  82. package/dist/client/_app/immutable/chunks/PwGqCEPd.js +106 -0
  83. package/dist/client/_app/immutable/chunks/QmWylQL4.js +96 -0
  84. package/dist/client/_app/immutable/chunks/SbORYBuH.js +1 -0
  85. package/dist/client/_app/immutable/chunks/Vhh-h91d.js +257 -0
  86. package/dist/client/_app/immutable/chunks/Y3d8lUBM.js +120 -0
  87. package/dist/client/_app/immutable/chunks/aheLp5ES.js +32 -0
  88. package/dist/client/_app/immutable/chunks/dcFrWhgf.js +1 -0
  89. package/dist/client/_app/immutable/chunks/dqbyyLvi2.js +10 -0
  90. package/dist/client/_app/immutable/chunks/hFfQmBrk2.js +1 -0
  91. package/dist/client/_app/immutable/chunks/m89wIWMZ.js +1 -0
  92. package/dist/client/_app/immutable/chunks/mktnrgVa.js +1 -0
  93. package/dist/client/_app/immutable/chunks/qD2cSsUD2.js +1 -0
  94. package/dist/client/_app/immutable/chunks/v-V-aVm52.js +43 -0
  95. package/dist/client/_app/immutable/chunks/v97jXyQK.js +3 -0
  96. package/dist/client/_app/immutable/chunks/wCc4pE4l.js +3 -0
  97. package/dist/client/_app/immutable/chunks/xihTtKlq.js +1 -0
  98. package/dist/client/_app/immutable/entry/app.BxBJhrll.js +2 -0
  99. package/dist/client/_app/immutable/entry/start.mAPciu1x.js +1 -0
  100. package/dist/client/_app/immutable/nodes/0.C7MOOY8s.js +1 -0
  101. package/dist/client/_app/immutable/nodes/1.C1SZKZS6.js +1 -0
  102. package/dist/client/_app/immutable/nodes/2.C9w6NQmI.js +28 -0
  103. package/dist/client/_app/version.json +1 -0
  104. package/dist/env.js +94 -0
  105. package/dist/handler.js +1494 -0
  106. package/dist/index.js +345 -0
  107. package/dist/server/chunks/0-lMxIppsX.js +40 -0
  108. package/dist/server/chunks/0-lMxIppsX.js.map +1 -0
  109. package/dist/server/chunks/1-CyLqCHnY.js +9 -0
  110. package/dist/server/chunks/1-CyLqCHnY.js.map +1 -0
  111. package/dist/server/chunks/2-B-CcMKoh.js +54 -0
  112. package/dist/server/chunks/2-B-CcMKoh.js.map +1 -0
  113. package/dist/server/chunks/Icon-B5VFrlh0.js +186 -0
  114. package/dist/server/chunks/Icon-B5VFrlh0.js.map +1 -0
  115. package/dist/server/chunks/_error.svelte-COifK9P1.js +48 -0
  116. package/dist/server/chunks/_error.svelte-COifK9P1.js.map +1 -0
  117. package/dist/server/chunks/_layout.svelte-DTQwWfEr.js +31 -0
  118. package/dist/server/chunks/_layout.svelte-DTQwWfEr.js.map +1 -0
  119. package/dist/server/chunks/_page.svelte-gMTRy91w.js +2206 -0
  120. package/dist/server/chunks/_page.svelte-gMTRy91w.js.map +1 -0
  121. package/dist/server/chunks/_server.ts-BBt3KS4Z.js +32 -0
  122. package/dist/server/chunks/_server.ts-BBt3KS4Z.js.map +1 -0
  123. package/dist/server/chunks/_server.ts-BaIDzhzq.js +26 -0
  124. package/dist/server/chunks/_server.ts-BaIDzhzq.js.map +1 -0
  125. package/dist/server/chunks/_server.ts-BtzVXaCw.js +29 -0
  126. package/dist/server/chunks/_server.ts-BtzVXaCw.js.map +1 -0
  127. package/dist/server/chunks/_server.ts-BuKSyj8m.js +37 -0
  128. package/dist/server/chunks/_server.ts-BuKSyj8m.js.map +1 -0
  129. package/dist/server/chunks/_server.ts-Cfw-nQ4-.js +31 -0
  130. package/dist/server/chunks/_server.ts-Cfw-nQ4-.js.map +1 -0
  131. package/dist/server/chunks/_server.ts-DlaxEvWB.js +53 -0
  132. package/dist/server/chunks/_server.ts-DlaxEvWB.js.map +1 -0
  133. package/dist/server/chunks/_server.ts-DnjaLdrg.js +195 -0
  134. package/dist/server/chunks/_server.ts-DnjaLdrg.js.map +1 -0
  135. package/dist/server/chunks/_server.ts-T58MO2wL.js +41 -0
  136. package/dist/server/chunks/_server.ts-T58MO2wL.js.map +1 -0
  137. package/dist/server/chunks/content-store-DPJsj8gD.js +5252 -0
  138. package/dist/server/chunks/content-store-DPJsj8gD.js.map +1 -0
  139. package/dist/server/chunks/docpage-BkHysAhp.js +5 -0
  140. package/dist/server/chunks/docpage-BkHysAhp.js.map +1 -0
  141. package/dist/server/chunks/exports-ZnEJ4gG9.js +758 -0
  142. package/dist/server/chunks/exports-ZnEJ4gG9.js.map +1 -0
  143. package/dist/server/chunks/hooks.server-nz527EC9.js +42 -0
  144. package/dist/server/chunks/hooks.server-nz527EC9.js.map +1 -0
  145. package/dist/server/chunks/internal-CvDbuC7W.js +5374 -0
  146. package/dist/server/chunks/internal-CvDbuC7W.js.map +1 -0
  147. package/dist/server/chunks/mdfile-DBiwGtNY.js +5 -0
  148. package/dist/server/chunks/mdfile-DBiwGtNY.js.map +1 -0
  149. package/dist/server/chunks/site-BfALkgJ-.js +52 -0
  150. package/dist/server/chunks/site-BfALkgJ-.js.map +1 -0
  151. package/dist/server/index.js +4356 -0
  152. package/dist/server/index.js.map +1 -0
  153. package/dist/server/manifest.js +103 -0
  154. package/dist/server/manifest.js.map +1 -0
  155. package/dist/shims.js +32 -0
  156. package/package.json +24 -16
  157. package/runtime/crawl.js +48 -0
  158. package/runtime/preview.js +42 -0
  159. package/runtime/serve.js +69 -0
  160. package/mdsvex.config.js +0 -261
  161. package/scripts/prepare-engine.mjs +0 -20
  162. package/src/app.d.ts +0 -17
  163. package/src/app.html +0 -39
  164. package/src/content/demo/api/meta.json +0 -5
  165. package/src/content/demo/api/pet/add-pet.md +0 -105
  166. package/src/content/demo/api/pet/delete-pet.md +0 -70
  167. package/src/content/demo/api/pet/find-by-status.md +0 -72
  168. package/src/content/demo/api/pet/find-by-tags.md +0 -64
  169. package/src/content/demo/api/pet/get-pet.md +0 -99
  170. package/src/content/demo/api/pet/meta.json +0 -15
  171. package/src/content/demo/api/pet/pet-object.md +0 -112
  172. package/src/content/demo/api/pet/update-pet-with-form.md +0 -69
  173. package/src/content/demo/api/pet/update-pet.md +0 -79
  174. package/src/content/demo/api/pet/upload-image.md +0 -79
  175. package/src/content/demo/api/store/delete-order.md +0 -62
  176. package/src/content/demo/api/store/get-order.md +0 -70
  177. package/src/content/demo/api/store/inventory.md +0 -54
  178. package/src/content/demo/api/store/meta.json +0 -5
  179. package/src/content/demo/api/store/order-object.md +0 -77
  180. package/src/content/demo/api/store/place-order.md +0 -83
  181. package/src/content/demo/api/user/create-user.md +0 -69
  182. package/src/content/demo/api/user/create-with-list.md +0 -57
  183. package/src/content/demo/api/user/delete-user.md +0 -61
  184. package/src/content/demo/api/user/get-user.md +0 -69
  185. package/src/content/demo/api/user/login.md +0 -80
  186. package/src/content/demo/api/user/logout.md +0 -45
  187. package/src/content/demo/api/user/meta.json +0 -14
  188. package/src/content/demo/api/user/update-user.md +0 -69
  189. package/src/content/demo/api/user/user-object.md +0 -85
  190. package/src/content/demo/changelog.md +0 -44
  191. package/src/content/demo/components/accordion.md +0 -70
  192. package/src/content/demo/components/api.md +0 -185
  193. package/src/content/demo/components/badge.md +0 -34
  194. package/src/content/demo/components/callout.md +0 -83
  195. package/src/content/demo/components/cards.md +0 -88
  196. package/src/content/demo/components/code-group.md +0 -55
  197. package/src/content/demo/components/columns.md +0 -42
  198. package/src/content/demo/components/frame.md +0 -51
  199. package/src/content/demo/components/icon.md +0 -54
  200. package/src/content/demo/components/kbd.md +0 -28
  201. package/src/content/demo/components/meta.json +0 -26
  202. package/src/content/demo/components/roadmap.md +0 -86
  203. package/src/content/demo/components/steps.md +0 -72
  204. package/src/content/demo/components/tabs.md +0 -146
  205. package/src/content/demo/components/tooltip.md +0 -44
  206. package/src/content/demo/components/tree.md +0 -83
  207. package/src/content/demo/components/type-table.md +0 -77
  208. package/src/content/demo/components/update.md +0 -48
  209. package/src/content/demo/components/video.md +0 -56
  210. package/src/content/demo/components/webhooks.md +0 -109
  211. package/src/content/demo/components/websockets.md +0 -101
  212. package/src/content/demo/configuration/ai.md +0 -40
  213. package/src/content/demo/configuration/cli.md +0 -48
  214. package/src/content/demo/configuration/deployment.md +0 -105
  215. package/src/content/demo/configuration/index.md +0 -92
  216. package/src/content/demo/configuration/layouts.md +0 -51
  217. package/src/content/demo/configuration/meta.json +0 -5
  218. package/src/content/demo/configuration/navigation.md +0 -167
  219. package/src/content/demo/configuration/openapi.md +0 -103
  220. package/src/content/demo/configuration/search.md +0 -36
  221. package/src/content/demo/index.md +0 -59
  222. package/src/content/demo/installation.md +0 -66
  223. package/src/content/demo/meta.json +0 -15
  224. package/src/content/demo/quick-start.md +0 -47
  225. package/src/content/demo/theming/advanced.md +0 -116
  226. package/src/content/demo/theming/code.md +0 -66
  227. package/src/content/demo/theming/colors.md +0 -103
  228. package/src/content/demo/theming/index.md +0 -88
  229. package/src/content/demo/theming/layout.md +0 -71
  230. package/src/content/demo/theming/meta.json +0 -5
  231. package/src/content/demo/theming/themes.md +0 -99
  232. package/src/content/demo/theming/typography.md +0 -83
  233. package/src/content/demo/writing/code-blocks.md +0 -154
  234. package/src/content/demo/writing/diagrams.md +0 -44
  235. package/src/content/demo/writing/frontmatter.md +0 -33
  236. package/src/content/demo/writing/markdown.md +0 -62
  237. package/src/content/demo/writing/meta.json +0 -5
  238. package/src/hooks.server.ts +0 -49
  239. package/src/lib/assets/favicon.svg +0 -1
  240. package/src/lib/base.ts +0 -12
  241. package/src/lib/components/DynamicIcon.svelte +0 -41
  242. package/src/lib/components/docs/Analytics.svelte +0 -38
  243. package/src/lib/components/docs/Banner.svelte +0 -44
  244. package/src/lib/components/docs/Breadcrumbs.svelte +0 -38
  245. package/src/lib/components/docs/CopyPageMenu.svelte +0 -119
  246. package/src/lib/components/docs/DocsLayout.svelte +0 -192
  247. package/src/lib/components/docs/Footer.svelte +0 -60
  248. package/src/lib/components/docs/Mermaid.svelte +0 -39
  249. package/src/lib/components/docs/Navbar.svelte +0 -144
  250. package/src/lib/components/docs/PageMeta.svelte +0 -35
  251. package/src/lib/components/docs/PageNav.svelte +0 -44
  252. package/src/lib/components/docs/SearchDialog.svelte +0 -182
  253. package/src/lib/components/docs/Sidebar.svelte +0 -85
  254. package/src/lib/components/docs/SidebarDropdown.svelte +0 -56
  255. package/src/lib/components/docs/SidebarFooterLinks.svelte +0 -19
  256. package/src/lib/components/docs/SidebarGroup.svelte +0 -54
  257. package/src/lib/components/docs/SidebarLink.svelte +0 -67
  258. package/src/lib/components/docs/TableOfContents.svelte +0 -77
  259. package/src/lib/components/docs/ThemeToggle.svelte +0 -19
  260. package/src/lib/components/docs/VersionSwitcher.svelte +0 -80
  261. package/src/lib/components/kit/Accordion.svelte +0 -60
  262. package/src/lib/components/kit/AccordionGroup.svelte +0 -13
  263. package/src/lib/components/kit/Badge.svelte +0 -32
  264. package/src/lib/components/kit/Callout.svelte +0 -51
  265. package/src/lib/components/kit/Card.svelte +0 -72
  266. package/src/lib/components/kit/CardGroup.svelte +0 -21
  267. package/src/lib/components/kit/CodeGroup.svelte +0 -65
  268. package/src/lib/components/kit/Columns.svelte +0 -26
  269. package/src/lib/components/kit/Event.svelte +0 -23
  270. package/src/lib/components/kit/EventList.svelte +0 -9
  271. package/src/lib/components/kit/File.svelte +0 -15
  272. package/src/lib/components/kit/Folder.svelte +0 -46
  273. package/src/lib/components/kit/Frame.svelte +0 -81
  274. package/src/lib/components/kit/Icon.svelte +0 -17
  275. package/src/lib/components/kit/Kbd.svelte +0 -11
  276. package/src/lib/components/kit/Roadmap.svelte +0 -15
  277. package/src/lib/components/kit/RoadmapItem.svelte +0 -109
  278. package/src/lib/components/kit/Step.svelte +0 -63
  279. package/src/lib/components/kit/Steps.svelte +0 -16
  280. package/src/lib/components/kit/Tab.svelte +0 -27
  281. package/src/lib/components/kit/Tabs.svelte +0 -75
  282. package/src/lib/components/kit/Tooltip.svelte +0 -33
  283. package/src/lib/components/kit/Tree.svelte +0 -11
  284. package/src/lib/components/kit/TypeTable.svelte +0 -187
  285. package/src/lib/components/kit/Update.svelte +0 -32
  286. package/src/lib/components/kit/Video.svelte +0 -64
  287. package/src/lib/components/kit/accordion-context.ts +0 -1
  288. package/src/lib/components/kit/api/Api.svelte +0 -80
  289. package/src/lib/components/kit/api/ApiExamplePanel.svelte +0 -100
  290. package/src/lib/components/kit/api/ApiField.svelte +0 -124
  291. package/src/lib/components/kit/api/Channel.svelte +0 -121
  292. package/src/lib/components/kit/api/Endpoint.svelte +0 -116
  293. package/src/lib/components/kit/api/Enum.svelte +0 -44
  294. package/src/lib/components/kit/api/EnumValues.svelte +0 -35
  295. package/src/lib/components/kit/api/Expandable.svelte +0 -70
  296. package/src/lib/components/kit/api/Message.svelte +0 -67
  297. package/src/lib/components/kit/api/ObjectExample.svelte +0 -11
  298. package/src/lib/components/kit/api/RequestExample.svelte +0 -11
  299. package/src/lib/components/kit/api/ResponseExample.svelte +0 -11
  300. package/src/lib/components/kit/api/Webhook.svelte +0 -115
  301. package/src/lib/components/kit/api/api-context.ts +0 -15
  302. package/src/lib/components/kit/tabs-context.ts +0 -8
  303. package/src/lib/components/kit/tabs-store.svelte.ts +0 -28
  304. package/src/lib/config/site.ts +0 -34
  305. package/src/lib/content/index.ts +0 -50
  306. package/src/lib/content/raw.ts +0 -21
  307. package/src/lib/content/tree.ts +0 -169
  308. package/src/lib/index.ts +0 -79
  309. package/src/lib/nav-match.ts +0 -23
  310. package/src/lib/openapi/generate.ts +0 -629
  311. package/src/lib/server/og.ts +0 -140
  312. package/src/lib/state/search.svelte.ts +0 -9
  313. package/src/lib/state/theme.svelte.ts +0 -58
  314. package/src/lib/types.ts +0 -216
  315. package/src/params/docpage.ts +0 -3
  316. package/src/params/mdfile.ts +0 -3
  317. package/src/routes/+error.svelte +0 -46
  318. package/src/routes/+layout.svelte +0 -25
  319. package/src/routes/[...path=mdfile]/+server.ts +0 -21
  320. package/src/routes/[...slug=docpage]/+page.svelte +0 -63
  321. package/src/routes/[...slug=docpage]/+page.ts +0 -44
  322. package/src/routes/layout.css +0 -897
  323. package/src/routes/llms-full.txt/+server.ts +0 -22
  324. package/src/routes/llms.txt/+server.ts +0 -20
  325. package/src/routes/og/[...slug]/+server.ts +0 -77
  326. package/src/routes/rss.xml/+server.ts +0 -65
  327. package/src/routes/search.json/+server.ts +0 -54
  328. package/src/routes/sitemap.xml/+server.ts +0 -21
  329. package/svelte.config.js +0 -35
  330. package/tsconfig.json +0 -20
  331. package/vite.config.ts +0 -67
  332. /package/{static → dist/client}/favicon-dark.svg +0 -0
  333. /package/{static → dist/client}/favicon-light.svg +0 -0
  334. /package/{static → dist/client}/favicon.svg +0 -0
  335. /package/{static → dist/client}/fonts/geist-400.ttf +0 -0
  336. /package/{static → dist/client}/fonts/geist-600.ttf +0 -0
  337. /package/{static → dist/client}/fonts/geist-700.ttf +0 -0
  338. /package/{static → dist/client}/og-image.png +0 -0
  339. /package/{static → dist/client}/robots.txt +0 -0
@@ -1,629 +0,0 @@
1
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2
- import { dirname, join } from 'node:path';
3
- import { parse as parseYaml } from 'yaml';
4
-
5
- interface ApiSource {
6
- spec: string;
7
- output?: string;
8
- title?: string;
9
- }
10
-
11
- interface Schema {
12
- $ref?: string;
13
- type?: string | string[];
14
- format?: string;
15
- enum?: unknown[];
16
- default?: unknown;
17
- example?: unknown;
18
- description?: string;
19
- deprecated?: boolean;
20
- readOnly?: boolean;
21
- writeOnly?: boolean;
22
- nullable?: boolean;
23
- required?: string[];
24
- items?: Schema;
25
- properties?: Record<string, Schema>;
26
- allOf?: Schema[];
27
- oneOf?: Schema[];
28
- anyOf?: Schema[];
29
- minLength?: number;
30
- maxLength?: number;
31
- minimum?: number;
32
- maximum?: number;
33
- pattern?: string;
34
- }
35
-
36
- interface MediaType {
37
- schema?: Schema;
38
- example?: unknown;
39
- examples?: Record<string, { value?: unknown }>;
40
- }
41
-
42
- interface Parameter {
43
- $ref?: string;
44
- name: string;
45
- in: string;
46
- required?: boolean;
47
- deprecated?: boolean;
48
- description?: string;
49
- schema?: Schema;
50
- }
51
-
52
- interface Header {
53
- schema?: Schema;
54
- description?: string;
55
- required?: boolean;
56
- }
57
-
58
- interface Body {
59
- $ref?: string;
60
- description?: string;
61
- content?: Record<string, MediaType>;
62
- headers?: Record<string, Header>;
63
- }
64
-
65
- type SecurityRequirement = Record<string, string[]>;
66
-
67
- interface Operation {
68
- tags?: string[];
69
- summary?: string;
70
- description?: string;
71
- operationId?: string;
72
- deprecated?: boolean;
73
- parameters?: Parameter[];
74
- requestBody?: Body;
75
- responses?: Record<string, Body>;
76
- security?: SecurityRequirement[];
77
- servers?: { url: string }[];
78
- }
79
-
80
- interface PathItem {
81
- servers?: { url: string }[];
82
- parameters?: Parameter[];
83
- get?: Operation;
84
- post?: Operation;
85
- put?: Operation;
86
- patch?: Operation;
87
- delete?: Operation;
88
- }
89
-
90
- interface SecurityScheme {
91
- type?: string;
92
- name?: string;
93
- in?: string;
94
- scheme?: string;
95
- bearerFormat?: string;
96
- description?: string;
97
- flows?: Record<string, { scopes?: Record<string, string> }>;
98
- openIdConnectUrl?: string;
99
- }
100
-
101
- interface Spec {
102
- info?: { title?: string };
103
- servers?: { url: string }[];
104
- tags?: { name: string }[];
105
- security?: SecurityRequirement[];
106
- paths?: Record<string, PathItem>;
107
- webhooks?: Record<string, PathItem>;
108
- components?: {
109
- schemas?: Record<string, Schema>;
110
- securitySchemes?: Record<string, SecurityScheme>;
111
- };
112
- [key: string]: unknown;
113
- }
114
-
115
- const METHODS = ['get', 'post', 'put', 'patch', 'delete'] as const;
116
- const METHOD_ICON: Record<string, string> = {
117
- get: 'arrow-down-to-line',
118
- post: 'plus',
119
- put: 'pencil',
120
- patch: 'pencil',
121
- delete: 'trash-2'
122
- };
123
-
124
- const isObject = (value: unknown): value is Record<string, unknown> =>
125
- typeof value === 'object' && value !== null;
126
-
127
- // Escape characters Svelte would otherwise read as markup/expressions in the
128
- // Markdown body (outside code blocks, which mdsvex already escapes).
129
- const escapeText = (text: string): string =>
130
- text.replace(/[<{}]/g, (c) => ({ '<': '&lt;', '{': '&#123;', '}': '&#125;' })[c] ?? c);
131
-
132
- function slugify(value: string): string {
133
- return value
134
- .replace(/\{[^}]+\}/g, (m) => m.slice(1, -1))
135
- .replace(/[^a-zA-Z0-9]+/g, '-')
136
- .replace(/^-+|-+$/g, '')
137
- .toLowerCase();
138
- }
139
-
140
- const refName = (ref: string): string => ref.slice(ref.lastIndexOf('/') + 1);
141
-
142
- function resolve<T>(spec: Spec, node: T): T {
143
- let current: unknown = node;
144
- const seen = new Set<string>();
145
- while (isObject(current) && typeof current.$ref === 'string' && !seen.has(current.$ref)) {
146
- seen.add(current.$ref);
147
- const parts = current.$ref.replace(/^#\//, '').split('/');
148
- current = parts.reduce<unknown>((acc, key) => (isObject(acc) ? acc[key] : undefined), spec);
149
- }
150
- return (current ?? {}) as T;
151
- }
152
-
153
- // Merge `allOf` into a single object schema; keep oneOf/anyOf for labelling.
154
- function composed(spec: Spec, schema: Schema): Schema {
155
- const s = resolve(spec, schema);
156
- if (!s.allOf) return s;
157
- const merged: Schema = { type: 'object', properties: {}, required: [] };
158
- for (const part of [...s.allOf, s]) {
159
- const r = resolve(spec, part);
160
- Object.assign(merged.properties!, r.properties);
161
- if (r.required) merged.required!.push(...r.required);
162
- }
163
- return merged;
164
- }
165
-
166
- const baseType = (type?: string | string[]): string | undefined =>
167
- Array.isArray(type) ? type.find((t) => t !== 'null') : type;
168
-
169
- function typeLabel(spec: Spec, schema?: Schema): string {
170
- if (!schema) return 'any';
171
- if (schema.$ref) return refName(schema.$ref);
172
- if (schema.oneOf || schema.anyOf) {
173
- const variants = (schema.oneOf ?? schema.anyOf)!.map((v) => typeLabel(spec, v));
174
- return [...new Set(variants)].join(' or ');
175
- }
176
- if (schema.enum) return 'enum';
177
- const type = baseType(schema.type);
178
- if (type === 'array') {
179
- const items = schema.items?.$ref ? refName(schema.items.$ref) : typeLabel(spec, schema.items);
180
- return `array of ${items}`;
181
- }
182
- return schema.format ?? type ?? 'object';
183
- }
184
-
185
- function describe(schema: Schema): string {
186
- const lines: string[] = [];
187
- if (schema.description) lines.push(schema.description);
188
- const notes: string[] = [];
189
- if (schema.enum) notes.push(`one of ${schema.enum.map((v) => `\`${v}\``).join(', ')}`);
190
- if (schema.format && !schema.description?.includes(schema.format))
191
- notes.push(`format \`${schema.format}\``);
192
- if (schema.pattern) notes.push(`pattern \`${schema.pattern}\``);
193
- if (schema.minLength !== undefined || schema.maxLength !== undefined) {
194
- notes.push(`length ${schema.minLength ?? 0}–${schema.maxLength ?? '∞'}`);
195
- }
196
- if (schema.minimum !== undefined || schema.maximum !== undefined) {
197
- notes.push(`range ${schema.minimum ?? '−∞'}–${schema.maximum ?? '∞'}`);
198
- }
199
- if (schema.default !== undefined && typeof schema.default !== 'object') {
200
- notes.push(`defaults to \`${schema.default}\``);
201
- }
202
- if (schema.readOnly) notes.push('read-only');
203
- if (schema.writeOnly) notes.push('write-only');
204
- if (schema.deprecated) notes.push('deprecated');
205
- if (notes.length) lines.push(`(${notes.join(', ')})`);
206
- return lines.join(' ');
207
- }
208
-
209
- function attrs(spec: Spec, name: string, schema: Schema, required?: boolean): string {
210
- const parts = [`name="${name}"`, `type="${typeLabel(spec, schema)}"`];
211
- if (required) parts.push('required');
212
- if (schema.deprecated) parts.push('deprecated');
213
- if (schema.default !== undefined && typeof schema.default !== 'object') {
214
- parts.push(`default="${String(schema.default).replace(/"/g, '&quot;')}"`);
215
- }
216
- return parts.join(' ');
217
- }
218
-
219
- // Render a property list. Inline nested objects/arrays expand inline; $ref types
220
- // link to their generated schema page.
221
- function fields(spec: Spec, schema: Schema, group: string, component: string, depth = 0): string {
222
- const resolved = composed(spec, schema);
223
- const props = resolved.properties ?? {};
224
- const required = new Set(resolved.required ?? []);
225
- const out: string[] = [];
226
- for (const [name, raw] of Object.entries(props)) {
227
- const isRef = typeof raw.$ref === 'string';
228
- const prop = composed(spec, raw);
229
- const link = isRef ? ` typeLink="/${group}/schemas/${slugify(refName(raw.$ref!))}"` : '';
230
- const labelSchema = isRef ? ({ $ref: raw.$ref } as Schema) : prop;
231
- out.push(`<${component} ${attrs(spec, name, labelSchema, required.has(name))}${link}>`, '');
232
- out.push(escapeText(describe(prop)) || 'No description.', '');
233
-
234
- const inlineObject = !isRef && (baseType(prop.type) === 'object' || prop.properties);
235
- const arrayItem =
236
- !isRef && baseType(prop.type) === 'array' ? composed(spec, prop.items ?? {}) : null;
237
- if (inlineObject && depth < 3) {
238
- out.push(
239
- '<Expandable title="properties">',
240
- '',
241
- fields(spec, prop, group, component, depth + 1),
242
- '</Expandable>',
243
- ''
244
- );
245
- } else if (arrayItem && arrayItem.properties && !prop.items?.$ref && depth < 3) {
246
- out.push(
247
- '<Expandable title="items">',
248
- '',
249
- fields(spec, arrayItem, group, component, depth + 1),
250
- '</Expandable>',
251
- ''
252
- );
253
- }
254
- out.push(`</${component}>`, '');
255
- }
256
- return out.join('\n');
257
- }
258
-
259
- function sample(spec: Spec, schema: Schema | undefined, depth = 0): unknown {
260
- const s = composed(spec, schema ?? {});
261
- if (depth > 5) return null;
262
- if (s.example !== undefined) return s.example;
263
- if (s.default !== undefined) return s.default;
264
- if (s.enum) return s.enum[0];
265
- if (s.oneOf || s.anyOf) return sample(spec, (s.oneOf ?? s.anyOf)![0], depth + 1);
266
- const type = baseType(s.type);
267
- if (type === 'array') return [sample(spec, s.items, depth + 1)].filter((v) => v !== null);
268
- if (type === 'object' || s.properties) {
269
- const obj: Record<string, unknown> = {};
270
- for (const [name, prop] of Object.entries(s.properties ?? {}))
271
- obj[name] = sample(spec, prop, depth + 1);
272
- return obj;
273
- }
274
- if (type === 'integer' || type === 'number') return 0;
275
- if (type === 'boolean') return true;
276
- if (s.format === 'date-time') return '2024-01-01T00:00:00Z';
277
- return type === 'string' ? 'string' : null;
278
- }
279
-
280
- function pickMedia(spec: Spec, body?: Body): MediaType | undefined {
281
- const content = resolve(spec, body ?? {}).content;
282
- if (!content) return undefined;
283
- return content['application/json'] ?? content[Object.keys(content)[0]];
284
- }
285
-
286
- function bodyExample(spec: Spec, media?: MediaType): unknown {
287
- if (!media) return undefined;
288
- if (media.example !== undefined) return media.example;
289
- const named = media.examples && Object.values(media.examples)[0];
290
- if (named && named.value !== undefined) return named.value;
291
- return media.schema ? sample(spec, media.schema) : undefined;
292
- }
293
-
294
- const yamlLine = (text: string): string => JSON.stringify(text.split('\n')[0]);
295
-
296
- const SCRIPT_IMPORT =
297
- "\timport { Api, Endpoint, ParamField, ResponseField, RequestExample, ResponseExample, ObjectExample, Expandable } from '$lib';";
298
-
299
- interface Page {
300
- tag: string;
301
- slug: string;
302
- body: string;
303
- }
304
-
305
- function frontmatter(title: string, description: string, method: string, icon: string): string[] {
306
- return [
307
- '---',
308
- `title: ${yamlLine(title)}`,
309
- ...(description ? [`description: ${yamlLine(description)}`] : []),
310
- 'layout: api',
311
- ...(method ? [`method: ${method}`] : []),
312
- `icon: ${icon}`,
313
- '---',
314
- '',
315
- '<script>',
316
- SCRIPT_IMPORT,
317
- '</script>',
318
- ''
319
- ];
320
- }
321
-
322
- function describeScheme(name: string, scheme: SecurityScheme, scopes: string[]): string {
323
- if (scheme.type === 'http' && scheme.scheme === 'bearer') {
324
- return `a bearer token${scheme.bearerFormat ? ` (${scheme.bearerFormat})` : ''}`;
325
- }
326
- if (scheme.type === 'http' && scheme.scheme === 'basic') return 'HTTP basic auth';
327
- if (scheme.type === 'apiKey') return `an API key in the ${scheme.in} \`${scheme.name}\``;
328
- if (scheme.type === 'oauth2') {
329
- const flowScopes = Object.keys(Object.values(scheme.flows ?? {})[0]?.scopes ?? {});
330
- const all = scopes.length ? scopes : flowScopes;
331
- return `OAuth2${all.length ? ` (scopes ${all.map((s) => `\`${s}\``).join(', ')})` : ''}`;
332
- }
333
- if (scheme.type === 'openIdConnect') return 'OpenID Connect';
334
- return name;
335
- }
336
-
337
- function authLines(spec: Spec, op: Operation): string[] {
338
- const reqs = op.security ?? spec.security;
339
- if (!reqs?.length) return [];
340
- const schemes = spec.components?.securitySchemes ?? {};
341
- const alternatives = reqs
342
- .filter((r) => Object.keys(r).length)
343
- .map((r) =>
344
- Object.entries(r)
345
- .map(([n, scopes]) => (schemes[n] ? describeScheme(n, schemes[n], scopes) : n))
346
- .join(' and ')
347
- );
348
- if (!alternatives.length) return [];
349
- const optional = reqs.some((r) => Object.keys(r).length === 0);
350
- const text = `Requires ${alternatives.join(' or ')}.${optional ? ' Authentication is optional.' : ''}`;
351
- return ['## Authentication', '', escapeText(text), ''];
352
- }
353
-
354
- function operationPage(
355
- spec: Spec,
356
- specBaseUrl: string,
357
- group: string,
358
- path: string,
359
- method: string,
360
- op: Operation,
361
- pathItem?: PathItem,
362
- defaultTag = 'default'
363
- ): Page {
364
- const tag = slugify(op.tags?.[0] ?? defaultTag);
365
- const title = op.summary ?? op.operationId ?? `${method.toUpperCase()} ${path}`;
366
- const description = op.description ?? op.summary ?? '';
367
- const pathExpr = path.includes('{') ? `path={'${path}'}` : `path="${path}"`;
368
- const baseUrl = op.servers?.[0]?.url ?? pathItem?.servers?.[0]?.url ?? specBaseUrl;
369
-
370
- const lines: string[] = [
371
- ...frontmatter(title, description, method.toUpperCase(), METHOD_ICON[method] ?? 'code'),
372
- `# ${escapeText(title)}`,
373
- '',
374
- ...(op.deprecated ? ['> This operation is deprecated.', ''] : []),
375
- ...(description ? [escapeText(description), ''] : []),
376
- '<Api>',
377
- '',
378
- `<Endpoint method="${method.toUpperCase()}" ${pathExpr} baseUrl="${baseUrl}" />`,
379
- ''
380
- ];
381
-
382
- lines.push(...authLines(spec, op));
383
-
384
- // Path-level params are shared across operations; the operation's own win.
385
- const paramMap = new Map<string, Parameter>();
386
- for (const p of [...(pathItem?.parameters ?? []), ...(op.parameters ?? [])].map((x) =>
387
- resolve(spec, x)
388
- )) {
389
- paramMap.set(`${p.in}:${p.name}`, p);
390
- }
391
- const params = [...paramMap.values()];
392
- const groups: Record<string, string> = {
393
- path: 'Path parameters',
394
- query: 'Query parameters',
395
- header: 'Header parameters',
396
- cookie: 'Cookie parameters'
397
- };
398
- for (const where of Object.keys(groups)) {
399
- const list = params.filter((p) => p.in === where);
400
- if (!list.length) continue;
401
- lines.push(`## ${groups[where]}`, '');
402
- for (const p of list) {
403
- lines.push(`<ParamField ${attrs(spec, p.name, p.schema ?? {}, p.required)}>`, '');
404
- lines.push(
405
- escapeText(describe(p.schema ?? {}) || p.description || '') || 'No description.',
406
- ''
407
- );
408
- lines.push('</ParamField>', '');
409
- }
410
- }
411
-
412
- const reqContent = resolve(spec, op.requestBody ?? {}).content ?? {};
413
- const reqTypes = Object.keys(reqContent);
414
- const reqKey = reqContent['application/json'] ? 'application/json' : reqTypes[0];
415
- const reqMedia = reqKey ? reqContent[reqKey] : undefined;
416
- if (reqMedia?.schema) {
417
- lines.push('## Body parameters', '');
418
- if (reqTypes.length > 1) {
419
- lines.push(`Accepts ${reqTypes.map((t) => `\`${t}\``).join(', ')}.`, '');
420
- }
421
- lines.push(fields(spec, reqMedia.schema, group, 'ParamField'));
422
- }
423
-
424
- const reqExample = bodyExample(spec, reqMedia);
425
- const curl = [
426
- `curl -X ${method.toUpperCase()} ${baseUrl}${path.replace(/\{([^}]+)\}/g, ':$1')}`,
427
- reqExample !== undefined
428
- ? ` -H "Content-Type: ${reqKey}" \\\n -d '${JSON.stringify(reqExample)}'`
429
- : ''
430
- ]
431
- .filter(Boolean)
432
- .join(' \\\n');
433
- lines.push(
434
- '<RequestExample title="cURL">',
435
- '',
436
- '```bash',
437
- curl,
438
- '```',
439
- '',
440
- '</RequestExample>',
441
- ''
442
- );
443
-
444
- const responses = Object.entries(op.responses ?? {}).sort(([a], [b]) => a.localeCompare(b));
445
- for (const [code, raw] of responses) {
446
- const response = resolve(spec, raw);
447
- const media = pickMedia(spec, response);
448
- lines.push(`## Response \`${code}\``, '');
449
- if (response.description) lines.push(escapeText(response.description), '');
450
- if (response.headers) {
451
- lines.push('Headers:', '');
452
- for (const [hname, hraw] of Object.entries(response.headers)) {
453
- const h = resolve(spec, hraw);
454
- const desc = h.description ? ` — ${escapeText(h.description)}` : '';
455
- lines.push(`- \`${hname}\` ${typeLabel(spec, h.schema)}${desc}`);
456
- }
457
- lines.push('');
458
- }
459
- if (media?.schema) lines.push(fields(spec, media.schema, group, 'ResponseField'));
460
- const example = bodyExample(spec, media);
461
- if (example !== undefined) {
462
- lines.push(
463
- `<ResponseExample title="${code}">`,
464
- '',
465
- '```json',
466
- JSON.stringify(example, null, 2),
467
- '```',
468
- '',
469
- '</ResponseExample>',
470
- ''
471
- );
472
- }
473
- }
474
-
475
- lines.push('</Api>', '');
476
- return { tag, slug: slugify(op.operationId ?? `${method}-${path}`), body: lines.join('\n') };
477
- }
478
-
479
- function schemaPage(spec: Spec, group: string, name: string, schema: Schema): string {
480
- const resolved = composed(spec, schema);
481
- return [
482
- ...frontmatter(name, resolved.description ?? `The ${name} object.`, '', 'box'),
483
- `# ${escapeText(name)}`,
484
- '',
485
- ...(resolved.description ? [escapeText(resolved.description), ''] : []),
486
- '<Api>',
487
- '',
488
- '## Attributes',
489
- '',
490
- fields(spec, resolved, group, 'ResponseField'),
491
- '<ObjectExample title={`' + name + '`}>',
492
- '',
493
- '```json',
494
- JSON.stringify(sample(spec, resolved), null, 2),
495
- '```',
496
- '',
497
- '</ObjectExample>',
498
- '',
499
- '</Api>',
500
- ''
501
- ].join('\n');
502
- }
503
-
504
- const titleCase = (value: string): string => value.replace(/(^|\s)\S/g, (c) => c.toUpperCase());
505
-
506
- async function loadSpec(spec: string): Promise<Spec> {
507
- let text: string;
508
- if (/^https?:\/\//.test(spec)) {
509
- const res = await fetch(spec);
510
- text = await res.text();
511
- } else {
512
- text = readFileSync(spec, 'utf8');
513
- }
514
- text = text.trim();
515
- return (text.startsWith('{') ? JSON.parse(text) : parseYaml(text)) as Spec;
516
- }
517
-
518
- async function generateOne(source: ApiSource, contentRoot: string): Promise<string[]> {
519
- const spec = await loadSpec(source.spec);
520
- const baseUrl = spec.servers?.[0]?.url ?? '';
521
- const group = source.output || (source.title ? slugify(source.title) : 'api-reference');
522
- const root = join(contentRoot, group);
523
- rmSync(root, { recursive: true, force: true });
524
-
525
- const byTag = new Map<string, Page[]>();
526
- const collect = (entries: Record<string, PathItem> | undefined, defaultTag: string) => {
527
- for (const [path, item] of Object.entries(entries ?? {})) {
528
- for (const method of METHODS) {
529
- const op = item[method];
530
- if (!op) continue;
531
- const page = operationPage(spec, baseUrl, group, path, method, op, item, defaultTag);
532
- if (!byTag.has(page.tag)) byTag.set(page.tag, []);
533
- byTag.get(page.tag)!.push(page);
534
- }
535
- }
536
- };
537
- collect(spec.paths, 'default');
538
- collect(spec.webhooks, 'webhooks');
539
-
540
- const written: string[] = [];
541
- const write = (file: string, content: string) => {
542
- mkdirSync(dirname(file), { recursive: true });
543
- writeFileSync(file, content);
544
- written.push(file);
545
- };
546
-
547
- const tags = [...byTag.keys()];
548
- const schemas = Object.entries(spec.components?.schemas ?? {});
549
- const sections = [...tags, ...(schemas.length ? ['schemas'] : [])];
550
- const tagTitle = (t: string): string =>
551
- titleCase(spec.tags?.find((x) => slugify(x.name) === t)?.name ?? t);
552
-
553
- write(
554
- join(root, 'meta.json'),
555
- JSON.stringify(
556
- { title: source.title ?? spec.info?.title ?? 'API Reference', icon: 'code', pages: sections },
557
- null,
558
- '\t'
559
- )
560
- );
561
-
562
- for (const [tag, pages] of byTag) {
563
- write(
564
- join(root, tag, 'meta.json'),
565
- JSON.stringify({ title: tagTitle(tag), pages: pages.map((p) => p.slug) }, null, '\t')
566
- );
567
- for (const page of pages) write(join(root, tag, `${page.slug}.md`), page.body);
568
- }
569
-
570
- if (schemas.length) {
571
- write(
572
- join(root, 'schemas', 'meta.json'),
573
- JSON.stringify(
574
- { title: 'Schemas', icon: 'box', pages: schemas.map(([name]) => slugify(name)) },
575
- null,
576
- '\t'
577
- )
578
- );
579
- for (const [name, schema] of schemas) {
580
- write(join(root, 'schemas', `${slugify(name)}.md`), schemaPage(spec, group, name, schema));
581
- }
582
- }
583
-
584
- return written;
585
- }
586
-
587
- // Keep generated reference folders out of git (and prettier/eslint, which read
588
- // .gitignore) without touching the rest of the file.
589
- function ignoreGenerated(contentRoot: string, groups: string[]): void {
590
- const file = '.gitignore';
591
- const start = '# axerity:openapi (generated)';
592
- const end = '# end axerity:openapi';
593
- const esc = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
594
- const block = [start, ...groups.map((g) => `${contentRoot}/${g}`), end].join('\n');
595
- let content = existsSync(file) ? readFileSync(file, 'utf8') : '';
596
- content = content.replace(new RegExp(`\\n*${esc(start)}[\\s\\S]*?${esc(end)}\\n*`, 'g'), '\n');
597
- if (groups.length) content = `${content.replace(/\n+$/, '')}\n\n${block}\n`;
598
- writeFileSync(file, content);
599
- }
600
-
601
- /**
602
- * Generate one or more API references (local file or URL, JSON or YAML) into the
603
- * content folder. An array of sources produces a separate group per spec.
604
- */
605
- export async function generateApiDocs(
606
- openapi: string | ApiSource | ApiSource[] | undefined,
607
- contentRoot: string
608
- ): Promise<string[]> {
609
- const sources = (openapi ? (Array.isArray(openapi) ? openapi : [openapi]) : []).map((o) =>
610
- typeof o === 'string' ? { spec: o } : o
611
- );
612
- const written: string[] = [];
613
- const groups: string[] = [];
614
- for (const source of sources) {
615
- if (!source.spec) continue;
616
- if (!/^https?:\/\//.test(source.spec) && !existsSync(source.spec)) continue;
617
- groups.push(source.output || (source.title ? slugify(source.title) : 'api-reference'));
618
- try {
619
- written.push(...(await generateOne(source, contentRoot)));
620
- } catch (error) {
621
- console.warn(`[axerity] OpenAPI generation failed for ${source.spec}:`, error);
622
- }
623
- }
624
- // When the CLI mounts a user's project into the engine, generated pages live
625
- // engine-side and never touch the user's repo, so the .gitignore block is
626
- // pointless — and rewriting .gitignore mid-run is dangerous. Skip it then.
627
- if (!process.env.AXERITY_MOUNTED) ignoreGenerated(contentRoot, groups);
628
- return written;
629
- }