@aussieljk/forkbook 0.0.1-10 → 0.0.1-12

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 (346) hide show
  1. package/README.md +1 -1
  2. package/assets/create/rendererAssets/common/button.css +6 -6
  3. package/assets/create/rendererAssets/common/header.css +5 -5
  4. package/assets/create/rendererAssets/common/page.css +10 -10
  5. package/assets/server/template.ejs +6 -3
  6. package/dist/_browser-chunks/{Color-X63I7FHI.js → Color-TA43572R.js} +2 -2
  7. package/dist/_browser-chunks/{DocsRenderer-JXND3PVQ.js → DocsRenderer-DKXSW2OY.js} +2 -2
  8. package/dist/_browser-chunks/{WithTooltip-5S6F2P7L.js → WithTooltip-66AWY4VQ.js} +5 -4
  9. package/dist/_browser-chunks/{chunk-RBCHTR7C.js → chunk-2ELGJRFZ.js} +1 -1
  10. package/dist/_browser-chunks/{chunk-DYNTDJ3O.js → chunk-2UKY4NXZ.js} +1 -1
  11. package/dist/_browser-chunks/{chunk-I4ATZPNZ.js → chunk-2WMECYEY.js} +3 -3
  12. package/dist/_browser-chunks/{chunk-6ELMKWKX.js → chunk-2WZWS7GJ.js} +1 -1
  13. package/dist/_browser-chunks/{chunk-N3NRW5XX.js → chunk-2YWS25WY.js} +1 -1
  14. package/dist/_browser-chunks/{chunk-NGMQJMCY.js → chunk-3O4QUF3D.js} +1 -1
  15. package/dist/_browser-chunks/{chunk-GNZY6LOW.js → chunk-5MRMYSUN.js} +4 -4
  16. package/dist/_browser-chunks/{chunk-RMYQ3QN3.js → chunk-5XGERZHU.js} +15 -12
  17. package/dist/_browser-chunks/{chunk-5WMXI5GW.js → chunk-AQVUHXWY.js} +6 -4
  18. package/dist/_browser-chunks/{chunk-ZHKZKFY4.js → chunk-ARZTIHZK.js} +6 -10
  19. package/dist/_browser-chunks/{chunk-DS2WQZGO.js → chunk-D2Z5KXPS.js} +12 -41
  20. package/dist/_browser-chunks/{chunk-EQKMUQF3.js → chunk-DT7BB545.js} +3 -2
  21. package/dist/_browser-chunks/{chunk-76222HQR.js → chunk-E6QKKKLO.js} +20 -5
  22. package/dist/_browser-chunks/{chunk-5Z65SURM.js → chunk-F22A5EGD.js} +4 -4
  23. package/dist/_browser-chunks/{chunk-3M5T7BW4.js → chunk-GGALYEQS.js} +1 -1
  24. package/dist/_browser-chunks/{chunk-TTBPZQ24.js → chunk-HGIW4I4J.js} +11 -18
  25. package/dist/_browser-chunks/{chunk-46Z7NGAS.js → chunk-HX443LKV.js} +1 -1
  26. package/dist/_browser-chunks/{chunk-KYSD26D6.js → chunk-IGD46SQI.js} +90 -83
  27. package/dist/_browser-chunks/{chunk-LTCXWKZO.js → chunk-QSYOMLRG.js} +667 -624
  28. package/dist/_browser-chunks/{chunk-2JT76G3E.js → chunk-SBOQ4QPY.js} +15 -15
  29. package/dist/_browser-chunks/{chunk-O24AZJZ7.js → chunk-UDR26TXA.js} +2 -2
  30. package/dist/_browser-chunks/{chunk-5I7E4GMO.js → chunk-WY2LUGOH.js} +1 -1
  31. package/dist/_browser-chunks/{chunk-7DQREF4S.js → chunk-XV3AEPJW.js} +1 -1
  32. package/dist/_browser-chunks/{matchers-YLBYSYAF.js → matchers-2HVLNCVO.js} +4 -4
  33. package/dist/_browser-chunks/{react-dom-client-4OHE3QDV.js → react-dom-client-SLBUX3U3.js} +1 -1
  34. package/dist/_node-chunks/{attached-runtime-PDBJ2EGV.js → attached-runtime-AU2RZM4Y.js} +28 -29
  35. package/dist/_node-chunks/{builder-manager-VLL26RPG.js → builder-manager-UPXA2KKT.js} +39 -28
  36. package/dist/_node-chunks/{chunk-FR2ZDWKJ.js → chunk-22A63J7O.js} +7 -7
  37. package/dist/_node-chunks/{chunk-ZBWAA2EY.js → chunk-22TWJGGQ.js} +28 -43
  38. package/dist/_node-chunks/{chunk-M4QNXI37.js → chunk-2GJBHF56.js} +6 -6
  39. package/dist/_node-chunks/{chunk-TNFH4Y4G.js → chunk-2MGPZNKV.js} +280 -306
  40. package/dist/_node-chunks/{chunk-KRWR44KT.js → chunk-2Q3YWQSK.js} +6 -6
  41. package/dist/_node-chunks/{chunk-6DRVJCYP.js → chunk-2W525A4I.js} +7 -7
  42. package/dist/_node-chunks/{chunk-ZFLK7MY5.js → chunk-2X3WAH7V.js} +7 -7
  43. package/dist/_node-chunks/{chunk-FERXOKZY.js → chunk-34DNGOCZ.js} +8 -8
  44. package/dist/_node-chunks/{chunk-ID3WA6WR.js → chunk-3MJZ5GI2.js} +6 -6
  45. package/dist/_node-chunks/{chunk-AAL6X7YG.js → chunk-3X67K6EI.js} +136 -114
  46. package/dist/_node-chunks/{chunk-QGC3UWR5.js → chunk-5KMW5XXM.js} +6 -6
  47. package/dist/_node-chunks/{chunk-FXBZWUW3.js → chunk-5MYXWAKD.js} +512 -1033
  48. package/dist/_node-chunks/chunk-5N7YRHXJ.js +20 -0
  49. package/dist/_node-chunks/{chunk-QGVU7IFS.js → chunk-6772LYNF.js} +7 -7
  50. package/dist/_node-chunks/{chunk-IGOX6TUG.js → chunk-76M6JG5T.js} +7 -7
  51. package/dist/_node-chunks/{chunk-MKUA4ZCG.js → chunk-7F6TIY4T.js} +8 -8
  52. package/dist/_node-chunks/{chunk-KWNBN3DV.js → chunk-7SBWGNA7.js} +10 -10
  53. package/dist/_node-chunks/chunk-ABCEMTIP.js +20 -0
  54. package/dist/_node-chunks/{chunk-JVWXCB3L.js → chunk-AHNN3TQH.js} +8 -8
  55. package/dist/_node-chunks/{chunk-CEDR5CNM.js → chunk-BDATIKVV.js} +7 -7
  56. package/dist/_node-chunks/{chunk-K4O2ZAMU.js → chunk-BMM74ZQW.js} +6 -6
  57. package/dist/_node-chunks/{chunk-DR7NW2MI.js → chunk-BOWRRVJM.js} +6 -6
  58. package/dist/_node-chunks/{chunk-FRBE7ES4.js → chunk-BTDLJXAT.js} +6 -6
  59. package/dist/_node-chunks/{chunk-GKHLTHYM.js → chunk-C2HVGXLD.js} +224 -181
  60. package/dist/_node-chunks/chunk-CWIJ2D5F.js +18 -0
  61. package/dist/_node-chunks/{chunk-QOFBJXPH.js → chunk-DNX4BLMS.js} +7 -7
  62. package/dist/_node-chunks/{chunk-G2ZUFOHU.js → chunk-DXR3YGRT.js} +6 -6
  63. package/dist/_node-chunks/{chunk-GBVWRZHP.js → chunk-EFZAYIPN.js} +6 -6
  64. package/dist/_node-chunks/{chunk-MY7UVHPL.js → chunk-FAR3NIPG.js} +8 -8
  65. package/dist/_node-chunks/{chunk-MBPHOLXB.js → chunk-FFUIQJRI.js} +32 -40
  66. package/dist/_node-chunks/{chunk-TZIT6SZP.js → chunk-FKI7K3GE.js} +6 -6
  67. package/dist/_node-chunks/{chunk-VSHYJR23.js → chunk-FR67COFW.js} +7 -7
  68. package/dist/_node-chunks/chunk-FUDG3QKB.js +25 -0
  69. package/dist/_node-chunks/chunk-G6GOV7H7.js +19 -0
  70. package/dist/_node-chunks/{chunk-DRCP3DQF.js → chunk-H7UVQBCQ.js} +8 -8
  71. package/dist/_node-chunks/{chunk-CSFNS7HA.js → chunk-HMQUTLMS.js} +6 -6
  72. package/dist/_node-chunks/{chunk-VG2KFIOW.js → chunk-HPXM4SGT.js} +9 -9
  73. package/dist/_node-chunks/{chunk-MQC7ZY6L.js → chunk-HW4T3OXA.js} +7 -7
  74. package/dist/_node-chunks/{chunk-QVLHVO4X.js → chunk-HW7RCOV4.js} +8 -8
  75. package/dist/_node-chunks/{chunk-NGFFEW2B.js → chunk-IFHNMS7I.js} +19 -19
  76. package/dist/_node-chunks/{chunk-IL7YA7QJ.js → chunk-IKUSSZJ3.js} +10 -10
  77. package/dist/_node-chunks/{chunk-OPG46TLN.js → chunk-IOXDHKFF.js} +7 -7
  78. package/dist/_node-chunks/chunk-J3CNNXKQ.js +11 -0
  79. package/dist/_node-chunks/{chunk-ACSO4HQP.js → chunk-JB4457FJ.js} +6 -6
  80. package/dist/_node-chunks/{chunk-T5VZYRL2.js → chunk-JHX35YKT.js} +6 -6
  81. package/dist/_node-chunks/{chunk-CKE4R4NL.js → chunk-JKPKEYSH.js} +6 -6
  82. package/dist/_node-chunks/{chunk-RC4HPD5Q.js → chunk-JMFTALJW.js} +6 -6
  83. package/dist/_node-chunks/{chunk-BDU3ZUMK.js → chunk-JXS4P2RM.js} +7 -7
  84. package/dist/_node-chunks/{chunk-7CV4VEA2.js → chunk-K2K6KTBC.js} +8 -8
  85. package/dist/_node-chunks/{chunk-THDTJJMO.js → chunk-KMC5WWQS.js} +7 -7
  86. package/dist/_node-chunks/{chunk-FJFB7TWU.js → chunk-KQTFSKC6.js} +8 -8
  87. package/dist/_node-chunks/{chunk-GQYATLH6.js → chunk-KZPWZM2E.js} +37 -34
  88. package/dist/_node-chunks/{chunk-FZ453CHY.js → chunk-LTJ4AYDM.js} +6 -6
  89. package/dist/_node-chunks/{chunk-LH5QBX2U.js → chunk-MNNESU33.js} +497 -475
  90. package/dist/_node-chunks/{chunk-FQGQ5KHN.js → chunk-MNQVVJZN.js} +6 -6
  91. package/dist/_node-chunks/{chunk-CZ3V3HHK.js → chunk-NO7MF6VR.js} +6 -6
  92. package/dist/_node-chunks/{chunk-MIWBXEUH.js → chunk-NPSIAK46.js} +6 -6
  93. package/dist/_node-chunks/{chunk-GGE7TBVX.js → chunk-NUSHY22I.js} +62 -7
  94. package/dist/_node-chunks/{chunk-YU5TVYPS.js → chunk-NXRZL2PR.js} +6 -6
  95. package/dist/_node-chunks/{chunk-7O2UIVID.js → chunk-O2CCUB5T.js} +7 -7
  96. package/dist/_node-chunks/{chunk-BNEC3EBC.js → chunk-ORSH2FXG.js} +6 -6
  97. package/dist/_node-chunks/{chunk-LX2XSPPL.js → chunk-OSNOV4EH.js} +7 -7
  98. package/dist/_node-chunks/{chunk-BPL3ERBH.js → chunk-PHB6QBHM.js} +10 -10
  99. package/dist/_node-chunks/{chunk-63LPGIV4.js → chunk-POA32M7F.js} +21 -21
  100. package/dist/_node-chunks/{chunk-QFXAGOIO.js → chunk-Q64ESHBN.js} +8 -8
  101. package/dist/_node-chunks/{chunk-SYUOBOB5.js → chunk-QBWGJYHY.js} +6 -6
  102. package/dist/_node-chunks/{chunk-7OY4VMAT.js → chunk-QSKVNZCF.js} +7 -7
  103. package/dist/_node-chunks/{chunk-MRCPS4S3.js → chunk-QX6RXAEU.js} +6 -6
  104. package/dist/_node-chunks/{chunk-RJXAXHDJ.js → chunk-R73PEGQU.js} +9 -9
  105. package/dist/_node-chunks/{chunk-3CSGIJKG.js → chunk-RHH7VDIY.js} +8 -8
  106. package/dist/_node-chunks/{chunk-BXDMSX3D.js → chunk-RMJNWFPV.js} +9 -9
  107. package/dist/_node-chunks/{chunk-GJSYGBI5.js → chunk-RT2LVWTC.js} +7 -7
  108. package/dist/_node-chunks/{chunk-5NRWU7S2.js → chunk-SPCPGRYF.js} +7 -7
  109. package/dist/_node-chunks/{chunk-FWAF5NBL.js → chunk-SUHBBHKR.js} +6 -6
  110. package/dist/_node-chunks/{chunk-SGEPJMTU.js → chunk-TXZTC6LA.js} +22 -22
  111. package/dist/_node-chunks/{chunk-5SMIGUYF.js → chunk-U5HVQTHI.js} +6 -6
  112. package/dist/_node-chunks/{chunk-LG3NMXCM.js → chunk-UFZUSE3Y.js} +6 -6
  113. package/dist/_node-chunks/{chunk-DQ44ZAEM.js → chunk-UGQFYYBC.js} +6 -6
  114. package/dist/_node-chunks/{chunk-R2ZCFA7I.js → chunk-UKLCYEZU.js} +7 -7
  115. package/dist/_node-chunks/{chunk-IUPE4SU2.js → chunk-VJEN2JM3.js} +8 -8
  116. package/dist/_node-chunks/{chunk-WVRM6DQU.js → chunk-W5ZAUN5R.js} +7 -7
  117. package/dist/_node-chunks/{chunk-7KD5DKGZ.js → chunk-WNEWL2PL.js} +6 -6
  118. package/dist/_node-chunks/{chunk-6DHTL5G2.js → chunk-WUVQ465T.js} +6 -6
  119. package/dist/_node-chunks/{chunk-3W4KR5GX.js → chunk-XCNYQV2M.js} +19 -15
  120. package/dist/_node-chunks/{chunk-VUMGWJ6Y.js → chunk-XOAWAXUH.js} +7 -7
  121. package/dist/_node-chunks/chunk-Y472MP5U.js +281 -0
  122. package/dist/_node-chunks/{chunk-HCP5DG52.js → chunk-ZCKTYMZT.js} +320 -316
  123. package/dist/_node-chunks/{chunk-ECOW63CV.js → chunk-ZUK5ZLPP.js} +8 -8
  124. package/dist/_node-chunks/dist-2DPC664Y.js +27 -0
  125. package/dist/_node-chunks/dist-XBFUDMFQ.js +16 -0
  126. package/dist/_node-chunks/{local-runtime-V5YTRN24.js → local-runtime-Z667YPXR.js} +19 -20
  127. package/dist/_node-chunks/{mdx-plugin-CBOD52VP.js → mdx-plugin-BPRPTZNP.js} +13 -13
  128. package/dist/_node-chunks/{monorepo-GF6H53U4.js → monorepo-GO54BY34.js} +11 -11
  129. package/dist/_node-chunks/{monorepo-optimized-tests-relaxed-limits-no-story-deletion-K4TTV2DQ.js → monorepo-optimized-tests-relaxed-limits-no-story-deletion-PEHFNJQ5.js} +11 -11
  130. package/dist/_node-chunks/optimized-tests-W7U4ZRWX.js +22 -0
  131. package/dist/_node-chunks/{pattern-copy-play-M2QNC4IZ.js → pattern-copy-play-64HQIVWK.js} +9 -9
  132. package/dist/_node-chunks/postinstallAddon-XM2BHKDN.js +20 -0
  133. package/dist/_node-chunks/{rehype-external-links-3IDE4CYH.js → rehype-external-links-2BSEZ7AC.js} +9 -9
  134. package/dist/_node-chunks/{rehype-slug-GKB3WS3U.js → rehype-slug-6253EA36.js} +9 -9
  135. package/dist/_node-chunks/{relaxed-limits-C6QU365N.js → relaxed-limits-4PAAPG3J.js} +11 -11
  136. package/dist/_node-chunks/{run-XWBUPXLN.js → run-3SQW3FRF.js} +18 -18
  137. package/dist/_node-chunks/{run-TMVS3KKA.js → run-XJT3YVMZ.js} +16 -16
  138. package/dist/_node-chunks/{setup-KEEJK4WI.js → setup-JIYCTADZ.js} +8 -8
  139. package/dist/_node-chunks/{vitest.config.4.template-74HEE4WJ.js → vitest.config.4.template-W74SGWHT.js} +7 -7
  140. package/dist/actions/decorator.js +12 -20
  141. package/dist/addon-a11y/index.js +2 -2
  142. package/dist/addon-a11y/manager.js +12 -12
  143. package/dist/addon-a11y/preset.js +7 -7
  144. package/dist/addon-a11y/preview.js +2 -2
  145. package/dist/addon-docs/blocks.d.ts +10 -6
  146. package/dist/addon-docs/blocks.js +28 -30
  147. package/dist/addon-docs/index.js +3 -3
  148. package/dist/addon-docs/manager.js +3 -3
  149. package/dist/addon-docs/preset.js +10 -10
  150. package/dist/addon-docs/preview.js +1 -1
  151. package/dist/addon-links/preview.d.ts +1 -1
  152. package/dist/addon-mcp/preset.js +9 -9
  153. package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +15 -15
  154. package/dist/addon-ondevice-controls/index.js +1 -1
  155. package/dist/addon-ondevice-controls/register.js +1 -1
  156. package/dist/addon-pseudo-states/index.js +1 -1
  157. package/dist/addon-pseudo-states/preview.js +1 -1
  158. package/dist/addon-themes/postinstall.js +7 -7
  159. package/dist/addon-vitest/constants.js +8 -8
  160. package/dist/addon-vitest/manager.js +18 -9
  161. package/dist/addon-vitest/node/coverage-reporter.js +11 -11
  162. package/dist/addon-vitest/node/vitest.js +28 -28
  163. package/dist/addon-vitest/postinstall.js +10 -10
  164. package/dist/addon-vitest/preset.js +15 -15
  165. package/dist/addon-vitest/vitest-plugin/global-setup.js +21 -21
  166. package/dist/addon-vitest/vitest-plugin/index.js +68 -58
  167. package/dist/babel/index.js +11 -11
  168. package/dist/bin/core.js +106 -88
  169. package/dist/bin/dispatcher.js +10 -10
  170. package/dist/bin/loader.js +8 -8
  171. package/dist/builder-vite/index.js +18 -18
  172. package/dist/builder-vite/preset.js +13 -13
  173. package/dist/channels/index.d.ts +1 -1
  174. package/dist/channels/index.js +1 -1
  175. package/dist/{chunk-Dr3R0DXk.d.ts → chunk-B-NVyPqN.d.ts} +2 -2
  176. package/dist/{chunk-Fg1Fm__9.d.ts → chunk-BmCH-L7_.d.ts} +393 -383
  177. package/dist/{chunk-CNqjcOmK.d.ts → chunk-Bn1RoGAP.d.ts} +1 -1
  178. package/dist/{chunk-BXLImeLy.d.ts → chunk-CfEntHiI.d.ts} +18 -3
  179. package/dist/{chunk-D0NUmzXp.d.ts → chunk-IMedIHPn.d.ts} +3 -3
  180. package/dist/{chunk-CYuvV2sR.d.ts → chunk-evfhuBNU.d.ts} +1 -1
  181. package/dist/cli/index.d.ts +2 -2
  182. package/dist/cli/index.js +25 -30
  183. package/dist/cli/tools/sdk/child-host.d.ts +1 -1
  184. package/dist/cli/tools/sdk/child-host.js +17 -17
  185. package/dist/cli/tools/sdk/index.d.ts +2 -2
  186. package/dist/cli/tools/sdk/index.js +18 -18
  187. package/dist/cli-commands/bin/index.js +7 -7
  188. package/dist/client-logger/index.js +2 -1
  189. package/dist/common/index.d.ts +5 -5
  190. package/dist/common/index.js +34 -35
  191. package/dist/components/index.d.ts +6 -6
  192. package/dist/components/index.js +152 -162
  193. package/dist/core-server/index.d.ts +6 -5
  194. package/dist/core-server/index.js +688 -152
  195. package/dist/core-server/presets/common-manager.js +227 -316
  196. package/dist/core-server/presets/common-override-preset.js +10 -10
  197. package/dist/core-server/presets/common-preset.js +73 -268
  198. package/dist/create/bin/index.js +7 -7
  199. package/dist/create/index.js +15 -15
  200. package/dist/csf/csf-utils.d.ts +1 -1
  201. package/dist/csf/index.d.ts +1 -1
  202. package/dist/csf/index.js +10 -10
  203. package/dist/csf-tools/index.d.ts +41 -37
  204. package/dist/csf-tools/index.js +13 -13
  205. package/dist/instrumenter/index.d.ts +1 -1
  206. package/dist/instrumenter/index.js +1 -1
  207. package/dist/manager/_manager-chunks/{globals-runtime-CJL1dQtn.js → globals-runtime--RDllwDw.js} +629 -436
  208. package/dist/manager/_manager-chunks/{globals-runtime-DvV_TF3-.js → globals-runtime-B4NRbNSS.js} +2 -2
  209. package/dist/manager/_manager-chunks/{globals-runtime-wjkxyMn0.js → globals-runtime-BC43T1rL.js} +4150 -50
  210. package/dist/manager/_manager-chunks/{globals-runtime-CfurFwS_.js → globals-runtime-BFVFUcji.js} +2 -2
  211. package/dist/manager/_manager-chunks/{globals-runtime-BKQscPdC.js → globals-runtime-BWciJpaD.js} +103 -101
  212. package/dist/manager/_manager-chunks/{globals-runtime-CA8AuIRT.js → globals-runtime-BnQ7i5wq.js} +232 -228
  213. package/dist/manager/_manager-chunks/globals-runtime-BtduS2C2.js +10601 -0
  214. package/dist/manager/_manager-chunks/globals-runtime-BzuYs3dZ.js +1971 -0
  215. package/dist/manager/_manager-chunks/{globals-runtime-BY3epqww.js → globals-runtime-CS41oTca.js} +2 -1
  216. package/dist/manager/_manager-chunks/{globals-runtime-DBba3I9c.js → globals-runtime-CdLHkSK1.js} +260 -401
  217. package/dist/manager/_manager-chunks/globals-runtime-CoTrrHG3.js +1163 -0
  218. package/dist/manager/_manager-chunks/{globals-runtime-BweHuXkK.js → globals-runtime-DCmvKMN5.js} +2 -2
  219. package/dist/manager/_manager-chunks/globals-runtime-DgO0hT2p.js +32 -0
  220. package/dist/manager/_manager-chunks/{globals-runtime-CvIgTRVu.js → globals-runtime-DhygDQ09.js} +5 -5
  221. package/dist/manager/_manager-chunks/{globals-runtime-NwJK8t0T.js → globals-runtime-DweLlyBa.js} +5 -4
  222. package/dist/manager/_manager-chunks/globals-runtime-Me9Bl-sx.js +156 -0
  223. package/dist/manager/_manager-chunks/globals-runtime-nQMRiA0J.js +19 -0
  224. package/dist/manager/_manager-chunks/{globals-runtime-Bj5KDUJi.js → globals-runtime-oRjPg2jY.js} +1 -1
  225. package/dist/manager/_manager-chunks/{runtime-Bs3bEhuy.js → runtime-1BcYUf7-.js} +24 -42
  226. package/dist/manager/_manager-chunks/{runtime-CBQsKmch.js → runtime-B2VQIT0n.js} +739 -554
  227. package/dist/manager/_manager-chunks/runtime-BBaBlpAS.js +552 -0
  228. package/dist/manager/_manager-chunks/{runtime-B_nqedQW.js → runtime-BFgSyEE6.js} +13 -13
  229. package/dist/manager/_manager-chunks/{runtime-jj8qYc2n.js → runtime-CE_oqcpl.js} +6 -6
  230. package/dist/manager/_manager-chunks/{runtime-DtCVCy4G.js → runtime-CRqm7NXD.js} +49 -49
  231. package/dist/manager/_manager-chunks/{runtime-5B2mWjEm.js → runtime-CZtDJIYj.js} +3 -3
  232. package/dist/manager/_manager-chunks/{runtime-eBAgOym6.js → runtime-D3Gk2bTl.js} +846 -835
  233. package/dist/manager/_manager-chunks/{runtime-DG61zYUm.js → runtime-Db8fJ2MP.js} +67 -500
  234. package/dist/manager/_manager-chunks/{runtime-j9yqh0tr.js → runtime-Dj8tizGo.js} +101 -101
  235. package/dist/manager/globals-runtime.js +1 -1
  236. package/dist/manager/runtime.js +1 -1
  237. package/dist/manager-api/index.d.ts +1 -1
  238. package/dist/manager-api/index.js +444 -428
  239. package/dist/manager-errors.d.ts +1 -1
  240. package/dist/mcp/index.js +9 -9
  241. package/dist/mocking-utils/index.js +15 -19
  242. package/dist/nextjs-vite/export-mocks/router/index.js +1 -1
  243. package/dist/nextjs-vite/index.d.ts +1 -1
  244. package/dist/nextjs-vite/index.js +4 -4
  245. package/dist/nextjs-vite/node/index.js +7 -7
  246. package/dist/nextjs-vite/preset.js +12 -12
  247. package/dist/nextjs-vite/preview.js +1 -1
  248. package/dist/nextjs-vite/vite-plugin/index.d.ts +2 -2
  249. package/dist/nextjs-vite/vite-plugin/index.js +9 -9
  250. package/dist/nextjs-vite-plugin/index.js +15 -15
  251. package/dist/nextjs-vite-plugin/mocks/storybook.global.js +8 -8
  252. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +1 -1
  253. package/dist/node-logger/index.d.ts +16 -16
  254. package/dist/node-logger/index.js +9 -9
  255. package/dist/oxc-parser/index.js +14 -11
  256. package/dist/oxc-parser/worker.js +10 -10
  257. package/dist/preview/_chunks/{runtime-BJwGQok8.js → runtime-4BNaFIif.js} +180 -21
  258. package/dist/preview/_chunks/{runtime-BUnOhg9h.js → runtime-BSJ0Ov_b.js} +2 -2
  259. package/dist/preview/_chunks/{runtime-BhSZ1Mwt.js → runtime-Bjm1gBLN.js} +6 -19
  260. package/dist/preview/_chunks/{runtime-Bcv1hJky.js → runtime-CBKlMZg2.js} +4148 -48
  261. package/dist/preview/_chunks/{runtime-BPwAnlRx.js → runtime-CElbz0uN.js} +1 -1
  262. package/dist/preview/_chunks/{runtime-BZ4pNS3g.js → runtime-C_nyb8QT.js} +3 -3
  263. package/dist/preview/_chunks/{runtime-BgPhfM5P.js → runtime-CzTPeFXg.js} +676 -376
  264. package/dist/preview/_chunks/{runtime-WapFVPAh.js → runtime-DZ7fvh0y.js} +1 -1
  265. package/dist/preview/runtime.js +1 -1
  266. package/dist/preview-api/index.d.ts +2 -2
  267. package/dist/preview-api/index.js +5 -5
  268. package/dist/preview-errors.d.ts +1 -1
  269. package/dist/react/docgen/docgen-worker.js +11 -11
  270. package/dist/react/entry-preview-argtypes.js +1 -1
  271. package/dist/react/entry-preview-docs.js +1 -1
  272. package/dist/react/entry-preview.js +1 -1
  273. package/dist/react/index.d.ts +1 -1
  274. package/dist/react/index.js +5 -5
  275. package/dist/react/preset.js +13 -13
  276. package/dist/react/preview.js +4 -4
  277. package/dist/react-native/bin/get-stories.js +8 -8
  278. package/dist/react-native/index.d.ts +37 -36
  279. package/dist/react-native/index.js +30 -34
  280. package/dist/react-native/metro/node.d.ts +1 -1
  281. package/dist/react-native/metro/node.js +10 -10
  282. package/dist/react-native/metro/withForkbook.d.ts +7 -7
  283. package/dist/react-native/metro/withForkbook.js +14 -14
  284. package/dist/react-native/preview.js +4 -1
  285. package/dist/react-native/scripts/generate.js +8 -8
  286. package/dist/react-native/stub.js +1 -1
  287. package/dist/react-native-ui/index.d.ts +4 -3
  288. package/dist/react-native-ui/index.js +1 -8
  289. package/dist/react-native-ui-common/index.d.ts +7 -6
  290. package/dist/react-native-ui-common/index.js +6 -6
  291. package/dist/react-vite/node/index.js +7 -7
  292. package/dist/react-vite/preset.js +7 -7
  293. package/dist/server-errors.d.ts +1 -1
  294. package/dist/server-errors.js +9 -9
  295. package/dist/shared/open-service/index.d.ts +1 -1
  296. package/dist/shared/open-service/index.js +1 -1
  297. package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +9 -9
  298. package/dist/shared/open-service/toolsets/docs/public.d.ts +2 -2
  299. package/dist/telemetry/index.d.ts +38 -274
  300. package/dist/telemetry/index.js +11 -66
  301. package/dist/test/index.js +125 -112
  302. package/dist/types/index.d.ts +1 -1
  303. package/dist/types/index.js +2 -2
  304. package/package.json +15 -15
  305. package/template/nextjs-vite/cli/js/Button.jsx +2 -2
  306. package/template/nextjs-vite/cli/js/Header.jsx +1 -1
  307. package/template/nextjs-vite/cli/js/Page.jsx +1 -1
  308. package/template/nextjs-vite/cli/ts/Button.tsx +2 -2
  309. package/template/nextjs-vite/cli/ts/Header.tsx +1 -1
  310. package/template/nextjs-vite/cli/ts/Page.tsx +1 -1
  311. package/template/react/cli/js/Button.jsx +2 -2
  312. package/template/react/cli/js/Header.jsx +1 -1
  313. package/template/react/cli/js/Page.jsx +1 -1
  314. package/template/react/cli/ts/Button.tsx +2 -2
  315. package/template/react/cli/ts/Header.tsx +1 -1
  316. package/template/react/cli/ts/Page.tsx +1 -1
  317. package/template/react-vite/cli/js/Button.jsx +2 -2
  318. package/template/react-vite/cli/js/Header.jsx +1 -1
  319. package/template/react-vite/cli/js/Page.jsx +1 -1
  320. package/template/react-vite/cli/ts/Button.tsx +2 -2
  321. package/template/react-vite/cli/ts/Header.tsx +1 -1
  322. package/template/react-vite/cli/ts/Page.tsx +1 -1
  323. package/dist/_node-chunks/chunk-BMJPOQ2S.js +0 -11
  324. package/dist/_node-chunks/chunk-C3PLG47Q.js +0 -25
  325. package/dist/_node-chunks/chunk-DNV3LPV3.js +0 -33
  326. package/dist/_node-chunks/chunk-DPILYJH4.js +0 -33
  327. package/dist/_node-chunks/chunk-EBWZKN2I.js +0 -1297
  328. package/dist/_node-chunks/chunk-ENBDAHOV.js +0 -18
  329. package/dist/_node-chunks/chunk-FAEOR2AW.js +0 -40
  330. package/dist/_node-chunks/chunk-HVOSLI2K.js +0 -20
  331. package/dist/_node-chunks/chunk-ND323XCC.js +0 -33
  332. package/dist/_node-chunks/chunk-PEL4YXU6.js +0 -19
  333. package/dist/_node-chunks/chunk-T6IU66AM.js +0 -69
  334. package/dist/_node-chunks/chunk-TY2ZY7AO.js +0 -155
  335. package/dist/_node-chunks/chunk-ZD5TUA6I.js +0 -20
  336. package/dist/_node-chunks/dist-7OJKTBKL.js +0 -27
  337. package/dist/_node-chunks/dist-MWP6WLW4.js +0 -16
  338. package/dist/_node-chunks/optimized-tests-KOTSVWTN.js +0 -22
  339. package/dist/_node-chunks/postinstallAddon-WXKJL6DP.js +0 -20
  340. package/dist/_node-chunks/session-id-VMH57SKN.js +0 -23
  341. package/dist/manager/_manager-chunks/globals-runtime-Bs75QQ_I.js +0 -9987
  342. package/dist/manager/_manager-chunks/globals-runtime-WZKaeKm9.js +0 -4091
  343. package/dist/manager/_manager-chunks/runtime-5o_11Jae.js +0 -78
  344. package/dist/preview/_chunks/runtime-BsMjBzuq.js +0 -53
  345. package/dist/preview/_chunks/runtime-C1jgT6tJ.js +0 -4091
  346. package/dist/preview/_chunks/runtime-CkOhMcXf.js +0 -387
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_upaeg5sjpn from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_upaeg5sjpn from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_upaeg5sjpn from "node:module";
1
+ import CJS_COMPAT_NODE_URL_enqaafxxjgh from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_enqaafxxjgh from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_enqaafxxjgh from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_upaeg5sjpn.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_upaeg5sjpn.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_upaeg5sjpn.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_enqaafxxjgh.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_enqaafxxjgh.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_enqaafxxjgh.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Forkbook's esbuild configuration
@@ -12,67 +12,61 @@ var require = CJS_COMPAT_NODE_MODULE_upaeg5sjpn.createRequire(import.meta.url);
12
12
  import {
13
13
  UniversalStore,
14
14
  instances
15
- } from "./chunk-QGVU7IFS.js";
15
+ } from "./chunk-6772LYNF.js";
16
16
  import {
17
17
  buildStoryPathMap,
18
18
  toUrlPath
19
- } from "./chunk-K4O2ZAMU.js";
19
+ } from "./chunk-BMM74ZQW.js";
20
20
  import {
21
21
  require_build
22
- } from "./chunk-THDTJJMO.js";
23
- import {
24
- isI18nPackage,
25
- isRouterPackage,
26
- isStateManagementPackage,
27
- isStylingPackage
28
- } from "./chunk-TY2ZY7AO.js";
22
+ } from "./chunk-KMC5WWQS.js";
29
23
  import {
30
24
  leven
31
- } from "./chunk-TZIT6SZP.js";
25
+ } from "./chunk-FKI7K3GE.js";
32
26
  import {
33
27
  defineToolset
34
- } from "./chunk-GJSYGBI5.js";
28
+ } from "./chunk-RT2LVWTC.js";
35
29
  import {
36
30
  getToolName,
37
31
  toMcpToolName
38
- } from "./chunk-LX2XSPPL.js";
32
+ } from "./chunk-OSNOV4EH.js";
39
33
  import {
40
34
  exec,
41
35
  getComponentIdFromEntry,
42
36
  optionalEnvToBoolean,
43
37
  selectComponentEntriesByComponentId
44
- } from "./chunk-FJFB7TWU.js";
38
+ } from "./chunk-KQTFSKC6.js";
45
39
  import {
46
40
  getService as getService2,
47
41
  registerService
48
- } from "./chunk-BPL3ERBH.js";
42
+ } from "./chunk-PHB6QBHM.js";
49
43
  import {
50
44
  getRegisteredServices,
51
45
  getService
52
- } from "./chunk-AAL6X7YG.js";
46
+ } from "./chunk-3X67K6EI.js";
53
47
  import {
54
48
  isEqual,
55
49
  isPlainObject
56
- } from "./chunk-5NRWU7S2.js";
50
+ } from "./chunk-SPCPGRYF.js";
57
51
  import {
58
52
  Tag
59
- } from "./chunk-SYUOBOB5.js";
53
+ } from "./chunk-QBWGJYHY.js";
60
54
  import {
61
55
  CHANGE_DETECTION_STATUS_TYPE_ID,
62
56
  UNIVERSAL_STATUS_STORE_OPTIONS,
63
57
  createStatusStore
64
- } from "./chunk-MY7UVHPL.js";
58
+ } from "./chunk-FAR3NIPG.js";
65
59
  import {
66
60
  invariant
67
- } from "./chunk-CKE4R4NL.js";
61
+ } from "./chunk-JKPKEYSH.js";
68
62
  import {
69
63
  importModule,
70
64
  resolveModulePath,
71
65
  resolvePackageDir
72
- } from "./chunk-VUMGWJ6Y.js";
66
+ } from "./chunk-XOAWAXUH.js";
73
67
  import {
74
68
  jsTsSourceExtensions
75
- } from "./chunk-T5VZYRL2.js";
69
+ } from "./chunk-JHX35YKT.js";
76
70
  import {
77
71
  OpenServiceDocgenMissingComponentError,
78
72
  OpenServiceMissingOriginError,
@@ -81,22 +75,19 @@ import {
81
75
  OpenServiceUnknownStoryIdsError,
82
76
  StorybookError,
83
77
  describeUnknownStoryIds
84
- } from "./chunk-LH5QBX2U.js";
78
+ } from "./chunk-MNNESU33.js";
85
79
  import {
86
80
  require_picocolors
87
- } from "./chunk-7O2UIVID.js";
81
+ } from "./chunk-O2CCUB5T.js";
88
82
  import {
89
83
  errorToErrorLike,
90
84
  reverseIndexToStoriesByFile,
91
85
  toStoryIndexPath
92
- } from "./chunk-R2ZCFA7I.js";
93
- import {
94
- glob
95
- } from "./chunk-7CV4VEA2.js";
86
+ } from "./chunk-UKLCYEZU.js";
96
87
  import {
97
88
  __commonJS,
98
89
  __toESM
99
- } from "./chunk-FQGQ5KHN.js";
90
+ } from "./chunk-MNQVVJZN.js";
100
91
 
101
92
  // ../../node_modules/map-or-similar/src/similar.js
102
93
  var require_similar = __commonJS({
@@ -161,10 +152,10 @@ var require_memoizerific = __commonJS({
161
152
  "../../node_modules/memoizerific/src/memoizerific.js"(exports, module) {
162
153
  var MapOrSimilar = require_map_or_similar();
163
154
  module.exports = function(limit) {
164
- var cache5 = new MapOrSimilar(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP === "true"), lru = [];
155
+ var cache4 = new MapOrSimilar(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP === "true"), lru = [];
165
156
  return function(fn) {
166
157
  var memoizerific = function() {
167
- var currentCache = cache5, newMap, fnResult, argsLengthMinusOne = arguments.length - 1, lruPath = Array(argsLengthMinusOne + 1), isMemoized = !0, i;
158
+ var currentCache = cache4, newMap, fnResult, argsLengthMinusOne = arguments.length - 1, lruPath = Array(argsLengthMinusOne + 1), isMemoized = !0, i;
168
159
  if ((memoizerific.numArgs || memoizerific.numArgs === 0) && memoizerific.numArgs !== argsLengthMinusOne + 1)
169
160
  throw new Error("Memoizerific functions should always be called with the same number of arguments");
170
161
  for (i = 0; i < argsLengthMinusOne; i++) {
@@ -182,7 +173,7 @@ var require_memoizerific = __commonJS({
182
173
  arg: arguments[argsLengthMinusOne]
183
174
  }, isMemoized ? moveToMostRecentLru(lru, lruPath) : lru.push(lruPath), lru.length > limit && removeCachedResult(lru.shift())), memoizerific.wasMemoized = isMemoized, memoizerific.numArgs = argsLengthMinusOne + 1, fnResult;
184
175
  };
185
- return memoizerific.limit = limit, memoizerific.wasMemoized = !1, memoizerific.cache = cache5, memoizerific.lru = lru, memoizerific;
176
+ return memoizerific.limit = limit, memoizerific.wasMemoized = !1, memoizerific.cache = cache4, memoizerific.lru = lru, memoizerific;
186
177
  };
187
178
  };
188
179
  function moveToMostRecentLru(lru, lruPath) {
@@ -312,7 +303,7 @@ import { isAbsolute as isAbsolute2, join as join2 } from "node:path";
312
303
  import { pathToFileURL } from "node:url";
313
304
  import { MissingBuilderError } from "@aussieljk/forkbook/internal/server-errors";
314
305
  async function getManagerBuilder() {
315
- return await import("./builder-manager-VLL26RPG.js");
306
+ return await import("./builder-manager-UPXA2KKT.js");
316
307
  }
317
308
  async function getPreviewBuilder(resolvedPreviewBuilder) {
318
309
  let packageJson = join2(resolvedPreviewBuilder, "package.json");
@@ -466,12 +457,12 @@ function hasMdxRef(entry) {
466
457
  return typeof entry?.mdx?.$ref == "string";
467
458
  }
468
459
  function createDiskLoader(outputDir) {
469
- let cache5 = /* @__PURE__ */ new Map();
460
+ let cache4 = /* @__PURE__ */ new Map();
470
461
  return (relativePath) => {
471
- let pending = cache5.get(relativePath);
462
+ let pending = cache4.get(relativePath);
472
463
  return pending || (pending = readFile3(join4(outputDir, "manifests", relativePath), "utf8").then(
473
464
  (raw) => JSON.parse(raw)
474
- ), cache5.set(relativePath, pending)), pending;
465
+ ), cache4.set(relativePath, pending)), pending;
475
466
  };
476
467
  }
477
468
  function createServiceLoader(mdxPayloads) {
@@ -553,133 +544,389 @@ async function loadMdxPayloadsFromServiceIfNeeded(manifests, docsManifest) {
553
544
  }
554
545
 
555
546
  // src/core-server/utils/manifests/render-components-manifest.ts
556
- import path from "node:path";
557
547
  import { groupBy } from "@aussieljk/forkbook/internal/common";
548
+
549
+ // src/core-server/utils/manifests/components-manifest-cards.ts
550
+ import path from "node:path";
558
551
  function storyEntries(stories) {
559
552
  return Array.isArray(stories) ? stories : Object.values(stories ?? {});
560
553
  }
561
- function renderComponentsManifest(manifest, docsManifest) {
562
- let entries = Object.entries(manifest?.components ?? {}).sort(
563
- (a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
564
- ), docsEntries = Object.entries(docsManifest?.docs ?? {}).sort(
565
- (a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
566
- ), analyses = entries.map(([, c]) => analyzeComponent(c)), docsAnalyses = docsEntries.map(([, d]) => analyzeDoc(d)), attachedDocs = analyses.reduce((sum, a) => sum + a.totalDocs, 0), attachedDocsWithError = analyses.reduce((sum, a) => sum + a.docsErrors, 0), unattachedDocsWithError = docsAnalyses.filter((a) => a.hasError).length, totals = {
567
- components: entries.length,
568
- componentsWithApiError: analyses.filter((a) => a.hasApiError).length,
569
- infos: analyses.filter((a) => a.hasWarns).length,
570
- stories: analyses.reduce((sum, a) => sum + a.totalStories, 0),
571
- storyErrors: analyses.reduce((sum, a) => sum + a.storyErrors, 0),
572
- storyWarnings: analyses.reduce((sum, a) => sum + a.storyWarnings, 0),
573
- componentsWithoutApi: analyses.filter((a) => a.api.kind === "none").length,
574
- docs: docsEntries.length + attachedDocs,
575
- docsWithError: unattachedDocsWithError + attachedDocsWithError
576
- }, activeEngine = manifest?.meta?.docgen ?? "react-component-meta", durationMs = manifest?.meta?.durationMs ?? 0, allPill = '<a class="filter-pill all" data-k="all" href="#filter-all">All</a>', compErrorsPill = totals.componentsWithApiError > 0 ? `<a class="filter-pill err" data-k="errors" href="#filter-errors">${totals.componentsWithApiError}/${totals.components} API ${plural(totals.componentsWithApiError, "error")}</a>` : totals.components > 0 ? `<span class="filter-pill ok" aria-disabled="true">${totals.components} components ok</span>` : "", compInfosPill = totals.infos > 0 ? `<a class="filter-pill info" data-k="infos" href="#filter-infos">${totals.infos}/${totals.components} ${plural(totals.infos, "info", "infos")}</a>` : "", storiesPill = totals.storyErrors > 0 ? `<a class="filter-pill err" data-k="story-errors" href="#filter-story-errors">${totals.storyErrors}/${totals.stories} story errors</a>` : totals.stories > 0 ? `<span class="filter-pill ok" aria-disabled="true">${totals.stories} ${plural(totals.stories, "story", "stories")} ok</span>` : "", snippetWarningsPill = totals.storyWarnings > 0 ? `<a class="filter-pill info" data-k="story-warnings" href="#filter-story-warnings">${totals.storyWarnings}/${totals.stories} incomplete snippets</a>` : "", noApiPill = totals.componentsWithoutApi > 0 ? `<a class="filter-pill" data-k="no-api" href="#filter-no-api">${totals.componentsWithoutApi}/${totals.components} without API description</a>` : "", docsPill = totals.docs > 0 ? totals.docsWithError > 0 ? `<a class="filter-pill info" data-k="docs" href="#filter-docs">${totals.docsWithError}/${totals.docs} doc ${plural(totals.docsWithError, "error")}</a>` : `<a class="filter-pill ok" data-k="docs" href="#filter-docs">${totals.docs} ${plural(totals.docs, "doc")} ok</a>` : "", grid = entries.map(([key, c], idx) => renderComponentCard(key, c, `${idx}`, key)).join(""), docsGrid = docsEntries.map(([key, d], idx) => renderDocCard(key, d, `doc-${idx}`)).join(""), errorGroups = Object.entries(
577
- groupBy(
578
- entries.map(([, it]) => it).filter((it) => it.error),
579
- (manifest2) => manifest2.error?.name ?? "Error"
580
- )
581
- ).sort(([, a], [, b]) => b.length - a.length), errorGroupsHTML = errorGroups.map(([error, grouped]) => {
582
- let id = error.toLowerCase().replace(/[^a-z0-9]+/g, "-"), headerText = `${esc(error)}`, cards = grouped.map((manifest2, id2) => renderComponentCard(manifest2.id, manifest2, `error-${id2}`)).join("");
583
- return `
584
- <section class="group">
585
- <input id="${id}-toggle" class="group-tg" type="checkbox" hidden />
586
- <label for="${id}-toggle" class="group-header">
587
- <span class="caret">\u25B8</span>
588
- <span class="group-title">${headerText}</span>
589
- <span class="group-count">${grouped.length}</span>
590
- </label>
591
- <div class="group-cards">${cards}</div>
592
- </section>
593
- `;
594
- }).join("");
595
- return `<!doctype html>
596
- <html lang="en">
597
- <head>
598
- <meta charset="utf-8" />
599
- <meta name="viewport" content="width=device-width, initial-scale=1" />
600
- <title>Components Manifest</title>
601
- <style>
602
- :root {
603
- --bg: #0b0c10;
604
- --panel: #121318;
605
- --muted: #9aa0a6;
606
- --fg: #e8eaed;
607
- --ok: #22c55e;
608
- --info: #1e88e5;
609
- --err: #c62828;
610
- --ok-bg: #0c1a13;
611
- --info-bg: #0c1624;
612
- --err-bg: #1a0e0e;
613
- --chip: #1f2330;
614
- --border: #2b2f3a;
615
- --link: #8ab4f8;
616
- --active-ring: 1px; /* 1px active ring for pills and toggles */
617
- }
618
-
619
- * {
620
- box-sizing: border-box;
621
- }
622
-
623
- html,
624
- body {
625
- margin: 0;
626
- background: var(--bg);
627
- color: var(--fg);
628
- font: 14px/1.5 system-ui,
629
- -apple-system,
630
- Segoe UI,
631
- Roboto,
632
- Ubuntu,
633
- Cantarell,
634
- 'Helvetica Neue',
635
- Arial,
636
- 'Noto Sans';
637
- }
638
-
639
- .wrap {
640
- max-width: 1100px;
641
- margin: 0 auto;
642
- padding: 16px 20px;
643
- }
644
-
645
- header {
646
- position: sticky;
647
- top: 0;
648
- backdrop-filter: blur(6px);
649
- background: color-mix(in srgb, var(--bg) 84%, transparent);
650
- border-bottom: 1px solid var(--border);
651
- z-index: 10;
652
- }
554
+ var esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c] ?? c), plural = (n, one, many = `${one}s`) => n === 1 ? one : many;
555
+ function analyzeComponent(c) {
556
+ let api = resolveComponentApi(c), hasApiError = api.kind === "error", warns = [];
557
+ c.description?.trim() || warns.push("No description found. Write a jsdoc comment such as /** Component description */."), c.import?.trim() || warns.push(
558
+ `Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
559
+ );
560
+ let allStories = storyEntries(c.stories), totalStories = allStories.length, storyErrors = allStories.filter((e) => !!e?.error).length, storyWarnings = allStories.filter((e) => !!e?.warning).length, storyOk = totalStories - storyErrors, docsEntries = c.docs ? Object.values(c.docs) : [], totalDocs = docsEntries.length, docsErrors = docsEntries.filter((d) => !!d?.error).length, docsOk = totalDocs - docsErrors, hasAnyError = hasApiError || storyErrors > 0 || docsErrors > 0;
561
+ return {
562
+ api,
563
+ hasApiError,
564
+ hasAnyError,
565
+ hasWarns: warns.length > 0,
566
+ warns,
567
+ totalStories,
568
+ storyErrors,
569
+ storyWarnings,
570
+ storyOk,
571
+ totalDocs,
572
+ docsErrors,
573
+ docsOk
574
+ };
575
+ }
576
+ function analyzeDoc(d) {
577
+ return {
578
+ hasError: !!d.error
579
+ };
580
+ }
581
+ function note(title, bodyHTML, kind) {
582
+ return `
583
+ <div class="note ${kind}">
584
+ <div class="note-title">${esc(title)}</div>
585
+ <div class="note-body">${bodyHTML}</div>
586
+ </div>`;
587
+ }
588
+ function renderDocCard(key, d, id) {
589
+ let a = analyzeDoc(d), statusDot = a.hasError ? "dot-err" : "dot-ok", slug = `${id}-${(d.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, errorBadge = a.hasError ? `<label for="${slug}-err" class="badge err as-toggle">error</label>` : "", contentBadge = d.content ? `<label for="${slug}-content" class="badge ok as-toggle">view content</label>` : "";
590
+ return `
591
+ <article
592
+ class="card is-doc ${a.hasError ? "has-doc-error" : "no-doc-error"}"
593
+ role="listitem"
594
+ aria-label="${esc(d.name || key)}">
595
+ <div class="head">
596
+ <div class="title">
597
+ <h2><span class="status-dot ${statusDot}"></span> ${esc(d.title || d.name || key)}</h2>
598
+ <div class="badges">
599
+ ${errorBadge}
600
+ ${contentBadge}
601
+ </div>
602
+ </div>
603
+ <div class="meta" title="${esc(d.path ?? d.id)}">${d.path ? `${esc(d.id)} \xB7 ${esc(d.path)}` : esc(d.id)}</div>
604
+ ${d.summary ? `<div>${esc(d.summary)}</div>` : ""}
605
+ </div>
653
606
 
654
- h1 {
655
- font-size: 20px;
656
- margin: 0 0 6px;
657
- }
607
+ <!-- Hidden toggles must be siblings BEFORE .panels -->
608
+ ${a.hasError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
609
+ ${d.content ? `<input id="${slug}-content" class="tg tg-content" type="checkbox" hidden />` : ""}
658
610
 
659
- .summary {
660
- display: flex;
661
- gap: 12px;
662
- flex-wrap: wrap;
663
- align-items: center;
664
- }
611
+ <div class="panels">
612
+ ${a.hasError ? `
613
+ <div class="panel panel-err">
614
+ <div class="note err">
615
+ <div class="note-title">${esc(d.error?.name || "Error")}</div>
616
+ <div class="note-body"><pre><code>${esc(d.error?.message || "Unknown error")}</code></pre></div>
617
+ </div>
618
+ </div>` : ""}
619
+ ${d.content ? `
620
+ <div class="panel panel-content">
621
+ <div class="mdx-content">
622
+ <pre><code>${esc(d.content)}</code></pre>
623
+ </div>
624
+ </div>` : ""}
625
+ </div>
626
+ </article>`;
627
+ }
628
+ function renderComponentCard(key, c, id, anchorId) {
629
+ let a = analyzeComponent(c), statusDot = a.hasAnyError ? "dot-err" : "dot-ok", allStories = storyEntries(c.stories), errorStories = allStories.filter((ex) => !!ex?.error), okStories = allStories.filter((ex) => !ex?.error), subcomponentEntries = Object.entries(c.subcomponents ?? {}), allDocs = c.docs ? Object.values(c.docs) : [], errorDocs = allDocs.filter((d) => !!d?.error), okDocs = allDocs.filter((d) => !d?.error), slug = `c-${id}-${(c.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, { api } = a, primaryBadge = api.kind === "error" ? `<label for="${slug}-err" class="badge err as-toggle">API error</label>` : api.kind === "markdown" ? `<label for="${slug}-props" class="badge ok as-toggle">API description</label>` : api.kind === "props" ? `<label for="${slug}-props" class="badge ok as-toggle">${api.entries.length} ${plural(api.entries.length, "prop type")}</label>` : '<span class="badge">no API description</span>', infosBadge = a.hasWarns ? `<label for="${slug}-info" class="badge info as-toggle">${a.warns.length} ${plural(a.warns.length, "info", "infos")}</label>` : "", storiesBadge = a.totalStories > 0 ? `<label for="${slug}-stories" class="badge ${a.storyErrors > 0 ? "err" : "ok"} as-toggle">${a.storyErrors > 0 ? `${a.storyErrors}/${a.totalStories} story errors` : `${a.totalStories} ${plural(a.totalStories, "story", "stories")}`}${a.storyWarnings > 0 ? ` \xB7 ${a.storyWarnings} incomplete` : ""}</label>` : "", docsBadge = a.totalDocs > 0 ? `<label for="${slug}-docs" class="badge ${a.docsErrors > 0 ? "err" : "ok"} as-toggle">${a.docsErrors > 0 ? `${a.docsErrors}/${a.totalDocs} doc errors` : `${a.totalDocs} ${plural(a.totalDocs, "doc")}`}</label>` : "", subcomponentsBadge = subcomponentEntries.length > 0 ? `<label for="${slug}-subcomponents" class="badge ok as-toggle">${subcomponentEntries.length} ${plural(subcomponentEntries.length, "subcomponent")}</label>` : "", apiPanel = api.kind === "markdown" ? `
630
+ <div class="panel panel-props">
631
+ <div class="note ok">
632
+ <div class="row">
633
+ <span class="ex-name">API description</span>
634
+ ${c.renderer ? `<span class="badge ok">${esc(c.renderer)}</span>` : ""}
635
+ </div>
636
+ <pre><code>${esc(api.markdown)}</code></pre>
637
+ </div>
638
+ </div>` : api.kind === "props" ? `
639
+ <div class="panel panel-props">
640
+ <div class="note ok">
641
+ <div class="row">
642
+ <span class="ex-name">Prop types <small>(${api.engine})</small></span>
643
+ <span class="badge ok">${api.entries.length} ${plural(api.entries.length, "prop type")}</span>
644
+ </div>
645
+ <pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}</code></pre>
646
+ <pre><code>Props:</code></pre>
647
+ <pre><code>${esc(renderPropsCode(api.entries))}</code></pre>
648
+ </div>
649
+ </div>` : "", tags = c.jsDocTags && typeof c.jsDocTags == "object" ? Object.entries(c.jsDocTags).flatMap(
650
+ ([k, v10]) => (Array.isArray(v10) ? v10 : [v10]).map(
651
+ (val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
652
+ )
653
+ ).join("") : "";
654
+ return `
655
+ <article
656
+ ${anchorId ? `id="${esc(anchorId)}"` : ""}
657
+ class="card
658
+ ${a.hasApiError ? "has-error" : "no-error"}
659
+ ${a.hasWarns ? "has-info" : "no-info"}
660
+ ${a.storyErrors ? "has-story-error" : "no-story-error"}
661
+ ${a.storyWarnings ? "has-story-warning" : "no-story-warning"}
662
+ ${api.kind === "none" ? "missing-api" : ""}
663
+ ${a.docsErrors ? "has-doc-error" : "no-doc-error"}"
664
+ role="listitem"
665
+ aria-label="${esc(c.name || key)}">
666
+ <div class="head">
667
+ <div class="title">
668
+ <h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
669
+ <div class="badges">
670
+ ${primaryBadge}
671
+ ${infosBadge}
672
+ ${storiesBadge}
673
+ ${docsBadge}
674
+ ${subcomponentsBadge}
675
+ </div>
676
+ </div>
677
+ <div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
678
+ ${c.summary ? `<div>${esc(c.summary)}</div>` : ""}
679
+ ${c.description ? `<div class="hint">${esc(c.description)}</div>` : ""}
680
+ ${tags ? `<div class="kv">${tags}</div>` : ""}
681
+ </div>
665
682
 
666
- /* Top filter pills */
667
- .filter-pill {
668
- display: inline-flex;
669
- align-items: center;
670
- gap: 6px;
671
- padding: 6px 12px;
672
- border: 1px solid var(--border);
673
- border-radius: 999px;
674
- background: var(--panel);
675
- text-decoration: none;
676
- cursor: pointer;
677
- user-select: none;
678
- color: var(--fg);
679
- }
683
+ <!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
684
+ ${api.kind === "error" ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
685
+ ${a.hasWarns ? `<input id="${slug}-info" class="tg tg-info" type="checkbox" hidden />` : ""}
686
+ ${a.totalStories > 0 ? `<input id="${slug}-stories" class="tg tg-stories" type="checkbox" hidden />` : ""}
687
+ ${a.totalDocs > 0 ? `<input id="${slug}-docs" class="tg tg-docs" type="checkbox" hidden />` : ""}
688
+ ${subcomponentEntries.length > 0 ? `<input id="${slug}-subcomponents" class="tg tg-subcomponents" type="checkbox" hidden />` : ""}
689
+ ${apiPanel ? `<input id="${slug}-props" class="tg tg-props" type="checkbox" hidden />` : ""}
680
690
 
681
- .filter-pill.ok {
682
- color: #b9f6ca;
691
+ <div class="panels">
692
+ ${api.kind === "error" ? `
693
+ <div class="panel panel-err">
694
+ ${note("API error", `<pre><code>${esc(api.message)}</code></pre>`, "err")}
695
+ </div>` : ""}
696
+ ${a.hasWarns ? `
697
+ <div class="panel panel-info">
698
+ ${a.warns.map((w) => note("Info", esc(w), "info")).join("")}
699
+ </div>` : ""}
700
+ ${apiPanel}
701
+ ${a.totalStories > 0 ? `
702
+ <div class="panel panel-stories">
703
+ ${errorStories.map(
704
+ (ex) => `
705
+ <div class="note err">
706
+ <div class="row">
707
+ <span class="ex-name">${esc(ex.name)}</span>
708
+ <span class="badge err">story error</span>
709
+ ${ex?.warning ? '<span class="badge info">incomplete example</span>' : ""}
710
+ </div>
711
+ ${ex?.summary ? `<div class="hint">Summary: ${esc(ex.summary)}</div>` : ""}
712
+ ${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
713
+ ${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
714
+ ${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
715
+ ${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
716
+ </div>`
717
+ ).join("")}
718
+
719
+
720
+ ${c.import ? `<div class="note ok">
721
+ <div class="row">
722
+ <span class="ex-name">Imports</span>
723
+ </div>
724
+ <pre><code>${c.import}</code></pre>
725
+ </div>` : ""}
726
+
727
+ ${okStories.map(
728
+ (ex) => `
729
+ <div class="note ok">
730
+ <div class="row">
731
+ <span class="ex-name">${esc(ex.name)}</span>
732
+ <span class="badge ${ex?.warning ? "info" : "ok"}">${ex?.warning ? "incomplete example" : "story ok"}</span>
733
+ </div>
734
+ ${ex?.summary ? `<div>${esc(ex.summary)}</div>` : ""}
735
+ ${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
736
+ ${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
737
+ ${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
738
+ </div>`
739
+ ).join("")}
740
+ </div>` : ""}
741
+ ${a.totalDocs > 0 ? `
742
+ <div class="panel panel-docs">
743
+ ${errorDocs.map(
744
+ (doc) => `
745
+ <div class="note err">
746
+ <div class="row">
747
+ <span class="ex-name">${esc(doc.name)}</span>
748
+ <span class="badge err">doc error</span>
749
+ </div>
750
+ ${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
751
+ ${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
752
+ ${doc?.error?.message ? `<pre><code>${esc(doc.error.message)}</code></pre>` : ""}
753
+ </div>`
754
+ ).join("")}
755
+ ${okDocs.map(
756
+ (doc) => `
757
+ <div class="note ok">
758
+ <div class="row">
759
+ <span class="ex-name">${esc(doc.name)}</span>
760
+ <span class="badge ok">doc ok</span>
761
+ </div>
762
+ ${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
763
+ ${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
764
+ ${doc?.content ? `<div class="mdx-content"><pre><code>${esc(doc.content)}</code></pre></div>` : ""}
765
+ </div>`
766
+ ).join("")}
767
+ </div>` : ""}
768
+ ${subcomponentEntries.length > 0 ? `
769
+ <div class="panel panel-subcomponents">
770
+ ${subcomponentEntries.map(
771
+ ([subcomponentName, subcomponent]) => renderSubcomponentNote(subcomponentName, subcomponent)
772
+ ).join("")}
773
+ </div>` : ""}
774
+ </div>
775
+ </article>`;
776
+ }
777
+ var docgenRenderData = (component) => component.reactComponentMeta ? {
778
+ parsed: parseReactComponentMeta(component.reactComponentMeta),
779
+ engine: "react-component-meta",
780
+ filePath: component.reactComponentMeta.filePath,
781
+ exportName: component.reactComponentMeta.exportName
782
+ } : {};
783
+ function resolveComponentApi(component) {
784
+ if (component.error)
785
+ return { kind: "error", message: component.error.message || "Unknown error" };
786
+ let markdown = component.apiDescription?.trim();
787
+ if (markdown)
788
+ return { kind: "markdown", markdown };
789
+ let { parsed, ...source } = docgenRenderData(component), entries = Object.entries(parsed?.props ?? {}).sort(([a], [b]) => a.localeCompare(b));
790
+ return entries.length > 0 ? { kind: "props", entries, ...source } : { kind: "none" };
791
+ }
792
+ function renderPropsCode(entries) {
793
+ return entries.map(([propName, info]) => {
794
+ let description8 = (info?.description ?? "").trim(), type = (info?.type ?? "any").trim(), optional7 = info?.required ? "" : "?", defaultValue = (info?.defaultValue ?? "").trim(), fallback = defaultValue ? ` = ${defaultValue}` : "", doc = ["/**", ...description8.split(`
795
+ `).map((line) => ` * ${line}`), " */"].join(`
796
+ `) + `
797
+ `;
798
+ return `${description8 ? doc : ""}${propName}${optional7}: ${type}${fallback}`;
799
+ }).join(`
800
+
801
+ `);
802
+ }
803
+ function renderSubcomponentNote(subcomponentName, subcomponent) {
804
+ let api = resolveComponentApi(subcomponent), tags = subcomponent.jsDocTags && typeof subcomponent.jsDocTags == "object" ? Object.entries(subcomponent.jsDocTags).flatMap(
805
+ ([key, value]) => (Array.isArray(value) ? value : [value]).map(
806
+ (tagValue) => `<span class="chip">${esc(key)}: ${esc(tagValue)}</span>`
807
+ )
808
+ ).join("") : "", badgeLabel = api.kind === "error" ? "API error" : api.kind === "markdown" ? "API description" : api.kind === "props" ? `${api.entries.length} ${plural(api.entries.length, "prop type")}` : "no API description";
809
+ return `
810
+ <div class="note ${api.kind === "error" ? "err" : "ok"}">
811
+ <div class="row">
812
+ <span class="ex-name">${esc(subcomponentName)}</span>
813
+ <span class="badge ${api.kind === "error" ? "err" : api.kind === "none" ? "" : "ok"}">
814
+ ${badgeLabel}
815
+ </span>
816
+ </div>
817
+ <div class="hint">${esc(subcomponent.path)}</div>
818
+ ${subcomponent.summary ? `<div>${esc(subcomponent.summary)}</div>` : ""}
819
+ ${subcomponent.description ? `<div class="hint">${esc(subcomponent.description)}</div>` : ""}
820
+ ${tags ? `<div class="kv">${tags}</div>` : ""}
821
+ ${subcomponent.import ? `<pre><code>${esc(subcomponent.import)}</code></pre>` : ""}
822
+ ${api.kind === "error" ? `<pre><code>${esc(api.message)}</code></pre>` : ""}
823
+ ${api.kind === "markdown" ? `<pre><code>${esc(api.markdown)}</code></pre>` : ""}
824
+ ${api.kind === "props" ? `
825
+ <pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}${api.engine ? ` (${esc(api.engine)})` : ""}</code></pre>
826
+ <pre><code>${esc(renderPropsCode(api.entries))}</code></pre>` : ""}
827
+ </div>
828
+ `;
829
+ }
830
+ var parseReactComponentMeta = (reactComponentMeta) => {
831
+ let props = reactComponentMeta.props ?? {};
832
+ return {
833
+ props: Object.fromEntries(
834
+ Object.entries(props).map(([propName, prop]) => [
835
+ propName,
836
+ {
837
+ description: prop.description,
838
+ type: prop.type?.raw ?? prop.type?.name,
839
+ defaultValue: prop.defaultValue?.value,
840
+ required: prop.required
841
+ }
842
+ ])
843
+ )
844
+ };
845
+ };
846
+
847
+ // src/core-server/utils/manifests/components-manifest-styles.ts
848
+ var componentsManifestCss = `
849
+ :root {
850
+ --bg: #0b0c10;
851
+ --panel: #121318;
852
+ --muted: #9aa0a6;
853
+ --fg: #e8eaed;
854
+ --ok: #22c55e;
855
+ --info: #1e88e5;
856
+ --err: #c62828;
857
+ --ok-bg: #0c1a13;
858
+ --info-bg: #0c1624;
859
+ --err-bg: #1a0e0e;
860
+ --chip: #1f2330;
861
+ --border: #2b2f3a;
862
+ --link: #8ab4f8;
863
+ --active-ring: 1px; /* 1px active ring for pills and toggles */
864
+ }
865
+
866
+ * {
867
+ box-sizing: border-box;
868
+ }
869
+
870
+ html,
871
+ body {
872
+ margin: 0;
873
+ background: var(--bg);
874
+ color: var(--fg);
875
+ font: 14px/1.5 system-ui,
876
+ -apple-system,
877
+ Segoe UI,
878
+ Roboto,
879
+ Ubuntu,
880
+ Cantarell,
881
+ 'Helvetica Neue',
882
+ Arial,
883
+ 'Noto Sans';
884
+ }
885
+
886
+ .wrap {
887
+ max-width: 1100px;
888
+ margin: 0 auto;
889
+ padding: 16px 20px;
890
+ }
891
+
892
+ header {
893
+ position: sticky;
894
+ top: 0;
895
+ backdrop-filter: blur(6px);
896
+ background: color-mix(in srgb, var(--bg) 84%, transparent);
897
+ border-bottom: 1px solid var(--border);
898
+ z-index: 10;
899
+ }
900
+
901
+ h1 {
902
+ font-size: 20px;
903
+ margin: 0 0 6px;
904
+ }
905
+
906
+ .summary {
907
+ display: flex;
908
+ gap: 12px;
909
+ flex-wrap: wrap;
910
+ align-items: center;
911
+ }
912
+
913
+ /* Top filter pills */
914
+ .filter-pill {
915
+ display: inline-flex;
916
+ align-items: center;
917
+ gap: 6px;
918
+ padding: 6px 12px;
919
+ border: 1px solid var(--border);
920
+ border-radius: 999px;
921
+ background: var(--panel);
922
+ text-decoration: none;
923
+ cursor: pointer;
924
+ user-select: none;
925
+ color: var(--fg);
926
+ }
927
+
928
+ .filter-pill.ok {
929
+ color: #b9f6ca;
683
930
  border-color: color-mix(in srgb, var(--ok) 55%, var(--border));
684
931
  background: color-mix(in srgb, var(--ok) 18%, #000);
685
932
  }
@@ -1199,336 +1446,89 @@ function renderComponentsManifest(manifest, docsManifest) {
1199
1446
  overflow-y: auto;
1200
1447
  margin-top: 8px;
1201
1448
  }
1202
- </style>
1203
- </head>
1204
- <body>
1205
- <!-- Hidden targets for the top-level filters -->
1206
- <span id="filter-all"></span>
1207
- <span id="filter-errors"></span>
1208
- <span id="filter-infos"></span>
1209
- <span id="filter-story-errors"></span>
1210
- <span id="filter-story-warnings"></span>
1211
- <span id="filter-no-api"></span>
1212
- <span id="filter-doc-errors"></span>
1213
- <span id="filter-docs"></span>
1214
- <header>
1215
- <div class="wrap">
1216
- <h1>Manifest Debugger</h1>
1217
- <div class="summary">${allPill}${compErrorsPill}${compInfosPill}${noApiPill}${storiesPill}${snippetWarningsPill}${docsPill}</div>
1218
- </div>
1219
- </header>
1220
- <main>
1221
- <div class="wrap">
1222
- <div class="note ok" style="margin-bottom: 16px;">
1223
- Using <code>${esc(activeEngine)}</code>. Generation took <strong>${(durationMs / 1e3).toFixed(1)}s</strong>.
1224
- </div>
1225
- ${grid ? `<h2 class="section-title">Components</h2>
1226
- <div class="grid" role="list">
1227
- ${grid}
1228
- </div>` : ""}
1229
- ${errorGroups.length ? `<div class="error-groups" role="region" aria-label="API error groups">${errorGroupsHTML}</div>` : ""}
1230
- ${docsGrid ? `<h2 class="section-title">Unattached Docs</h2>
1231
- <div class="grid" role="list">
1232
- ${docsGrid}
1233
- </div>` : ""}
1234
- ${!grid && !docsGrid ? '<div class="card"><div class="head"><div class="hint">No components or docs.</div></div></div>' : ""}
1235
- </div>
1236
- </main>
1237
- </body>
1238
- </html> `;
1239
- }
1240
- var esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c] ?? c), plural = (n, one, many = `${one}s`) => n === 1 ? one : many;
1241
- function analyzeComponent(c) {
1242
- let api = resolveComponentApi(c), hasApiError = api.kind === "error", warns = [];
1243
- c.description?.trim() || warns.push("No description found. Write a jsdoc comment such as /** Component description */."), c.import?.trim() || warns.push(
1244
- `Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
1245
- );
1246
- let allStories = storyEntries(c.stories), totalStories = allStories.length, storyErrors = allStories.filter((e) => !!e?.error).length, storyWarnings = allStories.filter((e) => !!e?.warning).length, storyOk = totalStories - storyErrors, docsEntries = c.docs ? Object.values(c.docs) : [], totalDocs = docsEntries.length, docsErrors = docsEntries.filter((d) => !!d?.error).length, docsOk = totalDocs - docsErrors, hasAnyError = hasApiError || storyErrors > 0 || docsErrors > 0;
1247
- return {
1248
- api,
1249
- hasApiError,
1250
- hasAnyError,
1251
- hasWarns: warns.length > 0,
1252
- warns,
1253
- totalStories,
1254
- storyErrors,
1255
- storyWarnings,
1256
- storyOk,
1257
- totalDocs,
1258
- docsErrors,
1259
- docsOk
1260
- };
1261
- }
1262
- function analyzeDoc(d) {
1263
- return {
1264
- hasError: !!d.error
1265
- };
1266
- }
1267
- function note(title, bodyHTML, kind) {
1268
- return `
1269
- <div class="note ${kind}">
1270
- <div class="note-title">${esc(title)}</div>
1271
- <div class="note-body">${bodyHTML}</div>
1272
- </div>`;
1273
- }
1274
- function renderDocCard(key, d, id) {
1275
- let a = analyzeDoc(d), statusDot = a.hasError ? "dot-err" : "dot-ok", slug = `${id}-${(d.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, errorBadge = a.hasError ? `<label for="${slug}-err" class="badge err as-toggle">error</label>` : "", contentBadge = d.content ? `<label for="${slug}-content" class="badge ok as-toggle">view content</label>` : "";
1276
- return `
1277
- <article
1278
- class="card is-doc ${a.hasError ? "has-doc-error" : "no-doc-error"}"
1279
- role="listitem"
1280
- aria-label="${esc(d.name || key)}">
1281
- <div class="head">
1282
- <div class="title">
1283
- <h2><span class="status-dot ${statusDot}"></span> ${esc(d.title || d.name || key)}</h2>
1284
- <div class="badges">
1285
- ${errorBadge}
1286
- ${contentBadge}
1287
- </div>
1288
- </div>
1289
- <div class="meta" title="${esc(d.path ?? d.id)}">${d.path ? `${esc(d.id)} \xB7 ${esc(d.path)}` : esc(d.id)}</div>
1290
- ${d.summary ? `<div>${esc(d.summary)}</div>` : ""}
1291
- </div>
1292
-
1293
- <!-- Hidden toggles must be siblings BEFORE .panels -->
1294
- ${a.hasError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
1295
- ${d.content ? `<input id="${slug}-content" class="tg tg-content" type="checkbox" hidden />` : ""}
1296
-
1297
- <div class="panels">
1298
- ${a.hasError ? `
1299
- <div class="panel panel-err">
1300
- <div class="note err">
1301
- <div class="note-title">${esc(d.error?.name || "Error")}</div>
1302
- <div class="note-body"><pre><code>${esc(d.error?.message || "Unknown error")}</code></pre></div>
1303
- </div>
1304
- </div>` : ""}
1305
- ${d.content ? `
1306
- <div class="panel panel-content">
1307
- <div class="mdx-content">
1308
- <pre><code>${esc(d.content)}</code></pre>
1309
- </div>
1310
- </div>` : ""}
1311
- </div>
1312
- </article>`;
1313
- }
1314
- function renderComponentCard(key, c, id, anchorId) {
1315
- let a = analyzeComponent(c), statusDot = a.hasAnyError ? "dot-err" : "dot-ok", allStories = storyEntries(c.stories), errorStories = allStories.filter((ex) => !!ex?.error), okStories = allStories.filter((ex) => !ex?.error), subcomponentEntries = Object.entries(c.subcomponents ?? {}), allDocs = c.docs ? Object.values(c.docs) : [], errorDocs = allDocs.filter((d) => !!d?.error), okDocs = allDocs.filter((d) => !d?.error), slug = `c-${id}-${(c.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, { api } = a, primaryBadge = api.kind === "error" ? `<label for="${slug}-err" class="badge err as-toggle">API error</label>` : api.kind === "markdown" ? `<label for="${slug}-props" class="badge ok as-toggle">API description</label>` : api.kind === "props" ? `<label for="${slug}-props" class="badge ok as-toggle">${api.entries.length} ${plural(api.entries.length, "prop type")}</label>` : '<span class="badge">no API description</span>', infosBadge = a.hasWarns ? `<label for="${slug}-info" class="badge info as-toggle">${a.warns.length} ${plural(a.warns.length, "info", "infos")}</label>` : "", storiesBadge = a.totalStories > 0 ? `<label for="${slug}-stories" class="badge ${a.storyErrors > 0 ? "err" : "ok"} as-toggle">${a.storyErrors > 0 ? `${a.storyErrors}/${a.totalStories} story errors` : `${a.totalStories} ${plural(a.totalStories, "story", "stories")}`}${a.storyWarnings > 0 ? ` \xB7 ${a.storyWarnings} incomplete` : ""}</label>` : "", docsBadge = a.totalDocs > 0 ? `<label for="${slug}-docs" class="badge ${a.docsErrors > 0 ? "err" : "ok"} as-toggle">${a.docsErrors > 0 ? `${a.docsErrors}/${a.totalDocs} doc errors` : `${a.totalDocs} ${plural(a.totalDocs, "doc")}`}</label>` : "", subcomponentsBadge = subcomponentEntries.length > 0 ? `<label for="${slug}-subcomponents" class="badge ok as-toggle">${subcomponentEntries.length} ${plural(subcomponentEntries.length, "subcomponent")}</label>` : "", apiPanel = api.kind === "markdown" ? `
1316
- <div class="panel panel-props">
1317
- <div class="note ok">
1318
- <div class="row">
1319
- <span class="ex-name">API description</span>
1320
- ${c.renderer ? `<span class="badge ok">${esc(c.renderer)}</span>` : ""}
1321
- </div>
1322
- <pre><code>${esc(api.markdown)}</code></pre>
1323
- </div>
1324
- </div>` : api.kind === "props" ? `
1325
- <div class="panel panel-props">
1326
- <div class="note ok">
1327
- <div class="row">
1328
- <span class="ex-name">Prop types <small>(${api.engine})</small></span>
1329
- <span class="badge ok">${api.entries.length} ${plural(api.entries.length, "prop type")}</span>
1330
- </div>
1331
- <pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}</code></pre>
1332
- <pre><code>Props:</code></pre>
1333
- <pre><code>${esc(renderPropsCode(api.entries))}</code></pre>
1334
- </div>
1335
- </div>` : "", tags = c.jsDocTags && typeof c.jsDocTags == "object" ? Object.entries(c.jsDocTags).flatMap(
1336
- ([k, v10]) => (Array.isArray(v10) ? v10 : [v10]).map(
1337
- (val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
1338
- )
1339
- ).join("") : "";
1340
- return `
1341
- <article
1342
- ${anchorId ? `id="${esc(anchorId)}"` : ""}
1343
- class="card
1344
- ${a.hasApiError ? "has-error" : "no-error"}
1345
- ${a.hasWarns ? "has-info" : "no-info"}
1346
- ${a.storyErrors ? "has-story-error" : "no-story-error"}
1347
- ${a.storyWarnings ? "has-story-warning" : "no-story-warning"}
1348
- ${api.kind === "none" ? "missing-api" : ""}
1349
- ${a.docsErrors ? "has-doc-error" : "no-doc-error"}"
1350
- role="listitem"
1351
- aria-label="${esc(c.name || key)}">
1352
- <div class="head">
1353
- <div class="title">
1354
- <h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
1355
- <div class="badges">
1356
- ${primaryBadge}
1357
- ${infosBadge}
1358
- ${storiesBadge}
1359
- ${docsBadge}
1360
- ${subcomponentsBadge}
1361
- </div>
1362
- </div>
1363
- <div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
1364
- ${c.summary ? `<div>${esc(c.summary)}</div>` : ""}
1365
- ${c.description ? `<div class="hint">${esc(c.description)}</div>` : ""}
1366
- ${tags ? `<div class="kv">${tags}</div>` : ""}
1367
- </div>
1368
-
1369
- <!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
1370
- ${api.kind === "error" ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
1371
- ${a.hasWarns ? `<input id="${slug}-info" class="tg tg-info" type="checkbox" hidden />` : ""}
1372
- ${a.totalStories > 0 ? `<input id="${slug}-stories" class="tg tg-stories" type="checkbox" hidden />` : ""}
1373
- ${a.totalDocs > 0 ? `<input id="${slug}-docs" class="tg tg-docs" type="checkbox" hidden />` : ""}
1374
- ${subcomponentEntries.length > 0 ? `<input id="${slug}-subcomponents" class="tg tg-subcomponents" type="checkbox" hidden />` : ""}
1375
- ${apiPanel ? `<input id="${slug}-props" class="tg tg-props" type="checkbox" hidden />` : ""}
1376
-
1377
- <div class="panels">
1378
- ${api.kind === "error" ? `
1379
- <div class="panel panel-err">
1380
- ${note("API error", `<pre><code>${esc(api.message)}</code></pre>`, "err")}
1381
- </div>` : ""}
1382
- ${a.hasWarns ? `
1383
- <div class="panel panel-info">
1384
- ${a.warns.map((w) => note("Info", esc(w), "info")).join("")}
1385
- </div>` : ""}
1386
- ${apiPanel}
1387
- ${a.totalStories > 0 ? `
1388
- <div class="panel panel-stories">
1389
- ${errorStories.map(
1390
- (ex) => `
1391
- <div class="note err">
1392
- <div class="row">
1393
- <span class="ex-name">${esc(ex.name)}</span>
1394
- <span class="badge err">story error</span>
1395
- ${ex?.warning ? '<span class="badge info">incomplete example</span>' : ""}
1396
- </div>
1397
- ${ex?.summary ? `<div class="hint">Summary: ${esc(ex.summary)}</div>` : ""}
1398
- ${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
1399
- ${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
1400
- ${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
1401
- ${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
1402
- </div>`
1403
- ).join("")}
1404
-
1405
-
1406
- ${c.import ? `<div class="note ok">
1407
- <div class="row">
1408
- <span class="ex-name">Imports</span>
1409
- </div>
1410
- <pre><code>${c.import}</code></pre>
1411
- </div>` : ""}
1412
-
1413
- ${okStories.map(
1414
- (ex) => `
1415
- <div class="note ok">
1416
- <div class="row">
1417
- <span class="ex-name">${esc(ex.name)}</span>
1418
- <span class="badge ${ex?.warning ? "info" : "ok"}">${ex?.warning ? "incomplete example" : "story ok"}</span>
1419
- </div>
1420
- ${ex?.summary ? `<div>${esc(ex.summary)}</div>` : ""}
1421
- ${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
1422
- ${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
1423
- ${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
1424
- </div>`
1425
- ).join("")}
1426
- </div>` : ""}
1427
- ${a.totalDocs > 0 ? `
1428
- <div class="panel panel-docs">
1429
- ${errorDocs.map(
1430
- (doc) => `
1431
- <div class="note err">
1432
- <div class="row">
1433
- <span class="ex-name">${esc(doc.name)}</span>
1434
- <span class="badge err">doc error</span>
1435
- </div>
1436
- ${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
1437
- ${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
1438
- ${doc?.error?.message ? `<pre><code>${esc(doc.error.message)}</code></pre>` : ""}
1439
- </div>`
1440
- ).join("")}
1441
- ${okDocs.map(
1442
- (doc) => `
1443
- <div class="note ok">
1444
- <div class="row">
1445
- <span class="ex-name">${esc(doc.name)}</span>
1446
- <span class="badge ok">doc ok</span>
1447
- </div>
1448
- ${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
1449
- ${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
1450
- ${doc?.content ? `<div class="mdx-content"><pre><code>${esc(doc.content)}</code></pre></div>` : ""}
1451
- </div>`
1452
- ).join("")}
1453
- </div>` : ""}
1454
- ${subcomponentEntries.length > 0 ? `
1455
- <div class="panel panel-subcomponents">
1456
- ${subcomponentEntries.map(
1457
- ([subcomponentName, subcomponent]) => renderSubcomponentNote(subcomponentName, subcomponent)
1458
- ).join("")}
1459
- </div>` : ""}
1460
- </div>
1461
- </article>`;
1462
- }
1463
- var docgenRenderData = (component) => component.reactComponentMeta ? {
1464
- parsed: parseReactComponentMeta(component.reactComponentMeta),
1465
- engine: "react-component-meta",
1466
- filePath: component.reactComponentMeta.filePath,
1467
- exportName: component.reactComponentMeta.exportName
1468
- } : {};
1469
- function resolveComponentApi(component) {
1470
- if (component.error)
1471
- return { kind: "error", message: component.error.message || "Unknown error" };
1472
- let markdown = component.apiDescription?.trim();
1473
- if (markdown)
1474
- return { kind: "markdown", markdown };
1475
- let { parsed, ...source } = docgenRenderData(component), entries = Object.entries(parsed?.props ?? {}).sort(([a], [b]) => a.localeCompare(b));
1476
- return entries.length > 0 ? { kind: "props", entries, ...source } : { kind: "none" };
1477
- }
1478
- function renderPropsCode(entries) {
1479
- return entries.map(([propName, info]) => {
1480
- let description8 = (info?.description ?? "").trim(), type = (info?.type ?? "any").trim(), optional7 = info?.required ? "" : "?", defaultValue = (info?.defaultValue ?? "").trim(), fallback = defaultValue ? ` = ${defaultValue}` : "", doc = ["/**", ...description8.split(`
1481
- `).map((line) => ` * ${line}`), " */"].join(`
1482
- `) + `
1483
1449
  `;
1484
- return `${description8 ? doc : ""}${propName}${optional7}: ${type}${fallback}`;
1485
- }).join(`
1486
1450
 
1487
- `);
1488
- }
1489
- function renderSubcomponentNote(subcomponentName, subcomponent) {
1490
- let api = resolveComponentApi(subcomponent), tags = subcomponent.jsDocTags && typeof subcomponent.jsDocTags == "object" ? Object.entries(subcomponent.jsDocTags).flatMap(
1491
- ([key, value]) => (Array.isArray(value) ? value : [value]).map(
1492
- (tagValue) => `<span class="chip">${esc(key)}: ${esc(tagValue)}</span>`
1451
+ // src/core-server/utils/manifests/render-components-manifest.ts
1452
+ function renderComponentsManifest(manifest, docsManifest) {
1453
+ let entries = Object.entries(manifest?.components ?? {}).sort(
1454
+ (a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
1455
+ ), docsEntries = Object.entries(docsManifest?.docs ?? {}).sort(
1456
+ (a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
1457
+ ), analyses = entries.map(([, c]) => analyzeComponent(c)), docsAnalyses = docsEntries.map(([, d]) => analyzeDoc(d)), attachedDocs = analyses.reduce((sum, a) => sum + a.totalDocs, 0), attachedDocsWithError = analyses.reduce((sum, a) => sum + a.docsErrors, 0), unattachedDocsWithError = docsAnalyses.filter((a) => a.hasError).length, totals = {
1458
+ components: entries.length,
1459
+ componentsWithApiError: analyses.filter((a) => a.hasApiError).length,
1460
+ infos: analyses.filter((a) => a.hasWarns).length,
1461
+ stories: analyses.reduce((sum, a) => sum + a.totalStories, 0),
1462
+ storyErrors: analyses.reduce((sum, a) => sum + a.storyErrors, 0),
1463
+ storyWarnings: analyses.reduce((sum, a) => sum + a.storyWarnings, 0),
1464
+ componentsWithoutApi: analyses.filter((a) => a.api.kind === "none").length,
1465
+ docs: docsEntries.length + attachedDocs,
1466
+ docsWithError: unattachedDocsWithError + attachedDocsWithError
1467
+ }, activeEngine = manifest?.meta?.docgen ?? "react-component-meta", durationMs = manifest?.meta?.durationMs ?? 0, allPill = '<a class="filter-pill all" data-k="all" href="#filter-all">All</a>', compErrorsPill = totals.componentsWithApiError > 0 ? `<a class="filter-pill err" data-k="errors" href="#filter-errors">${totals.componentsWithApiError}/${totals.components} API ${plural(totals.componentsWithApiError, "error")}</a>` : totals.components > 0 ? `<span class="filter-pill ok" aria-disabled="true">${totals.components} components ok</span>` : "", compInfosPill = totals.infos > 0 ? `<a class="filter-pill info" data-k="infos" href="#filter-infos">${totals.infos}/${totals.components} ${plural(totals.infos, "info", "infos")}</a>` : "", storiesPill = totals.storyErrors > 0 ? `<a class="filter-pill err" data-k="story-errors" href="#filter-story-errors">${totals.storyErrors}/${totals.stories} story errors</a>` : totals.stories > 0 ? `<span class="filter-pill ok" aria-disabled="true">${totals.stories} ${plural(totals.stories, "story", "stories")} ok</span>` : "", snippetWarningsPill = totals.storyWarnings > 0 ? `<a class="filter-pill info" data-k="story-warnings" href="#filter-story-warnings">${totals.storyWarnings}/${totals.stories} incomplete snippets</a>` : "", noApiPill = totals.componentsWithoutApi > 0 ? `<a class="filter-pill" data-k="no-api" href="#filter-no-api">${totals.componentsWithoutApi}/${totals.components} without API description</a>` : "", docsPill = totals.docs > 0 ? totals.docsWithError > 0 ? `<a class="filter-pill info" data-k="docs" href="#filter-docs">${totals.docsWithError}/${totals.docs} doc ${plural(totals.docsWithError, "error")}</a>` : `<a class="filter-pill ok" data-k="docs" href="#filter-docs">${totals.docs} ${plural(totals.docs, "doc")} ok</a>` : "", grid = entries.map(([key, c], idx) => renderComponentCard(key, c, `${idx}`, key)).join(""), docsGrid = docsEntries.map(([key, d], idx) => renderDocCard(key, d, `doc-${idx}`)).join(""), errorGroups = Object.entries(
1468
+ groupBy(
1469
+ entries.map(([, it]) => it).filter((it) => it.error),
1470
+ (manifest2) => manifest2.error?.name ?? "Error"
1493
1471
  )
1494
- ).join("") : "", badgeLabel = api.kind === "error" ? "API error" : api.kind === "markdown" ? "API description" : api.kind === "props" ? `${api.entries.length} ${plural(api.entries.length, "prop type")}` : "no API description";
1495
- return `
1496
- <div class="note ${api.kind === "error" ? "err" : "ok"}">
1497
- <div class="row">
1498
- <span class="ex-name">${esc(subcomponentName)}</span>
1499
- <span class="badge ${api.kind === "error" ? "err" : api.kind === "none" ? "" : "ok"}">
1500
- ${badgeLabel}
1501
- </span>
1502
- </div>
1503
- <div class="hint">${esc(subcomponent.path)}</div>
1504
- ${subcomponent.summary ? `<div>${esc(subcomponent.summary)}</div>` : ""}
1505
- ${subcomponent.description ? `<div class="hint">${esc(subcomponent.description)}</div>` : ""}
1506
- ${tags ? `<div class="kv">${tags}</div>` : ""}
1507
- ${subcomponent.import ? `<pre><code>${esc(subcomponent.import)}</code></pre>` : ""}
1508
- ${api.kind === "error" ? `<pre><code>${esc(api.message)}</code></pre>` : ""}
1509
- ${api.kind === "markdown" ? `<pre><code>${esc(api.markdown)}</code></pre>` : ""}
1510
- ${api.kind === "props" ? `
1511
- <pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}${api.engine ? ` (${esc(api.engine)})` : ""}</code></pre>
1512
- <pre><code>${esc(renderPropsCode(api.entries))}</code></pre>` : ""}
1472
+ ).sort(([, a], [, b]) => b.length - a.length), errorGroupsHTML = errorGroups.map(([error, grouped]) => {
1473
+ let id = error.toLowerCase().replace(/[^a-z0-9]+/g, "-"), headerText = `${esc(error)}`, cards = grouped.map((manifest2, id2) => renderComponentCard(manifest2.id, manifest2, `error-${id2}`)).join("");
1474
+ return `
1475
+ <section class="group">
1476
+ <input id="${id}-toggle" class="group-tg" type="checkbox" hidden />
1477
+ <label for="${id}-toggle" class="group-header">
1478
+ <span class="caret">\u25B8</span>
1479
+ <span class="group-title">${headerText}</span>
1480
+ <span class="group-count">${grouped.length}</span>
1481
+ </label>
1482
+ <div class="group-cards">${cards}</div>
1483
+ </section>
1484
+ `;
1485
+ }).join("");
1486
+ return `<!doctype html>
1487
+ <html lang="en">
1488
+ <head>
1489
+ <meta charset="utf-8" />
1490
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
1491
+ <title>Components Manifest</title>
1492
+ <style>
1493
+ ${componentsManifestCss}
1494
+ </style>
1495
+ </head>
1496
+ <body>
1497
+ <!-- Hidden targets for the top-level filters -->
1498
+ <span id="filter-all"></span>
1499
+ <span id="filter-errors"></span>
1500
+ <span id="filter-infos"></span>
1501
+ <span id="filter-story-errors"></span>
1502
+ <span id="filter-story-warnings"></span>
1503
+ <span id="filter-no-api"></span>
1504
+ <span id="filter-doc-errors"></span>
1505
+ <span id="filter-docs"></span>
1506
+ <header>
1507
+ <div class="wrap">
1508
+ <h1>Manifest Debugger</h1>
1509
+ <div class="summary">${allPill}${compErrorsPill}${compInfosPill}${noApiPill}${storiesPill}${snippetWarningsPill}${docsPill}</div>
1510
+ </div>
1511
+ </header>
1512
+ <main>
1513
+ <div class="wrap">
1514
+ <div class="note ok" style="margin-bottom: 16px;">
1515
+ Using <code>${esc(activeEngine)}</code>. Generation took <strong>${(durationMs / 1e3).toFixed(1)}s</strong>.
1513
1516
  </div>
1514
- `;
1517
+ ${grid ? `<h2 class="section-title">Components</h2>
1518
+ <div class="grid" role="list">
1519
+ ${grid}
1520
+ </div>` : ""}
1521
+ ${errorGroups.length ? `<div class="error-groups" role="region" aria-label="API error groups">${errorGroupsHTML}</div>` : ""}
1522
+ ${docsGrid ? `<h2 class="section-title">Unattached Docs</h2>
1523
+ <div class="grid" role="list">
1524
+ ${docsGrid}
1525
+ </div>` : ""}
1526
+ ${!grid && !docsGrid ? '<div class="card"><div class="head"><div class="hint">No components or docs.</div></div></div>' : ""}
1527
+ </div>
1528
+ </main>
1529
+ </body>
1530
+ </html> `;
1515
1531
  }
1516
- var parseReactComponentMeta = (reactComponentMeta) => {
1517
- let props = reactComponentMeta.props ?? {};
1518
- return {
1519
- props: Object.fromEntries(
1520
- Object.entries(props).map(([propName, prop]) => [
1521
- propName,
1522
- {
1523
- description: prop.description,
1524
- type: prop.type?.raw ?? prop.type?.name,
1525
- defaultValue: prop.defaultValue?.value,
1526
- required: prop.required
1527
- }
1528
- ])
1529
- )
1530
- };
1531
- };
1532
1532
 
1533
1533
  // src/core-server/utils/manifests/manifests.ts
1534
1534
  function buildComponentsManifest(components, meta) {
@@ -2494,7 +2494,7 @@ var ReverseIndexImpl = class {
2494
2494
  async function walkFromStory({
2495
2495
  storyRoot,
2496
2496
  registry,
2497
- cache: cache5,
2497
+ cache: cache4,
2498
2498
  reverseIndex,
2499
2499
  recordEdges
2500
2500
  }) {
@@ -2506,7 +2506,7 @@ async function walkFromStory({
2506
2506
  let { file, depth } = queue[head++];
2507
2507
  if (registry.parserFor(file) === void 0)
2508
2508
  continue;
2509
- let resolvedDeps = await cache5.resolveOnce(file);
2509
+ let resolvedDeps = await cache4.resolveOnce(file);
2510
2510
  recordEdges(file, resolvedDeps);
2511
2511
  let nextDepth = depth + 1;
2512
2512
  for (let normalised of resolvedDeps) {
@@ -2877,7 +2877,7 @@ var ModuleGraphEngine = class {
2877
2877
  pluginParsers
2878
2878
  }), resolver = new ChangeDetectionResolverFactory(resolveConfig), workspaceRoots = /* @__PURE__ */ new Set([normalize5(getProjectRoot2())]), storyIndex = await this.options.getIndex(), storyIdsByFile = getStoryIdsByAbsolutePath(storyIndex, this.workingDir);
2879
2879
  this.storyFiles = new Set(storyIdsByFile.keys());
2880
- let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG, cache5 = new ParseResolveCache({
2880
+ let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG, cache4 = new ParseResolveCache({
2881
2881
  registry,
2882
2882
  resolver,
2883
2883
  workspaceRoots,
@@ -2890,19 +2890,19 @@ var ModuleGraphEngine = class {
2890
2890
  resolver,
2891
2891
  workspaceRoots,
2892
2892
  projectRoot,
2893
- cache: cache5
2893
+ cache: cache4
2894
2894
  });
2895
2895
  let eventBuffer = [], unsubscribeBuffer = adapter.onFileChange((event) => {
2896
2896
  eventBuffer.push({ event, receivedAt: Date.now() });
2897
2897
  }), { reverseIndex, graph } = await this.dependencyGraphBuilder.build(this.storyFiles);
2898
- this.reverseIndex = reverseIndex, this.dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache5), this.incrementalPatcher = new IncrementalPatcher({
2898
+ this.reverseIndex = reverseIndex, this.dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache4), this.incrementalPatcher = new IncrementalPatcher({
2899
2899
  reverseIndex,
2900
2900
  graph,
2901
2901
  registry,
2902
2902
  resolver,
2903
2903
  workspaceRoots,
2904
2904
  projectRoot,
2905
- cache: cache5,
2905
+ cache: cache4,
2906
2906
  isStoryFile: (path3) => this.storyFiles.has(normalize5(path3))
2907
2907
  }), unsubscribeBuffer();
2908
2908
  for (let { event, receivedAt } of eventBuffer)
@@ -2948,7 +2948,7 @@ var ModuleGraphEngine = class {
2948
2948
  });
2949
2949
  }
2950
2950
  }
2951
- async dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache5) {
2951
+ async dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache4) {
2952
2952
  let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG;
2953
2953
  if (!debugEnv)
2954
2954
  return;
@@ -2975,7 +2975,7 @@ var ModuleGraphEngine = class {
2975
2975
  // Each entry records one named-import barrel lookup: which names were requested,
2976
2976
  // which source files they resolved to, and whether the barrel itself was also
2977
2977
  // included (needBarrel: true means at least one name fell back to the barrel).
2978
- barrelResolutions: cache5.getBarrelTrace() ?? []
2978
+ barrelResolutions: cache4.getBarrelTrace() ?? []
2979
2979
  };
2980
2980
  try {
2981
2981
  await writeFile2(outPath, JSON.stringify(snapshot, null, 2), "utf8"), logger5.debug(`Change detection: graph debug snapshot written to ${outPath}`);
@@ -3355,9 +3355,9 @@ function resetChangeDetectionReadiness() {
3355
3355
  function isServerStoreLeader() {
3356
3356
  return !optionalEnvToBoolean(process.env.VITEST_CHILD_PROCESS) && !optionalEnvToBoolean(process.env.FORKBOOK_ATTACHED_TOOLS) && UniversalStore.preparedEnvironment !== UniversalStore.Environment.UNKNOWN;
3357
3357
  }
3358
- function getOrRecreateStore(id, cache5, create) {
3358
+ function getOrRecreateStore(id, cache4, create) {
3359
3359
  let leader = isServerStoreLeader();
3360
- return cache5.store !== void 0 && cache5.leader === leader || (cache5.store !== void 0 && instances.delete(id), cache5.leader = leader, cache5.store = create(leader)), cache5.store;
3360
+ return cache4.store !== void 0 && cache4.leader === leader || (cache4.store !== void 0 && instances.delete(id), cache4.leader = leader, cache4.store = create(leader)), cache4.store;
3361
3361
  }
3362
3362
 
3363
3363
  // src/core-server/stores/status.ts
@@ -3418,10 +3418,8 @@ import {
3418
3418
  import { logger as logger7, prompt } from "@aussieljk/forkbook/internal/node-logger";
3419
3419
  import {
3420
3420
  ErrorCollector,
3421
- getPrecedingUpgrade,
3422
3421
  isTelemetryStateResolved,
3423
3422
  oneWayHash,
3424
- onPayloadError,
3425
3423
  setTelemetryEnabled,
3426
3424
  telemetry,
3427
3425
  withSpan
@@ -3472,7 +3470,7 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
3472
3470
  } catch {
3473
3471
  }
3474
3472
  if (errorLevel !== "none") {
3475
- let precedingUpgrade = await getPrecedingUpgrade(), error = _error, errorHash;
3473
+ let error = _error, errorHash;
3476
3474
  "message" in error ? errorHash = error.message ? oneWayHash(error.message) : "EMPTY_MESSAGE" : errorHash = "NO_MESSAGE";
3477
3475
  let { code, name, category } = error;
3478
3476
  if (await telemetry(
@@ -3483,7 +3481,6 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
3483
3481
  category,
3484
3482
  eventType,
3485
3483
  blocking,
3486
- precedingUpgrade,
3487
3484
  error: errorLevel === "full" ? error : void 0,
3488
3485
  errorHash,
3489
3486
  // if we ever end up sending a non-error instance, we'd like to know
@@ -3491,12 +3488,7 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
3491
3488
  // Include parent error information if this is a sub-error
3492
3489
  ...parent ? { parent: parent.fullErrorCode } : {}
3493
3490
  },
3494
- {
3495
- immediate: !0,
3496
- configDir: options.cliOptions.configDir || options.presetOptions?.configDir,
3497
- enableCrashReports: errorLevel === "full",
3498
- force: !0
3499
- }
3491
+ { force: !0 }
3500
3492
  ), error && "subErrors" in error && error.subErrors.length > 0)
3501
3493
  for (let subError of error.subErrors)
3502
3494
  await sendTelemetryError(subError, eventType, options, blocking, error);
@@ -3505,16 +3497,20 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
3505
3497
  }
3506
3498
  }
3507
3499
  async function resolveTelemetryState(options) {
3508
- if (options.cliOptions.disableTelemetry !== void 0)
3509
- return await setTelemetryEnabled(!options.cliOptions.disableTelemetry);
3500
+ if (options.cliOptions.disableTelemetry !== void 0) {
3501
+ setTelemetryEnabled(!options.cliOptions.disableTelemetry);
3502
+ return;
3503
+ }
3510
3504
  let mainConfig, configDir = options.cliOptions.configDir ?? options.presetOptions?.configDir ?? defaultConfigDir();
3511
3505
  try {
3512
3506
  mainConfig = await loadMainConfig({ configDir });
3513
3507
  } catch {
3514
3508
  }
3515
- if (mainConfig)
3516
- return await setTelemetryEnabled(!mainConfig?.core?.disableTelemetry);
3517
- await setTelemetryEnabled(options.fallbackTelemetryState ?? !1);
3509
+ if (mainConfig) {
3510
+ setTelemetryEnabled(!mainConfig?.core?.disableTelemetry);
3511
+ return;
3512
+ }
3513
+ setTelemetryEnabled(options.fallbackTelemetryState ?? !1);
3518
3514
  }
3519
3515
  function isInterruptionError(error) {
3520
3516
  if (!error || typeof error != "object")
@@ -3527,12 +3523,10 @@ async function withTelemetry(eventType, options, run) {
3527
3523
  isTelemetryStateResolved() || await resolveTelemetryState(options);
3528
3524
  let canceled = !1;
3529
3525
  async function cancelTelemetry() {
3530
- canceled = !0, await telemetry("canceled", { eventType }, { stripMetadata: !0, immediate: !0 }), process.exit(0);
3526
+ canceled = !0, await telemetry("canceled", { eventType }), process.exit(0);
3531
3527
  }
3532
3528
  let trackCancellation = CANCELLATION_TRACKED_EVENTS.includes(eventType);
3533
- trackCancellation && process.on("SIGINT", cancelTelemetry), onPayloadError(async (error, evtType) => {
3534
- await sendTelemetryError(error, evtType, options);
3535
- }), telemetry("boot", { eventType }, { stripMetadata: !0 });
3529
+ trackCancellation && process.on("SIGINT", cancelTelemetry), telemetry("boot", { eventType });
3536
3530
  try {
3537
3531
  return await withSpan(`forkbook ${eventType}`, { "forkbook.command": eventType }, run);
3538
3532
  } catch (error) {
@@ -3551,7 +3545,7 @@ async function withTelemetry(eventType, options, run) {
3551
3545
  let errors = ErrorCollector.getErrors();
3552
3546
  for (let error of errors)
3553
3547
  await sendTelemetryError(error, eventType, options, !1);
3554
- process.off("SIGINT", cancelTelemetry), onPayloadError(void 0);
3548
+ process.off("SIGINT", cancelTelemetry);
3555
3549
  }
3556
3550
  }
3557
3551
 
@@ -4847,7 +4841,7 @@ async function getRefsFromConfig(options) {
4847
4841
  refs = await options.presets.apply("refs", {}) ?? {};
4848
4842
  } catch (error) {
4849
4843
  return logger8.warn(
4850
- `Composed Storybooks are left out of the docs toolset: reading "refs" failed. ${error instanceof Error ? error.message : String(error)}`
4844
+ `Composed Forkbooks are left out of the docs toolset: reading "refs" failed. ${error instanceof Error ? error.message : String(error)}`
4851
4845
  ), [];
4852
4846
  }
4853
4847
  return Object.entries(refs).filter(([, ref]) => typeof ref?.url == "string" && ref.url.length > 0 && !ref.disable).map(([key, ref]) => ({
@@ -6467,515 +6461,6 @@ var reviewToolset = defineToolset({
6467
6461
  }
6468
6462
  });
6469
6463
 
6470
- // src/shared/test-provider-store/index.ts
6471
- var UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS = {
6472
- id: "@aussieljk/forkbook/test-provider",
6473
- leader: !0,
6474
- initialState: {}
6475
- };
6476
- function createTestProviderStore({
6477
- universalTestProviderStore: universalTestProviderStore2,
6478
- useUniversalStore
6479
- }) {
6480
- let baseStore = {
6481
- settingsChanged: () => {
6482
- universalTestProviderStore2.untilReady().then(() => {
6483
- universalTestProviderStore2.send({ type: "settings-changed" });
6484
- });
6485
- },
6486
- onRunAll: (listener) => universalTestProviderStore2.subscribe("run-all", listener),
6487
- onClearAll: (listener) => universalTestProviderStore2.subscribe("clear-all", listener)
6488
- }, fullTestProviderStore2 = {
6489
- ...baseStore,
6490
- getFullState: universalTestProviderStore2.getState,
6491
- setFullState: universalTestProviderStore2.setState,
6492
- onSettingsChanged: (listener) => universalTestProviderStore2.subscribe("settings-changed", listener),
6493
- runAll: async () => {
6494
- await universalTestProviderStore2.untilReady(), universalTestProviderStore2.send({ type: "run-all" });
6495
- },
6496
- clearAll: async () => {
6497
- await universalTestProviderStore2.untilReady(), universalTestProviderStore2.send({ type: "clear-all" });
6498
- }
6499
- }, getTestProviderStoreById2 = (testProviderId) => {
6500
- let getStateForTestProvider = () => universalTestProviderStore2.getState()[testProviderId] ?? "test-provider-state:pending", setStateForTestProvider = (state) => {
6501
- universalTestProviderStore2.untilReady().then(() => {
6502
- universalTestProviderStore2.setState((currentState) => ({
6503
- ...currentState,
6504
- [testProviderId]: state
6505
- }));
6506
- });
6507
- };
6508
- return {
6509
- ...baseStore,
6510
- testProviderId,
6511
- getState: getStateForTestProvider,
6512
- setState: setStateForTestProvider,
6513
- runWithState: async (callback) => {
6514
- setStateForTestProvider("test-provider-state:running");
6515
- try {
6516
- await callback(), setStateForTestProvider("test-provider-state:succeeded");
6517
- } catch {
6518
- setStateForTestProvider("test-provider-state:crashed");
6519
- }
6520
- }
6521
- };
6522
- };
6523
- return useUniversalStore ? {
6524
- getTestProviderStoreById: getTestProviderStoreById2,
6525
- fullTestProviderStore: fullTestProviderStore2,
6526
- universalTestProviderStore: universalTestProviderStore2,
6527
- useTestProviderStore: (selector) => useUniversalStore(universalTestProviderStore2, selector)[0]
6528
- } : {
6529
- getTestProviderStoreById: getTestProviderStoreById2,
6530
- fullTestProviderStore: fullTestProviderStore2,
6531
- universalTestProviderStore: universalTestProviderStore2
6532
- };
6533
- }
6534
-
6535
- // src/core-server/stores/test-provider.ts
6536
- function createServerTestProviderStore(leader) {
6537
- return createTestProviderStore({
6538
- universalTestProviderStore: UniversalStore.create({
6539
- ...UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS,
6540
- leader
6541
- })
6542
- });
6543
- }
6544
- var cache4 = {};
6545
- function getTestProviderStoreBundle() {
6546
- return getOrRecreateStore(
6547
- UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS.id,
6548
- cache4,
6549
- createServerTestProviderStore
6550
- );
6551
- }
6552
- var getTestProviderStoreById = (id) => getTestProviderStoreBundle().getTestProviderStoreById(id), fullTestProviderStore = new Proxy(
6553
- {},
6554
- {
6555
- get(_target, prop) {
6556
- let store = getTestProviderStoreBundle().fullTestProviderStore, value = Reflect.get(store, prop, store);
6557
- return typeof value == "function" ? value.bind(store) : value;
6558
- }
6559
- }
6560
- ), universalTestProviderStore = new Proxy({}, {
6561
- get(_target, prop) {
6562
- let store = getTestProviderStoreBundle().universalTestProviderStore, value = Reflect.get(store, prop, store);
6563
- return typeof value == "function" ? value.bind(store) : value;
6564
- }
6565
- });
6566
-
6567
- // src/core-server/utils/ghost-stories/get-candidates.ts
6568
- import { readFile as readFile6 } from "node:fs/promises";
6569
- import { babelParse, traverse } from "@aussieljk/forkbook/internal/babel";
6570
-
6571
- // src/core-server/utils/ghost-stories/component-analyzer.ts
6572
- var COMPLEXITY_CONFIG = {
6573
- /** Weight applied to non-empty lines */
6574
- locWeight: 1,
6575
- /** Imports can be cheap, so they get a lower weight */
6576
- importWeight: 0.5,
6577
- /**
6578
- * Defines what raw complexity value should map to the upper bound of a "simple" file For instance
6579
- * 30 LOC + 4 imports = 32. This would result in a score of 0.3
6580
- */
6581
- simpleBaseline: 32,
6582
- simpleScore: 0.3
6583
- }, getComponentComplexity = (fileContent) => {
6584
- let lines = fileContent.split(`
6585
- `), nonEmptyLines = lines.filter((line) => line.trim() !== "").length, importCount = lines.filter((line) => line.trim().startsWith("import")).length, normalizedScore = (nonEmptyLines * COMPLEXITY_CONFIG.locWeight + importCount * COMPLEXITY_CONFIG.importWeight) / (COMPLEXITY_CONFIG.simpleBaseline / COMPLEXITY_CONFIG.simpleScore);
6586
- return Math.min(normalizedScore, 1);
6587
- };
6588
-
6589
- // src/core-server/utils/ghost-stories/get-candidates.ts
6590
- function isValidCandidate(source) {
6591
- let ast = babelParse(source), hasJSX = !1, hasExport = !1;
6592
- return traverse(ast, {
6593
- JSXElement(path3) {
6594
- hasJSX = !0, hasExport && path3.stop();
6595
- },
6596
- JSXFragment(path3) {
6597
- hasJSX = !0, hasExport && path3.stop();
6598
- },
6599
- ExportNamedDeclaration(path3) {
6600
- hasExport = !0, hasJSX && path3.stop();
6601
- },
6602
- ExportDefaultDeclaration(path3) {
6603
- hasExport = !0, hasJSX && path3.stop();
6604
- },
6605
- ExportAllDeclaration(path3) {
6606
- hasExport = !0, hasJSX && path3.stop();
6607
- }
6608
- }), hasJSX && hasExport;
6609
- }
6610
- async function getCandidatesForStorybook(files2, sampleCount) {
6611
- let simpleCandidates = [], analyzedCandidates = [];
6612
- for (let file of files2) {
6613
- let source;
6614
- try {
6615
- if (source = await readFile6(file, "utf-8"), !isValidCandidate(source))
6616
- continue;
6617
- } catch {
6618
- continue;
6619
- }
6620
- let complexity = getComponentComplexity(source);
6621
- if (analyzedCandidates.push({ file, complexity }), complexity < 0.3 && (simpleCandidates.push({ file, complexity }), simpleCandidates.length >= sampleCount))
6622
- break;
6623
- }
6624
- let selectedCandidates = [];
6625
- simpleCandidates.length >= sampleCount ? selectedCandidates = simpleCandidates.sort((a, b) => a.complexity - b.complexity).slice(0, sampleCount) : selectedCandidates = analyzedCandidates.sort((a, b) => a.complexity - b.complexity).slice(0, sampleCount);
6626
- let avgComplexity = selectedCandidates.length > 0 ? Number(
6627
- (selectedCandidates.reduce((acc, curr) => acc + curr.complexity, 0) / selectedCandidates.length).toFixed(2)
6628
- ) : 0;
6629
- return {
6630
- candidates: selectedCandidates.map(({ file }) => file),
6631
- analyzedCount: analyzedCandidates.length,
6632
- avgComplexity
6633
- };
6634
- }
6635
- async function getComponentCandidates({
6636
- sampleSize = 20,
6637
- globPattern = "**/*.{tsx,jsx}",
6638
- cwd = process.cwd()
6639
- } = {}) {
6640
- let globMatchCount = 0;
6641
- try {
6642
- let files2 = [];
6643
- if (files2 = await glob(globPattern, {
6644
- cwd,
6645
- absolute: !0,
6646
- expandDirectories: !1,
6647
- ignore: [
6648
- "**/node_modules/**",
6649
- "**/.git/**",
6650
- "**/dist/**",
6651
- "**/__mocks__/**",
6652
- "**/build/**",
6653
- "**/forkbook-static/**",
6654
- "**/*.test.*",
6655
- "**/*.d.*",
6656
- "**/*.config.*",
6657
- "**/*.spec.*",
6658
- "**/*.stories.*",
6659
- // skip example story files that come from the CLI
6660
- "**/stories/{Button,Header,Page}.*",
6661
- "**/stories/{button,header,page}.*"
6662
- ]
6663
- }), globMatchCount = files2.length, globMatchCount === 0)
6664
- return {
6665
- candidates: [],
6666
- globMatchCount
6667
- };
6668
- let { analyzedCount, avgComplexity, candidates } = await getCandidatesForStorybook(
6669
- files2,
6670
- sampleSize
6671
- );
6672
- return {
6673
- analyzedCount,
6674
- avgComplexity,
6675
- candidates,
6676
- globMatchCount
6677
- };
6678
- } catch {
6679
- return {
6680
- candidates: [],
6681
- error: "Failed to find candidates",
6682
- globMatchCount
6683
- };
6684
- }
6685
- }
6686
-
6687
- // src/shared/utils/categorize-render-errors.ts
6688
- var ERROR_CATEGORIES = {
6689
- MISSING_PROVIDER: "MISSING_PROVIDER",
6690
- MISSING_STATE_PROVIDER: "MISSING_STATE_PROVIDER",
6691
- MISSING_ROUTER_PROVIDER: "MISSING_ROUTER_PROVIDER",
6692
- MISSING_THEME_PROVIDER: "MISSING_THEME_PROVIDER",
6693
- MISSING_TRANSLATION_PROVIDER: "MISSING_TRANSLATION_PROVIDER",
6694
- MISSING_PORTAL_ROOT: "MISSING_PORTAL_ROOT",
6695
- HOOK_USAGE_ERROR: "HOOK_USAGE_ERROR",
6696
- MODULE_IMPORT_ERROR: "MODULE_IMPORT_ERROR",
6697
- COMPONENT_RENDER_ERROR: "COMPONENT_RENDER_ERROR",
6698
- SERVER_COMPONENTS_ERROR: "SERVER_COMPONENTS_ERROR",
6699
- UNKNOWN_ERROR: "UNKNOWN_ERROR",
6700
- // Vite related errors
6701
- DYNAMIC_MODULE_IMPORT_ERROR: "DYNAMIC_MODULE_IMPORT_ERROR",
6702
- // Vitest test run related errors
6703
- TEST_FILE_IMPORT_ERROR: "TEST_FILE_IMPORT_ERROR"
6704
- };
6705
- function buildErrorContext(message, stack) {
6706
- let normalizedMessage = message.toLowerCase(), normalizedStack = (stack ?? "").toLowerCase(), stackDeps = /* @__PURE__ */ new Set(), stackLines = normalizedStack.split(`
6707
- `).filter(Boolean);
6708
- for (let line of stackLines) {
6709
- let depMatch = line.match(/\/deps\/([^:]+)\.js/);
6710
- depMatch && stackDeps.add(depMatch[1]);
6711
- }
6712
- return {
6713
- message,
6714
- stack,
6715
- normalizedMessage,
6716
- normalizedStack,
6717
- stackDeps
6718
- };
6719
- }
6720
- var CATEGORIZATION_RULES = [
6721
- {
6722
- category: ERROR_CATEGORIES.MODULE_IMPORT_ERROR,
6723
- priority: 100,
6724
- match: (ctx) => ctx.normalizedMessage.includes("cannot find module") || ctx.normalizedMessage.includes("module not found") || ctx.normalizedMessage.includes("cannot resolve module")
6725
- },
6726
- {
6727
- category: ERROR_CATEGORIES.TEST_FILE_IMPORT_ERROR,
6728
- priority: 95,
6729
- match: (ctx) => ctx.normalizedMessage.includes("failed to import test file")
6730
- },
6731
- {
6732
- category: ERROR_CATEGORIES.DYNAMIC_MODULE_IMPORT_ERROR,
6733
- priority: 95,
6734
- match: (ctx) => ctx.normalizedMessage.includes("failed to fetch dynamically imported module")
6735
- },
6736
- {
6737
- category: ERROR_CATEGORIES.HOOK_USAGE_ERROR,
6738
- priority: 90,
6739
- match: (ctx) => ctx.normalizedMessage.includes("invalid hook call") || ctx.normalizedMessage.includes("rendered more hooks") || ctx.normalizedMessage.includes("hooks can only be called") || ctx.normalizedMessage.includes("too many re-renders") || ctx.normalizedMessage.includes("maximum update depth exceeded") || ctx.normalizedMessage.includes("hook") && ctx.normalizedMessage.includes("function component")
6740
- },
6741
- {
6742
- category: ERROR_CATEGORIES.MISSING_STATE_PROVIDER,
6743
- priority: 85,
6744
- match: (ctx) => Array.from(ctx.stackDeps).some(isStateManagementPackage) && (ctx.normalizedMessage.includes("context") || ctx.normalizedMessage.includes("undefined") || ctx.normalizedMessage.includes("null"))
6745
- },
6746
- {
6747
- category: ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER,
6748
- priority: 85,
6749
- match: (ctx) => Array.from(ctx.stackDeps).some(isRouterPackage) || ctx.normalizedMessage.includes("usenavigate") || ctx.normalizedMessage.includes("router")
6750
- },
6751
- {
6752
- category: ERROR_CATEGORIES.SERVER_COMPONENTS_ERROR,
6753
- priority: 85,
6754
- match: (ctx) => ctx.normalizedMessage.includes("server components") || ctx.normalizedMessage.includes("use client") || ctx.normalizedMessage.includes("async/await") && ctx.normalizedMessage.includes("not supported")
6755
- },
6756
- {
6757
- category: ERROR_CATEGORIES.MISSING_THEME_PROVIDER,
6758
- priority: 80,
6759
- match: (ctx) => Array.from(ctx.stackDeps).some(isStylingPackage) && (ctx.normalizedMessage.includes("theme") || ctx.normalizedMessage.includes("undefined")) || ctx.normalizedMessage.includes("usetheme") || ctx.normalizedMessage.includes("theme") && ctx.normalizedMessage.includes("provider")
6760
- },
6761
- {
6762
- category: ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER,
6763
- priority: 80,
6764
- match: (ctx) => Array.from(ctx.stackDeps).some(isI18nPackage) || ctx.normalizedMessage.includes("i18n") || ctx.normalizedMessage.includes("translation") || ctx.normalizedMessage.includes("locale")
6765
- },
6766
- {
6767
- category: ERROR_CATEGORIES.MISSING_PORTAL_ROOT,
6768
- priority: 70,
6769
- match: (ctx) => ctx.normalizedMessage.includes("target container is not a dom element") || ctx.normalizedMessage.includes("portal") && (ctx.normalizedMessage.includes("container") || ctx.normalizedMessage.includes("root"))
6770
- },
6771
- {
6772
- category: ERROR_CATEGORIES.MISSING_PROVIDER,
6773
- priority: 60,
6774
- match: (ctx) => ctx.normalizedMessage.includes("use") && ctx.normalizedMessage.includes("provider") || ctx.normalizedMessage.includes("<provider>") || ctx.normalizedMessage.includes("no provider") || ctx.normalizedMessage.includes("without a provider") || (ctx.normalizedMessage.includes("could not find") || ctx.normalizedMessage.includes("missing") || ctx.normalizedMessage.includes("not found")) && ctx.normalizedMessage.includes("context") || ctx.normalizedMessage.includes("context") && (ctx.normalizedMessage.includes("null") || ctx.normalizedMessage.includes("undefined"))
6775
- },
6776
- {
6777
- category: ERROR_CATEGORIES.COMPONENT_RENDER_ERROR,
6778
- priority: 10,
6779
- match: (ctx) => ctx.normalizedMessage.includes("cannot read") || ctx.normalizedMessage.includes("is not a function") || ctx.normalizedMessage.includes("is not an object") || ctx.normalizedMessage.includes("is not defined") || ctx.normalizedMessage.includes("element type is invalid") || ctx.normalizedMessage.includes("objects are not valid as a react child") || ctx.normalizedMessage.includes("maximum call stack") || ctx.normalizedMessage.includes("render")
6780
- }
6781
- ], RULES = CATEGORIZATION_RULES.sort((a, b) => b.priority - a.priority);
6782
- function categorizeError(message, stack) {
6783
- let ctx = buildErrorContext(message, stack), rule = RULES.find((r) => r.match(ctx));
6784
- if (!rule)
6785
- return { category: ERROR_CATEGORIES.UNKNOWN_ERROR, matchedDependencies: [] };
6786
- let matchedDependencies = getMatchedDependencies(rule.category, ctx);
6787
- return { category: rule.category, matchedDependencies };
6788
- }
6789
- function getMatchedDependencies(category, ctx) {
6790
- switch (category) {
6791
- case ERROR_CATEGORIES.MISSING_STATE_PROVIDER:
6792
- return Array.from(ctx.stackDeps).filter(isStateManagementPackage);
6793
- case ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER:
6794
- return Array.from(ctx.stackDeps).filter(isRouterPackage);
6795
- case ERROR_CATEGORIES.MISSING_THEME_PROVIDER:
6796
- return Array.from(ctx.stackDeps).filter(isStylingPackage);
6797
- case ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER:
6798
- return Array.from(ctx.stackDeps).filter(isI18nPackage);
6799
- default:
6800
- return [];
6801
- }
6802
- }
6803
-
6804
- // src/shared/utils/analyze-test-results.ts
6805
- function extractCategorizedErrors(testResults) {
6806
- let failed = testResults.filter((r) => r.status === "FAIL" && r.error), map = /* @__PURE__ */ new Map(), uniqueErrorMessages = /* @__PURE__ */ new Set();
6807
- for (let r of failed) {
6808
- let { category, matchedDependencies } = categorizeError(r.error, r.stack);
6809
- map.has(category) || map.set(category, { count: 0, uniqueErrors: /* @__PURE__ */ new Set(), matchedDependencies: /* @__PURE__ */ new Set() });
6810
- let data = map.get(category);
6811
- data.count++, matchedDependencies.forEach((dep) => data.matchedDependencies.add(dep)), uniqueErrorMessages.add(r.error), data.uniqueErrors.add(r.error);
6812
- }
6813
- let categorizedErrors = Array.from(map.entries()).reduce(
6814
- (acc, [category, data]) => (acc[category] = {
6815
- uniqueCount: data.uniqueErrors.size,
6816
- count: data.count,
6817
- matchedDependencies: Array.from(data.matchedDependencies).sort()
6818
- }, acc),
6819
- {}
6820
- );
6821
- return {
6822
- totalErrors: failed.length,
6823
- uniqueErrorCount: uniqueErrorMessages.size,
6824
- categorizedErrors
6825
- };
6826
- }
6827
- var CSS_CHECK_STORY_ID_SUFFIX = "--css-check";
6828
- function summarizeResults(results) {
6829
- let total = results.length, passed = results.filter((r) => r.status === "PASS").length, passedButEmptyRender = results.filter((r) => r.status === "PASS" && r.emptyRender).length, successRate = total > 0 ? parseFloat((passed / total).toFixed(2)) : 0, successRateWithoutEmptyRender = total > 0 ? parseFloat(((passed - passedButEmptyRender) / total).toFixed(2)) : 0, errorClassification = extractCategorizedErrors(results), cssCheckMatch = results.find(
6830
- (r) => r.storyId.toLowerCase().endsWith(CSS_CHECK_STORY_ID_SUFFIX)
6831
- ), cssCheck = cssCheckMatch?.status === "PASS" ? "pass" : cssCheckMatch?.status === "FAIL" ? "fail" : "not-run";
6832
- return {
6833
- total,
6834
- passed,
6835
- passedButEmptyRender,
6836
- successRate,
6837
- successRateWithoutEmptyRender,
6838
- uniqueErrorCount: errorClassification.uniqueErrorCount,
6839
- categorizedErrors: errorClassification.categorizedErrors,
6840
- cssCheck
6841
- };
6842
- }
6843
- function analyzeTestResults(results, cumulativeResults) {
6844
- let run = summarizeResults(results), analysis = {
6845
- total: run.total,
6846
- passed: run.passed,
6847
- passedButEmptyRender: run.passedButEmptyRender,
6848
- successRate: run.successRate,
6849
- successRateWithoutEmptyRender: run.successRateWithoutEmptyRender,
6850
- uniqueErrorCount: run.uniqueErrorCount,
6851
- categorizedErrors: run.categorizedErrors,
6852
- cssCheck: run.cssCheck
6853
- };
6854
- if (cumulativeResults) {
6855
- let cumulative = summarizeResults(cumulativeResults);
6856
- analysis.cumulativeTotal = cumulative.total, analysis.cumulativePassed = cumulative.passed, analysis.cumulativePassedButEmptyRender = cumulative.passedButEmptyRender, analysis.cumulativeSuccessRate = cumulative.successRate, analysis.cumulativeSuccessRateWithoutEmptyRender = cumulative.successRateWithoutEmptyRender, analysis.cumulativeUniqueErrorCount = cumulative.uniqueErrorCount, analysis.cumulativeCategorizedErrors = cumulative.categorizedErrors, analysis.cumulativeCssCheck = cumulative.cssCheck;
6857
- }
6858
- return analysis;
6859
- }
6860
-
6861
- // src/shared/utils/to-story-test-result.ts
6862
- var DEBUG_BANNER_RE = /^\n(?:\x1B\[\d+m)?Click to debug\b[^\n]*\n\n/;
6863
- function extractErrorMessage(message, stack) {
6864
- return (message ?? "").replace(DEBUG_BANNER_RE, "").split(`
6865
- `)[0] || stack?.split(`
6866
- `)[0] || "unknown error";
6867
- }
6868
- function detectEmptyRender(reports) {
6869
- return reports?.some(
6870
- (report) => report.type === "render-analysis" && report.result?.emptyRender === !0
6871
- ) ?? !1;
6872
- }
6873
- function normalizeStatus(statusRaw) {
6874
- return statusRaw === "passed" ? "PASS" : statusRaw === "failed" ? "FAIL" : "PENDING";
6875
- }
6876
- function toStoryTestResult(input) {
6877
- if (!input.storyId)
6878
- return null;
6879
- let status = normalizeStatus(input.statusRaw), emptyRender = status === "PASS" && detectEmptyRender(input.reports), error, stack;
6880
- if (input.errors && input.errors.length > 0) {
6881
- let firstError = input.errors[0];
6882
- error = extractErrorMessage(firstError.message, firstError.stack), stack = firstError.stack ?? firstError.message;
6883
- }
6884
- return {
6885
- storyId: input.storyId,
6886
- status,
6887
- error,
6888
- stack,
6889
- emptyRender: emptyRender || void 0
6890
- };
6891
- }
6892
-
6893
- // src/core-server/utils/ghost-stories/run-story-tests.ts
6894
- import { existsSync as existsSync4 } from "node:fs";
6895
- import { mkdir as mkdir2, readFile as readFile7 } from "node:fs/promises";
6896
- import { executeCommand, resolvePathInStorybookCache as resolvePathInStorybookCache2 } from "@aussieljk/forkbook/internal/common";
6897
- import { join as join11 } from "pathe";
6898
-
6899
- // src/core-server/utils/ghost-stories/parse-vitest-report.ts
6900
- function parseVitestResults(report) {
6901
- let storyTestResults = [];
6902
- for (let testSuite of report.testResults)
6903
- for (let assertion of testSuite.assertionResults) {
6904
- let result = toStoryTestResult({
6905
- storyId: assertion.meta?.storyId ?? assertion.fullName,
6906
- statusRaw: assertion.status,
6907
- reports: assertion.meta?.reports,
6908
- errors: assertion.failureMessages?.map((message) => ({ stack: message }))
6909
- });
6910
- result && storyTestResults.push(result);
6911
- }
6912
- return {
6913
- summary: analyzeTestResults(storyTestResults)
6914
- };
6915
- }
6916
-
6917
- // src/core-server/utils/ghost-stories/run-story-tests.ts
6918
- async function runStoryTests(componentFilePaths, options) {
6919
- let cwd = options?.cwd;
6920
- try {
6921
- let cacheDir2 = resolvePathInStorybookCache2("story-tests");
6922
- await mkdir2(cacheDir2, { recursive: !0 });
6923
- let timestamp = Date.now(), outputFile = join11(cacheDir2, `test-results-${timestamp}.json`), startTime = Date.now(), testFailureMessage;
6924
- try {
6925
- await executeCommand({
6926
- command: "npx",
6927
- args: [
6928
- "vitest",
6929
- "run",
6930
- "--reporter=json",
6931
- "--testTimeout=1000",
6932
- `--outputFile=${outputFile}`,
6933
- ...componentFilePaths
6934
- ],
6935
- cwd,
6936
- stdio: "pipe",
6937
- env: {
6938
- FORKBOOK_INTERNAL_TEST_RUN: "1",
6939
- ...options?.ghostRun ? { FORKBOOK_COMPONENT_PATHS: componentFilePaths.join(";") } : {}
6940
- }
6941
- });
6942
- } catch (error) {
6943
- let errorMessage = (error.stderr || String(error) || "").toLowerCase();
6944
- errorMessage.includes("browsertype.launch") ? testFailureMessage = "Playwright is not installed" : errorMessage.includes("startup error") ? testFailureMessage = "Startup Error" : errorMessage.includes("no tests found") ? testFailureMessage = "No tests found" : errorMessage.includes("test timeout") ? testFailureMessage = "Test timeout" : errorMessage.includes("react-native-web") ? testFailureMessage = "React Native Web error" : errorMessage.includes("unhandled rejection") && (testFailureMessage = "Unhandled Rejection");
6945
- }
6946
- let duration = Date.now() - startTime;
6947
- if (testFailureMessage)
6948
- return {
6949
- duration,
6950
- runError: testFailureMessage
6951
- };
6952
- if (!existsSync4(outputFile))
6953
- return {
6954
- duration,
6955
- runError: "JSON report not found"
6956
- };
6957
- let vitestReport;
6958
- try {
6959
- let resultsJson = await readFile7(outputFile, "utf8");
6960
- vitestReport = JSON.parse(resultsJson);
6961
- } catch {
6962
- return {
6963
- duration,
6964
- runError: "Failed to read or parse JSON report"
6965
- };
6966
- }
6967
- return !vitestReport.testResults || vitestReport.testResults.length === 0 ? {
6968
- duration,
6969
- runError: "No tests found"
6970
- } : { ...parseVitestResults(vitestReport), duration };
6971
- } catch {
6972
- return {
6973
- runError: "Uncaught error running story tests",
6974
- duration: 0
6975
- };
6976
- }
6977
- }
6978
-
6979
6464
  // src/shared/open-service/services/story-docs/snippet.ts
6980
6465
  function prependImportToSnippet(importBlock, snippet) {
6981
6466
  let trimmedImport = importBlock?.trim();
@@ -7013,6 +6498,7 @@ export {
7013
6498
  getChangeDetectionReadiness,
7014
6499
  setChangeDetectionReadiness,
7015
6500
  resetChangeDetectionReadiness,
6501
+ getOrRecreateStore,
7016
6502
  getStatusStoreByTypeId,
7017
6503
  getSyncedStatuses,
7018
6504
  fullStatusStore,
@@ -7033,12 +6519,5 @@ export {
7033
6519
  createLocalDocsAccess,
7034
6520
  getRefsFromConfig,
7035
6521
  createStoriesToolset,
7036
- reviewToolset,
7037
- getTestProviderStoreById,
7038
- fullTestProviderStore,
7039
- universalTestProviderStore,
7040
- getComponentCandidates,
7041
- analyzeTestResults,
7042
- toStoryTestResult,
7043
- runStoryTests
6522
+ reviewToolset
7044
6523
  };