@aussieljk/forkbook 0.0.1-2 → 0.0.1-21

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 (536) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +35 -53
  3. package/assets/addon-vitest/templates/vitest.config.4.template.ts +2 -2
  4. package/assets/browser/favicon-wrapper.svg +4 -4
  5. package/assets/browser/favicon.svg +1 -1
  6. package/assets/browser/inter-LICENSE.txt +92 -0
  7. package/assets/browser/inter-variable-italic.woff2 +0 -0
  8. package/assets/browser/inter-variable.woff2 +0 -0
  9. package/assets/browser/mirror-ball.png +0 -0
  10. package/assets/builder-vite/iframe.html +8 -24
  11. package/assets/create/rendererAssets/common/Configure.mdx +100 -100
  12. package/assets/create/rendererAssets/common/button.css +7 -7
  13. package/assets/create/rendererAssets/common/header.css +6 -6
  14. package/assets/create/rendererAssets/common/page.css +12 -12
  15. package/assets/create/templates/react-native/index.expo.js +4 -4
  16. package/assets/create/templates/react-native/index.js +5 -5
  17. package/assets/server/base-preview-body.html +32 -32
  18. package/assets/server/base-preview-head.html +86 -86
  19. package/assets/server/template.ejs +31 -26
  20. package/dist/_browser-chunks/{Color-PCLE2J36.js → Color-7FO5YFB5.js} +8 -8
  21. package/dist/_browser-chunks/{DocsRenderer-JXND3PVQ.js → DocsRenderer-DKXSW2OY.js} +2 -2
  22. package/dist/_browser-chunks/WithTooltip-QWFSUQZP.js +199 -0
  23. package/dist/_browser-chunks/{chunk-RBCHTR7C.js → chunk-2ELGJRFZ.js} +1 -1
  24. package/dist/_browser-chunks/{chunk-PFRNG3UC.js → chunk-2WZWS7GJ.js} +5 -5
  25. package/dist/_browser-chunks/{chunk-52CW7FF7.js → chunk-3QNZOMD7.js} +8 -3
  26. package/dist/_browser-chunks/{chunk-LV5PIKV4.js → chunk-3QPZOXB7.js} +6 -8
  27. package/dist/_browser-chunks/{chunk-ODVJ3XZJ.js → chunk-4BOJAE7P.js} +14 -10
  28. package/dist/_browser-chunks/{chunk-2MEPHP35.js → chunk-4KIQBRD2.js} +1 -1
  29. package/dist/_browser-chunks/{chunk-KQ7CRO2B.js → chunk-5Z3MWCFR.js} +12 -12
  30. package/dist/_browser-chunks/chunk-6AKCRYVX.js +6 -0
  31. package/dist/_browser-chunks/{chunk-W5M6NPS3.js → chunk-6SL45YM3.js} +15 -18
  32. package/dist/_browser-chunks/{chunk-2SCZVUKW.js → chunk-AN2LJG5I.js} +1 -1
  33. package/dist/_browser-chunks/{chunk-P6PK47TQ.js → chunk-BLCZ3C5M.js} +48 -83
  34. package/dist/_browser-chunks/{chunk-RSPAQWVJ.js → chunk-BNP234B4.js} +1 -1
  35. package/dist/_browser-chunks/{chunk-JYVGARBG.js → chunk-BSYOFSF6.js} +770 -720
  36. package/dist/_browser-chunks/{chunk-JSBKXXXF.js → chunk-DHTLVXAL.js} +38 -45
  37. package/dist/_browser-chunks/{chunk-GNZY6LOW.js → chunk-DISGPOF4.js} +54 -51
  38. package/dist/_browser-chunks/chunk-DNJ3OSLB.js +6021 -0
  39. package/dist/_browser-chunks/{chunk-6SXYJQST.js → chunk-E6QKKKLO.js} +21 -6
  40. package/dist/_browser-chunks/{chunk-FJGWSWL5.js → chunk-EBSOKHFG.js} +10 -4
  41. package/dist/_browser-chunks/{chunk-CFAOWGL7.js → chunk-ECMVTOVD.js} +1 -1
  42. package/dist/_browser-chunks/{chunk-CFWWCCZV.js → chunk-ENHFQXYS.js} +9 -7
  43. package/dist/_browser-chunks/{chunk-YTIT5NA5.js → chunk-EW2M3URL.js} +91 -84
  44. package/dist/_browser-chunks/chunk-FAOLWWRN.js +20 -0
  45. package/dist/_browser-chunks/{chunk-MFMDGWP6.js → chunk-FCULT3AE.js} +3 -3
  46. package/dist/_browser-chunks/{chunk-46Z7NGAS.js → chunk-HX443LKV.js} +1 -1
  47. package/dist/_browser-chunks/chunk-HZFHNYRC.js +53 -0
  48. package/dist/_browser-chunks/chunk-IFADVEQE.js +669 -0
  49. package/dist/_browser-chunks/{chunk-OQWFVDIN.js → chunk-KQJ4T6JL.js} +31 -25
  50. package/dist/_browser-chunks/{chunk-RNTIV5CE.js → chunk-LYYXDWR2.js} +9 -9
  51. package/dist/_browser-chunks/{chunk-V5M7Q4HT.js → chunk-MJIDTL3X.js} +4 -14
  52. package/dist/_browser-chunks/{chunk-V2G23FV7.js → chunk-N5WQGLI7.js} +1 -1
  53. package/dist/_browser-chunks/{chunk-EIYAKDGP.js → chunk-NA4ITZTK.js} +127 -105
  54. package/dist/_browser-chunks/{chunk-RMYQ3QN3.js → chunk-NK5SGJNG.js} +22 -17
  55. package/dist/_browser-chunks/chunk-NPNIBOPF.js +18 -0
  56. package/dist/_browser-chunks/{chunk-YEKO6BHJ.js → chunk-ONTSNQON.js} +1 -1
  57. package/dist/_browser-chunks/chunk-OOETBSA7.js +502 -0
  58. package/dist/_browser-chunks/chunk-PFYL47RM.js +45 -0
  59. package/dist/_browser-chunks/{chunk-OD6IBQCC.js → chunk-PQRPDA4U.js} +5 -5
  60. package/dist/_browser-chunks/{chunk-2JDQ35OA.js → chunk-PU7D2WDP.js} +0 -11
  61. package/dist/_browser-chunks/chunk-PZQRXPVR.js +21 -0
  62. package/dist/_browser-chunks/{chunk-5WMXI5GW.js → chunk-QFO2B4X2.js} +31 -28
  63. package/dist/_browser-chunks/{chunk-2JT76G3E.js → chunk-SBOQ4QPY.js} +15 -15
  64. package/dist/_browser-chunks/{chunk-ZTQ5MEJ5.js → chunk-UMGDO2ZM.js} +3 -37
  65. package/dist/_browser-chunks/{chunk-5I7E4GMO.js → chunk-WY2LUGOH.js} +1 -1
  66. package/dist/_browser-chunks/chunk-XKTORVEQ.js +255 -0
  67. package/dist/_browser-chunks/chunk-XSVERCGB.js +91 -0
  68. package/dist/_browser-chunks/{chunk-FVSEPWWX.js → chunk-XTQCLWVH.js} +325 -1635
  69. package/dist/_browser-chunks/{chunk-MDOL7KML.js → chunk-YJO5BK52.js} +7 -3
  70. package/dist/_browser-chunks/{chunk-66OCZ54D.js → chunk-ZF37BMDS.js} +6 -2
  71. package/dist/_browser-chunks/{chunk-C3D4HEFY.js → chunk-ZIZCGWCG.js} +348 -170
  72. package/dist/_browser-chunks/{matchers-YLBYSYAF.js → matchers-2HVLNCVO.js} +4 -4
  73. package/dist/_browser-chunks/{react-dom-client-4OHE3QDV.js → react-dom-client-SLBUX3U3.js} +1 -1
  74. package/dist/_node-chunks/{attached-runtime-I2G4WLJI.js → attached-runtime-UC2CB4GH.js} +37 -35
  75. package/dist/_node-chunks/builder-manager-S5UUKVOR.js +1174 -0
  76. package/dist/_node-chunks/{chunk-OUW6R7C3.js → chunk-3335ZZIO.js} +6 -6
  77. package/dist/_node-chunks/{chunk-V2DY426G.js → chunk-3D6N6P2R.js} +283 -306
  78. package/dist/_node-chunks/{chunk-3Y6AAY5H.js → chunk-3ER54PQM.js} +8 -8
  79. package/dist/_node-chunks/{chunk-DC7DKR5K.js → chunk-3H5C52QU.js} +6 -6
  80. package/dist/_node-chunks/chunk-3UI3TQ7R.js +28 -0
  81. package/dist/_node-chunks/{chunk-Q7QNUM5H.js → chunk-4C3ACAHV.js} +6 -6
  82. package/dist/_node-chunks/{chunk-XGIUVY52.js → chunk-4UTCKJEQ.js} +7 -7
  83. package/dist/_node-chunks/chunk-53A5CYDK.js +572 -0
  84. package/dist/_node-chunks/{chunk-4FEANXWU.js → chunk-53PSBDRK.js} +140 -118
  85. package/dist/_node-chunks/{chunk-3W7F2B7P.js → chunk-54MO4QLB.js} +6 -6
  86. package/dist/_node-chunks/{chunk-7GUDZVRQ.js → chunk-5CJMRQZ6.js} +6 -6
  87. package/dist/_node-chunks/chunk-5HOM7B4V.js +20 -0
  88. package/dist/_node-chunks/{chunk-BSKFCWQD.js → chunk-5QG6AXK4.js} +7 -7
  89. package/dist/_node-chunks/chunk-67XVZZUO.js +405 -0
  90. package/dist/_node-chunks/{chunk-EWOX7HPJ.js → chunk-6HQJJDLH.js} +6 -6
  91. package/dist/_node-chunks/chunk-6IPHWCFI.js +29 -0
  92. package/dist/_node-chunks/{chunk-NDWKJ4CL.js → chunk-6XYOFBRD.js} +98 -129
  93. package/dist/_node-chunks/{chunk-TNJIXE37.js → chunk-7IAYDGYH.js} +6 -6
  94. package/dist/_node-chunks/{chunk-ICPBH3E7.js → chunk-7P67PUU2.js} +7 -7
  95. package/dist/_node-chunks/{chunk-XLP2ZKXV.js → chunk-AAK5BBF2.js} +7 -7
  96. package/dist/_node-chunks/{chunk-CCOTJ4FC.js → chunk-BGUVBOOU.js} +10 -10
  97. package/dist/_node-chunks/chunk-BNGBOASQ.js +25 -0
  98. package/dist/_node-chunks/{chunk-VLOXOXXE.js → chunk-BWZWCVVH.js} +9 -9
  99. package/dist/_node-chunks/{chunk-SWO5CDYU.js → chunk-C6HQ6WLU.js} +8 -8
  100. package/dist/_node-chunks/chunk-CJHRH777.js +20 -0
  101. package/dist/_node-chunks/{chunk-IK4FGZLR.js → chunk-COEW4ORP.js} +6 -6
  102. package/dist/_node-chunks/{chunk-JGGFYIG5.js → chunk-CVHDAEDZ.js} +7 -7
  103. package/dist/_node-chunks/{chunk-YCMRA6RX.js → chunk-CXGOQNGI.js} +7 -7
  104. package/dist/_node-chunks/chunk-D4XTQWRM.js +11 -0
  105. package/dist/_node-chunks/{chunk-BS2WMZMR.js → chunk-D5V6CZ6U.js} +7 -7
  106. package/dist/_node-chunks/{chunk-XHL2LVBM.js → chunk-DCTXJ4TT.js} +14 -16
  107. package/dist/_node-chunks/{chunk-WCULS5TP.js → chunk-DP6WFY3D.js} +7 -7
  108. package/dist/_node-chunks/chunk-E23GDXG6.js +271 -0
  109. package/dist/_node-chunks/{chunk-GEFQN7K3.js → chunk-E3ZFMURC.js} +8 -8
  110. package/dist/_node-chunks/{chunk-WZJF2OUH.js → chunk-E6O3NA44.js} +7 -7
  111. package/dist/_node-chunks/{chunk-RWFIFGO5.js → chunk-ECS3WDOU.js} +8 -8
  112. package/dist/_node-chunks/{chunk-XI6B6P47.js → chunk-FB5YJWOH.js} +6 -6
  113. package/dist/_node-chunks/{chunk-3SDUYDXH.js → chunk-FCK5FM6D.js} +7 -7
  114. package/dist/_node-chunks/{chunk-6YKBRP72.js → chunk-FJUGPEJK.js} +6 -6
  115. package/dist/_node-chunks/{chunk-TFEWM4E3.js → chunk-FPYXI76E.js} +75 -75
  116. package/dist/_node-chunks/chunk-GEWVOY3F.js +62 -0
  117. package/dist/_node-chunks/{chunk-ET7PWEO7.js → chunk-GHZ44BFB.js} +14 -13
  118. package/dist/_node-chunks/{chunk-LXBD4UL4.js → chunk-GJMFISS3.js} +8 -8
  119. package/dist/_node-chunks/{chunk-FK7KGTV7.js → chunk-GK2Y2RFX.js} +7 -7
  120. package/dist/_node-chunks/{chunk-FPZB5OI7.js → chunk-GP6YBA2R.js} +6 -6
  121. package/dist/_node-chunks/{chunk-34EO2PUT.js → chunk-GQUFGJ4D.js} +6 -6
  122. package/dist/_node-chunks/{chunk-HMP2G23X.js → chunk-H4CRQDTK.js} +6 -6
  123. package/dist/_node-chunks/{chunk-2BUPBPFB.js → chunk-HCDG54OG.js} +7 -7
  124. package/dist/_node-chunks/{chunk-U5W53R2J.js → chunk-HGJMP4EI.js} +506 -494
  125. package/dist/_node-chunks/chunk-HSX6BDBA.js +18 -0
  126. package/dist/_node-chunks/{chunk-UMUBKI6E.js → chunk-IPFPWMT5.js} +1320 -437
  127. package/dist/_node-chunks/chunk-KRIOC4WF.js +281 -0
  128. package/dist/_node-chunks/{chunk-TINO74G5.js → chunk-KUL2MJ6N.js} +6 -6
  129. package/dist/_node-chunks/{chunk-LO56I6E2.js → chunk-LUR6QTYB.js} +10 -10
  130. package/dist/_node-chunks/{chunk-YZFWBA5L.js → chunk-LYS7TI35.js} +368 -321
  131. package/dist/_node-chunks/chunk-MDTXL6SN.js +2613 -0
  132. package/dist/_node-chunks/{chunk-LCK4ZQKG.js → chunk-MIIPXT4S.js} +9 -9
  133. package/dist/_node-chunks/chunk-MLWGAA2I.js +138 -0
  134. package/dist/_node-chunks/{chunk-42UWAGPW.js → chunk-MWUGCUB5.js} +52 -22
  135. package/dist/_node-chunks/{chunk-JDXXX6LB.js → chunk-MX5MVLEK.js} +6 -6
  136. package/dist/_node-chunks/chunk-N44UIGCO.js +47 -0
  137. package/dist/_node-chunks/{chunk-OISX4AGQ.js → chunk-NP2JHOFY.js} +37 -31
  138. package/dist/_node-chunks/chunk-OMNGOPNG.js +52 -0
  139. package/dist/_node-chunks/{chunk-ZWBCQ4MJ.js → chunk-OO2GTHUF.js} +9 -17
  140. package/dist/_node-chunks/{chunk-F3ZFKBHY.js → chunk-PC57BIYZ.js} +8 -8
  141. package/dist/_node-chunks/chunk-PHWMAF5C.js +49 -0
  142. package/dist/_node-chunks/{chunk-B5J7Q7J4.js → chunk-PLIQQETC.js} +7 -7
  143. package/dist/_node-chunks/{chunk-H32DYT6P.js → chunk-QMYCIS2U.js} +6 -6
  144. package/dist/_node-chunks/{chunk-DUR55DJJ.js → chunk-QZIDK3GX.js} +89 -71
  145. package/dist/_node-chunks/{chunk-UVINFLGY.js → chunk-ROJ6RSIJ.js} +7 -7
  146. package/dist/_node-chunks/{chunk-E6YESGLX.js → chunk-S2NB6QEG.js} +542 -1049
  147. package/dist/_node-chunks/{chunk-TWI4GVH7.js → chunk-S6VCOSQS.js} +6 -6
  148. package/dist/_node-chunks/{chunk-KISMCCP5.js → chunk-SEVOOOB2.js} +474 -479
  149. package/dist/_node-chunks/{chunk-JZOO7GGC.js → chunk-SFT6ZAVN.js} +6 -6
  150. package/dist/_node-chunks/{chunk-RRN2V55B.js → chunk-SXBUK4F6.js} +7 -7
  151. package/dist/_node-chunks/{chunk-WNZ2UMFM.js → chunk-TGF6Q66I.js} +15 -9
  152. package/dist/_node-chunks/{chunk-NIBT7XDZ.js → chunk-TGFHWGGT.js} +9 -6
  153. package/dist/_node-chunks/chunk-TTLSBLPQ.js +620 -0
  154. package/dist/_node-chunks/{chunk-SVTBJ7Q3.js → chunk-UUAEW2AR.js} +6 -6
  155. package/dist/_node-chunks/chunk-VQHM66NL.js +534 -0
  156. package/dist/_node-chunks/{chunk-H4PPVMP5.js → chunk-VSTTY3TM.js} +6 -6
  157. package/dist/_node-chunks/{chunk-2DSIDINN.js → chunk-XDBSAFUB.js} +650 -9
  158. package/dist/_node-chunks/{chunk-OWNFOGTA.js → chunk-XTQQGAUZ.js} +7 -7
  159. package/dist/_node-chunks/{chunk-CXRU72ET.js → chunk-YMJVSFJT.js} +6 -6
  160. package/dist/_node-chunks/{chunk-DHJFTB4K.js → chunk-YXEKWVJQ.js} +7 -7
  161. package/dist/_node-chunks/{chunk-SLWQNBGO.js → chunk-Z6CUUWJO.js} +34 -949
  162. package/dist/_node-chunks/{chunk-TD5PLLQG.js → chunk-ZAIGR7EV.js} +64 -17
  163. package/dist/_node-chunks/{chunk-6KEHV53S.js → chunk-ZCFXEFR6.js} +33 -41
  164. package/dist/_node-chunks/{chunk-FW2HQUBQ.js → chunk-ZHUBOYOD.js} +6 -6
  165. package/dist/_node-chunks/{chunk-MA24JW6C.js → chunk-ZHUBTBP2.js} +25 -8
  166. package/dist/_node-chunks/{chunk-RXNJDRGO.js → chunk-ZSTIFZHY.js} +21 -25
  167. package/dist/_node-chunks/dist-TRTHRODT.js +16 -0
  168. package/dist/_node-chunks/dist-XPLJ5T4W.js +27 -0
  169. package/dist/_node-chunks/{local-runtime-NTKIN2QT.js → local-runtime-AC7MOWYK.js} +21 -22
  170. package/dist/_node-chunks/{mdx-plugin-MWISDWDQ.js → mdx-plugin-ZW26VGEP.js} +2263 -130
  171. package/dist/_node-chunks/{monorepo-LIRFMQXE.js → monorepo-T2KZK62Q.js} +12 -12
  172. package/dist/_node-chunks/{monorepo-optimized-tests-relaxed-limits-no-story-deletion-CPDW4XTW.js → monorepo-optimized-tests-relaxed-limits-no-story-deletion-2CWUUF6H.js} +12 -12
  173. package/dist/_node-chunks/optimized-tests-4AK3PFSX.js +22 -0
  174. package/dist/_node-chunks/{pattern-copy-play-EKHIUAU2.js → pattern-copy-play-CMRGEXHM.js} +12 -12
  175. package/dist/_node-chunks/postinstallAddon-OUQENFYO.js +20 -0
  176. package/dist/_node-chunks/{rehype-external-links-BUN3HUCO.js → rehype-external-links-LHOAIJ2E.js} +9 -9
  177. package/dist/_node-chunks/{rehype-slug-PLADX223.js → rehype-slug-K54MMYY6.js} +9 -9
  178. package/dist/_node-chunks/{relaxed-limits-GBHW6KIQ.js → relaxed-limits-TTL4PWH7.js} +12 -12
  179. package/dist/_node-chunks/{run-NL66VTNR.js → run-6DXBB5F7.js} +294 -30
  180. package/dist/_node-chunks/{run-KDTIZNSY.js → run-BMTV5ZAO.js} +18 -18
  181. package/dist/_node-chunks/{setup-MGC7BQO6.js → setup-FDPYW25Y.js} +9 -9
  182. package/dist/_node-chunks/{vitest.config.4.template-JH2THZFG.js → vitest.config.4.template-2TCFWAAI.js} +9 -9
  183. package/dist/actions/decorator.js +18 -22
  184. package/dist/actions/index.d.ts +4 -4
  185. package/dist/actions/index.js +3 -2
  186. package/dist/addon-a11y/index.d.ts +3 -3
  187. package/dist/addon-a11y/index.js +3 -2
  188. package/dist/addon-a11y/manager.js +41 -38
  189. package/dist/addon-a11y/preset.js +7 -7
  190. package/dist/addon-a11y/preview.d.ts +8 -2
  191. package/dist/addon-a11y/preview.js +3 -2
  192. package/dist/addon-comments/manager.js +353 -0
  193. package/dist/addon-comments/preset.js +80 -0
  194. package/dist/addon-comments/preview.js +101 -0
  195. package/dist/addon-docs/blocks.d.ts +123 -85
  196. package/dist/addon-docs/blocks.js +159 -85
  197. package/dist/addon-docs/index.d.ts +21 -21
  198. package/dist/addon-docs/index.js +3 -3
  199. package/dist/addon-docs/manager.js +6 -6
  200. package/dist/addon-docs/preset.js +12 -12
  201. package/dist/addon-docs/preview.d.ts +3 -1
  202. package/dist/addon-docs/preview.js +1 -1
  203. package/dist/addon-links/index.d.ts +2 -1
  204. package/dist/addon-links/index.js +5 -2
  205. package/dist/addon-links/preview.d.ts +1 -1
  206. package/dist/addon-links/preview.js +5 -2
  207. package/dist/addon-links/react/index.js +4 -1
  208. package/dist/addon-mcp/preset.js +203 -84
  209. package/dist/addon-mcp/preview.js +1 -1
  210. package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +71 -71
  211. package/dist/addon-ondevice-actions/index.js +5 -1
  212. package/dist/addon-ondevice-actions/register.js +5 -1
  213. package/dist/addon-ondevice-controls/index.js +1 -1
  214. package/dist/addon-ondevice-controls/register.js +1 -1
  215. package/dist/addon-pseudo-states/index.d.ts +1 -1
  216. package/dist/addon-pseudo-states/index.js +1 -1
  217. package/dist/addon-pseudo-states/manager.js +2 -2
  218. package/dist/addon-pseudo-states/preview.d.ts +1 -1
  219. package/dist/addon-pseudo-states/preview.js +1 -1
  220. package/dist/addon-themes/index.d.ts +7 -6
  221. package/dist/addon-themes/index.js +2 -2
  222. package/dist/addon-themes/manager.js +4 -4
  223. package/dist/addon-themes/postinstall.js +7 -7
  224. package/dist/addon-themes/preview.js +2 -2
  225. package/dist/addon-vitest/constants.js +8 -8
  226. package/dist/addon-vitest/manager.js +32 -23
  227. package/dist/addon-vitest/node/coverage-reporter.js +11 -11
  228. package/dist/addon-vitest/node/vitest.js +37 -37
  229. package/dist/addon-vitest/postinstall.js +10 -10
  230. package/dist/addon-vitest/preset.js +26 -26
  231. package/dist/addon-vitest/vitest-plugin/global-setup.js +23 -23
  232. package/dist/addon-vitest/vitest-plugin/index.js +83 -73
  233. package/dist/addon-vitest/vitest-plugin/setup-file-with-project-annotations.js +3 -3
  234. package/dist/addon-vitest/vitest-plugin/setup-file.js +1 -1
  235. package/dist/babel/index.d.ts +241 -995
  236. package/dist/babel/index.js +30583 -38
  237. package/dist/backgrounds/index.d.ts +1 -1
  238. package/dist/bin/core.js +122 -110
  239. package/dist/bin/dispatcher.js +18 -16
  240. package/dist/bin/loader.js +17 -16
  241. package/dist/builder-next/index.d.ts +59 -0
  242. package/dist/builder-next/index.js +201 -0
  243. package/dist/builder-vite/index.d.ts +8 -3
  244. package/dist/builder-vite/index.js +80 -25
  245. package/dist/builder-vite/preset.js +13 -13
  246. package/dist/channels/index.d.ts +3 -2
  247. package/dist/channels/index.js +97 -24
  248. package/dist/{chunk-Dr3R0DXk.d.ts → chunk-B-NVyPqN.d.ts} +2 -2
  249. package/dist/{chunk-C2p5r3Vt.d.ts → chunk-B53gRJBs.d.ts} +838 -703
  250. package/dist/{chunk-DoIGKY33.d.ts → chunk-BLZXEm1K.d.ts} +6 -8
  251. package/dist/chunk-BcYKnZln.d.ts +10 -0
  252. package/dist/{chunk-Bpi2tz-6.d.ts → chunk-BspNQvZn.d.ts} +21 -23
  253. package/dist/{chunk-BCoJQE-f.d.ts → chunk-BtKww7r1.d.ts} +6 -4
  254. package/dist/chunk-CFhJCPSB.d.ts +48 -0
  255. package/dist/{chunk-DtHByo32.d.ts → chunk-CFk6djyM.d.ts} +5 -5
  256. package/dist/{chunk-CwQKNaYL.d.ts → chunk-CMx6bGAU.d.ts} +2 -2
  257. package/dist/{chunk-DEVFdzxR.d.ts → chunk-CRmUwbkb.d.ts} +4 -4
  258. package/dist/{chunk-CMeX4WRe.d.ts → chunk-CT2iXaHz.d.ts} +1 -1
  259. package/dist/{chunk-pcFXCimE.d.ts → chunk-CmV7WZzR.d.ts} +124 -2
  260. package/dist/{chunk-BGkgZp-H.d.ts → chunk-D3uSIa6H.d.ts} +9 -1
  261. package/dist/{chunk-DzuY9DXg.d.ts → chunk-DDd8BhTY.d.ts} +2 -2
  262. package/dist/{chunk-Dw1z1Pki.d.ts → chunk-DNCU78oW.d.ts} +160 -323
  263. package/dist/chunk-DVIvUVkS.d.ts +195 -0
  264. package/dist/{chunk-gCX81nOr.d.ts → chunk-DgzPaTw9.d.ts} +3 -3
  265. package/dist/{chunk-Kt1tW-D1.d.ts → chunk-Dm-iHJ-s.d.ts} +3 -3
  266. package/dist/{chunk-C-bavsOH.d.ts → chunk-Dw_4ad2Y.d.ts} +6 -6
  267. package/dist/chunk-Susgfkap.d.ts +20 -0
  268. package/dist/{chunk-B2t1tGRh.d.ts → chunk-bhl-7rRD.d.ts} +40 -15
  269. package/dist/{chunk-BXLImeLy.d.ts → chunk-r-Vjut9o.d.ts} +52 -11
  270. package/dist/cli/index.d.ts +15 -904
  271. package/dist/cli/index.js +49 -5209
  272. package/dist/cli/skills/content/index.d.ts +3 -3
  273. package/dist/cli/skills/content/index.js +3 -3
  274. package/dist/cli/tools/sdk/child-host.d.ts +1 -1
  275. package/dist/cli/tools/sdk/child-host.js +17 -17
  276. package/dist/cli/tools/sdk/index.d.ts +4 -4
  277. package/dist/cli/tools/sdk/index.js +18 -18
  278. package/dist/cli-commands/bin/index.js +7 -7
  279. package/dist/client-logger/index.d.ts +20 -21
  280. package/dist/client-logger/index.js +5 -2
  281. package/dist/common/index.d.ts +32 -44
  282. package/dist/common/index.js +89 -98
  283. package/dist/components/index.d.ts +86 -272
  284. package/dist/components/index.js +2759 -8547
  285. package/dist/core-events/index.d.ts +16 -7
  286. package/dist/core-events/index.js +5 -5
  287. package/dist/core-server/index.d.ts +95 -26
  288. package/dist/core-server/index.js +1675 -408
  289. package/dist/core-server/presets/common-manager.js +837 -1335
  290. package/dist/core-server/presets/common-override-preset.js +12 -10
  291. package/dist/core-server/presets/common-preset.js +100 -282
  292. package/dist/create/bin/index.js +7 -7
  293. package/dist/create/index.js +15 -15
  294. package/dist/csf/csf-utils.d.ts +1 -1
  295. package/dist/csf/index.d.ts +6 -6
  296. package/dist/csf/index.js +90 -159
  297. package/dist/csf-tools/index.d.ts +66 -54
  298. package/dist/csf-tools/index.js +19 -17
  299. package/dist/docs-tools/index.d.ts +332 -16
  300. package/dist/docs-tools/index.js +3 -3
  301. package/dist/highlight/index.d.ts +1 -1
  302. package/dist/instrumenter/index.d.ts +5 -5
  303. package/dist/instrumenter/index.js +31 -19
  304. package/dist/manager/_manager-chunks/{globals-runtime-BvM-NY2g.js → globals-runtime-B4NRbNSS.js} +638 -1731
  305. package/dist/{preview/_chunks/runtime-CqHxptiK.js → manager/_manager-chunks/globals-runtime-BC43T1rL.js} +3413 -173
  306. package/dist/manager/_manager-chunks/{globals-runtime-qKvCZHFY.js → globals-runtime-BJ6EZqH7.js} +1035 -623
  307. package/dist/manager/_manager-chunks/{globals-runtime-Rp_zjGnh.js → globals-runtime-BfXaq_CP.js} +2 -2
  308. package/dist/manager/_manager-chunks/{globals-runtime-C02fvgcd.js → globals-runtime-BkSn_Jpe.js} +411 -379
  309. package/dist/manager/_manager-chunks/{globals-runtime-eLPTIfX-.js → globals-runtime-BnQ7i5wq.js} +232 -370
  310. package/dist/manager/_manager-chunks/globals-runtime-BtduS2C2.js +10601 -0
  311. package/dist/manager/_manager-chunks/globals-runtime-BzuYs3dZ.js +1971 -0
  312. package/dist/manager/_manager-chunks/globals-runtime-CBviMKtt.js +446 -0
  313. package/dist/manager/_manager-chunks/globals-runtime-CS41oTca.js +1808 -0
  314. package/dist/manager/_manager-chunks/{globals-runtime-BmphMP6z.js → globals-runtime-Cisw9IIE.js} +11 -11
  315. package/dist/manager/_manager-chunks/globals-runtime-CoTrrHG3.js +1163 -0
  316. package/dist/manager/_manager-chunks/{globals-runtime-FC201B7s.js → globals-runtime-DCmvKMN5.js} +2 -1
  317. package/dist/manager/_manager-chunks/globals-runtime-DgO0hT2p.js +32 -0
  318. package/dist/manager/_manager-chunks/{globals-runtime-DpNYC-qi.js → globals-runtime-DpvE_zRs.js} +1013 -782
  319. package/dist/manager/_manager-chunks/globals-runtime-Me9Bl-sx.js +156 -0
  320. package/dist/manager/_manager-chunks/globals-runtime-nQMRiA0J.js +19 -0
  321. package/dist/manager/_manager-chunks/globals-runtime-oRjPg2jY.js +8935 -0
  322. package/dist/manager/_manager-chunks/{globals-runtime-sGpNlIJ1.js → globals-runtime-wV08sCKl.js} +715 -620
  323. package/dist/manager/_manager-chunks/{runtime-cp5pazY2.js → runtime-4OQZWibO.js} +1717 -1536
  324. package/dist/manager/_manager-chunks/runtime-BYxbyNm0.js +201 -0
  325. package/dist/manager/_manager-chunks/{runtime-EITvVbkG.js → runtime-BdGkqNEt.js} +1 -2
  326. package/dist/manager/_manager-chunks/runtime-CM4Z8aKR.js +735 -0
  327. package/dist/manager/_manager-chunks/{runtime-eDVAYF7N.js → runtime-Cjo1UL1u.js} +57 -76
  328. package/dist/manager/_manager-chunks/runtime-Cx1-wr6J.js +294 -0
  329. package/dist/manager/_manager-chunks/{runtime-BhkT2CXl.js → runtime-Cxe_uJRb.js} +220 -406
  330. package/dist/manager/_manager-chunks/runtime-D702FFTO.js +551 -0
  331. package/dist/manager/_manager-chunks/{runtime-D94Vq3oR.js → runtime-DnWFp6Zw.js} +8 -534
  332. package/dist/manager/_manager-chunks/{runtime-D0UOWx0U.js → runtime-DoYPE6g6.js} +232 -158
  333. package/dist/manager/_manager-chunks/runtime-P663lpsR.js +528 -0
  334. package/dist/manager/_manager-chunks/{runtime-i-PDAHLR.js → runtime-sppa-0ll.js} +741 -698
  335. package/dist/manager/globals-runtime.js +1 -1
  336. package/dist/manager/globals.d.ts +12 -12
  337. package/dist/manager/globals.js +12 -12
  338. package/dist/manager/runtime.js +1 -1
  339. package/dist/manager-api/index.d.ts +1 -1
  340. package/dist/manager-api/index.js +538 -528
  341. package/dist/manager-errors.d.ts +1 -1
  342. package/dist/manager-errors.js +2 -2
  343. package/dist/mcp/index.d.ts +10 -10
  344. package/dist/mcp/index.js +11 -11
  345. package/dist/mocking-utils/index.d.ts +7 -5
  346. package/dist/mocking-utils/index.js +34 -34
  347. package/dist/mocking-utils/mocker-runtime.js +2 -2
  348. package/dist/next/index.d.ts +231 -0
  349. package/dist/next/index.js +398 -0
  350. package/dist/nextjs-vite/export-mocks/headers/index.js +3 -1
  351. package/dist/nextjs-vite/export-mocks/link/index.d.ts +4 -1
  352. package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +9 -1
  353. package/dist/nextjs-vite/export-mocks/router/index.js +13 -7
  354. package/dist/nextjs-vite/index.d.ts +4 -4
  355. package/dist/nextjs-vite/index.js +10 -5
  356. package/dist/nextjs-vite/node/index.d.ts +2 -2
  357. package/dist/nextjs-vite/node/index.js +7 -7
  358. package/dist/nextjs-vite/node-stand-ins/index.d.ts +68 -0
  359. package/dist/nextjs-vite/node-stand-ins/index.js +145 -0
  360. package/dist/nextjs-vite/preset.js +117 -15
  361. package/dist/nextjs-vite/preview.d.ts +2 -1
  362. package/dist/nextjs-vite/preview.js +1 -1
  363. package/dist/nextjs-vite/vite-plugin/index.d.ts +2 -2
  364. package/dist/nextjs-vite/vite-plugin/index.js +9 -9
  365. package/dist/nextjs-vite-plugin/index.d.ts +2 -3
  366. package/dist/nextjs-vite-plugin/index.js +24 -49
  367. package/dist/nextjs-vite-plugin/mocks/storybook.global.js +8 -8
  368. package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-image.js +2 -2
  369. package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-legacy-image.js +2 -2
  370. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +10 -6
  371. package/dist/node-logger/index.d.ts +89 -90
  372. package/dist/node-logger/index.js +11 -12
  373. package/dist/oxc-parser/index.js +15 -14
  374. package/dist/oxc-parser/worker.js +10 -10
  375. package/dist/{manager/_manager-chunks/globals-runtime-8HkdnU2F.js → preview/_chunks/runtime-BYRCSYBN.js} +4440 -179
  376. package/dist/preview/_chunks/{runtime-BZSnICCg.js → runtime-Bvh_rfnQ.js} +29 -64
  377. package/dist/preview/_chunks/{runtime-iXdo8CR8.js → runtime-Cbq5WjbL.js} +772 -418
  378. package/dist/preview/_chunks/{runtime-q3wt0e_N.js → runtime-D2MPrqbU.js} +2 -2
  379. package/dist/preview/_chunks/{runtime-DrTjJkPY.js → runtime-DDEUZops.js} +453 -161
  380. package/dist/preview/_chunks/{runtime-BIzIdDbb.js → runtime-DS0s7U3c.js} +482 -334
  381. package/dist/preview/_chunks/{runtime-CsV4HZPV.js → runtime-DsjyhLpG.js} +397 -176
  382. package/dist/preview/_chunks/{runtime-CxZK_Ln3.js → runtime-Dwi6NFcX.js} +3 -3
  383. package/dist/preview/globals.d.ts +10 -10
  384. package/dist/preview/globals.js +10 -10
  385. package/dist/preview/runtime.js +1 -1
  386. package/dist/preview-api/index.d.ts +3 -3
  387. package/dist/preview-api/index.js +12 -10
  388. package/dist/preview-errors.d.ts +1 -1
  389. package/dist/preview-errors.js +2 -2
  390. package/dist/react/docgen/docgen-worker.js +11 -12
  391. package/dist/react/entry-preview-argtypes.js +1 -1
  392. package/dist/react/entry-preview-docs.js +1 -1
  393. package/dist/react/entry-preview.js +2 -1
  394. package/dist/react/index.d.ts +9 -11
  395. package/dist/react/index.js +8 -6
  396. package/dist/react/preset.js +13 -14
  397. package/dist/react/preview.d.ts +1 -1
  398. package/dist/react/preview.js +5 -4
  399. package/dist/react-native/bin/get-stories.js +12 -12
  400. package/dist/react-native/index.d.ts +48 -47
  401. package/dist/react-native/index.js +64 -249
  402. package/dist/react-native/metro/node.d.ts +3 -3
  403. package/dist/react-native/metro/node.js +10 -9
  404. package/dist/react-native/metro/{withStorybook.d.ts → withForkbook.d.ts} +18 -18
  405. package/dist/react-native/metro/{withStorybook.js → withForkbook.js} +27 -26
  406. package/dist/react-native/preview.js +4 -1
  407. package/dist/react-native/scripts/generate.d.ts +1 -1
  408. package/dist/react-native/scripts/generate.js +8 -8
  409. package/dist/react-native/stub.js +1 -1
  410. package/dist/react-native-theming/index.d.ts +2 -58
  411. package/dist/react-native-theming/index.js +63 -2338
  412. package/dist/react-native-ui/index.d.ts +14 -14
  413. package/dist/react-native-ui/index.js +8 -15
  414. package/dist/react-native-ui-common/index.d.ts +32 -12
  415. package/dist/react-native-ui-common/index.js +26 -31
  416. package/dist/react-vite/index.d.ts +2 -2
  417. package/dist/react-vite/node/index.d.ts +3 -3
  418. package/dist/react-vite/node/index.js +7 -7
  419. package/dist/react-vite/preset.d.ts +3 -1
  420. package/dist/react-vite/preset.js +16 -9
  421. package/dist/router/index.d.ts +80 -3
  422. package/dist/router/index.js +66 -12
  423. package/dist/server-errors.d.ts +1 -1
  424. package/dist/server-errors.js +9 -9
  425. package/dist/shared/open-service/index.d.ts +3 -3
  426. package/dist/shared/open-service/index.js +2 -2
  427. package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +9 -9
  428. package/dist/shared/open-service/toolsets/docs/public.d.ts +28 -28
  429. package/dist/telemetry/index.d.ts +38 -274
  430. package/dist/telemetry/index.js +11 -68
  431. package/dist/test/index.d.ts +2 -2
  432. package/dist/test/index.js +765 -511
  433. package/dist/theming/create.d.ts +1 -1
  434. package/dist/theming/create.js +2 -1
  435. package/dist/theming/index.d.ts +6 -6
  436. package/dist/theming/index.js +41 -16
  437. package/dist/types/index.d.ts +2 -2
  438. package/dist/types/index.js +5 -5
  439. package/dist/viewport/index.d.ts +1 -1
  440. package/package.json +69 -69
  441. package/skills/setup/SKILL.md +14 -0
  442. package/skills/stories/SKILL.md +21 -0
  443. package/skills/write-story/SKILL.md +14 -0
  444. package/template/nextjs-vite/cli/js/Button.jsx +2 -2
  445. package/template/nextjs-vite/cli/js/Button.stories.js +6 -6
  446. package/template/nextjs-vite/cli/js/Configure.mdx +100 -100
  447. package/template/nextjs-vite/cli/js/Header.jsx +1 -1
  448. package/template/nextjs-vite/cli/js/Header.stories.js +2 -2
  449. package/template/nextjs-vite/cli/js/Page.jsx +3 -3
  450. package/template/nextjs-vite/cli/js/Page.stories.js +2 -2
  451. package/template/nextjs-vite/cli/ts/Button.stories.ts +6 -6
  452. package/template/nextjs-vite/cli/ts/Button.tsx +2 -2
  453. package/template/nextjs-vite/cli/ts/Configure.mdx +84 -84
  454. package/template/nextjs-vite/cli/ts/Header.stories.ts +2 -2
  455. package/template/nextjs-vite/cli/ts/Header.tsx +1 -1
  456. package/template/nextjs-vite/cli/ts/Page.stories.ts +2 -2
  457. package/template/nextjs-vite/cli/ts/Page.tsx +3 -3
  458. package/template/react/cli/js/Button.jsx +2 -2
  459. package/template/react/cli/js/Button.stories.js +6 -6
  460. package/template/react/cli/js/Header.jsx +1 -1
  461. package/template/react/cli/js/Header.stories.js +2 -2
  462. package/template/react/cli/js/Page.jsx +3 -3
  463. package/template/react/cli/js/Page.stories.js +2 -2
  464. package/template/react/cli/ts/Button.stories.ts +6 -6
  465. package/template/react/cli/ts/Button.tsx +2 -2
  466. package/template/react/cli/ts/Header.stories.ts +2 -2
  467. package/template/react/cli/ts/Header.tsx +1 -1
  468. package/template/react/cli/ts/Page.stories.ts +2 -2
  469. package/template/react/cli/ts/Page.tsx +3 -3
  470. package/template/react-vite/cli/js/Button.jsx +2 -2
  471. package/template/react-vite/cli/js/Button.stories.js +6 -6
  472. package/template/react-vite/cli/js/Header.jsx +1 -1
  473. package/template/react-vite/cli/js/Header.stories.js +2 -2
  474. package/template/react-vite/cli/js/Page.jsx +3 -3
  475. package/template/react-vite/cli/js/Page.stories.js +2 -2
  476. package/template/react-vite/cli/ts/Button.stories.ts +6 -6
  477. package/template/react-vite/cli/ts/Button.tsx +2 -2
  478. package/template/react-vite/cli/ts/Header.stories.ts +2 -2
  479. package/template/react-vite/cli/ts/Header.tsx +1 -1
  480. package/template/react-vite/cli/ts/Page.stories.ts +2 -2
  481. package/template/react-vite/cli/ts/Page.tsx +3 -3
  482. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  483. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  484. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  485. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  486. package/dist/_browser-chunks/WithTooltip-XSQFTBMB.js +0 -1619
  487. package/dist/_browser-chunks/chunk-5P4QA6MY.js +0 -20
  488. package/dist/_browser-chunks/chunk-JMC7AIKT.js +0 -108
  489. package/dist/_node-chunks/builder-manager-VVHYQXCH.js +0 -1661
  490. package/dist/_node-chunks/chunk-2RU7BKEW.js +0 -23
  491. package/dist/_node-chunks/chunk-3BKIBF5S.js +0 -3008
  492. package/dist/_node-chunks/chunk-3T4ZSNPH.js +0 -662
  493. package/dist/_node-chunks/chunk-5DQFEZEA.js +0 -40
  494. package/dist/_node-chunks/chunk-6LMWA44H.js +0 -3837
  495. package/dist/_node-chunks/chunk-BXVYT7SB.js +0 -36
  496. package/dist/_node-chunks/chunk-CQKMLL5J.js +0 -33
  497. package/dist/_node-chunks/chunk-EHUNOMDD.js +0 -52345
  498. package/dist/_node-chunks/chunk-FY6UXW6G.js +0 -11
  499. package/dist/_node-chunks/chunk-GRBLDJCR.js +0 -989
  500. package/dist/_node-chunks/chunk-IDEL2J23.js +0 -23
  501. package/dist/_node-chunks/chunk-JPAZLYJ3.js +0 -29
  502. package/dist/_node-chunks/chunk-MK2KYAI6.js +0 -5414
  503. package/dist/_node-chunks/chunk-NPO45IMH.js +0 -33
  504. package/dist/_node-chunks/chunk-QEQLR22M.js +0 -1877
  505. package/dist/_node-chunks/chunk-RZMQ7S3L.js +0 -92
  506. package/dist/_node-chunks/chunk-SIEXZVCR.js +0 -51
  507. package/dist/_node-chunks/chunk-TEQGGSP7.js +0 -33
  508. package/dist/_node-chunks/chunk-TFCEV2XX.js +0 -155
  509. package/dist/_node-chunks/chunk-UBOGWBEA.js +0 -148
  510. package/dist/_node-chunks/chunk-W4OMYLSP.js +0 -1297
  511. package/dist/_node-chunks/chunk-WAXVSN3O.js +0 -18
  512. package/dist/_node-chunks/chunk-ZMAMXQKP.js +0 -4731
  513. package/dist/_node-chunks/dist-VTSTZKUB.js +0 -16
  514. package/dist/_node-chunks/globby-OEMHPBFY.js +0 -2884
  515. package/dist/_node-chunks/jiti-NFX6UU74.js +0 -3848
  516. package/dist/_node-chunks/lib-MDVARD7W.js +0 -366
  517. package/dist/_node-chunks/optimized-tests-HDOLR3EY.js +0 -22
  518. package/dist/_node-chunks/postinstallAddon-GYGMWDL6.js +0 -20
  519. package/dist/_node-chunks/session-id-KIIVOQLR.js +0 -23
  520. package/dist/chunk-BTVrWliM.d.ts +0 -115
  521. package/dist/chunk-BfBzpgct.d.ts +0 -916
  522. package/dist/chunk-BxWufQms.d.ts +0 -142
  523. package/dist/chunk-DaVb55-_.d.ts +0 -124
  524. package/dist/core-server/presets/common-manager.css +0 -170
  525. package/dist/manager/_manager-chunks/globals-runtime-BIKBO23x.js +0 -3389
  526. package/dist/manager/_manager-chunks/globals-runtime-DkAPXCvc.js +0 -9766
  527. package/dist/manager/_manager-chunks/globals-runtime-DtcOnYHR.js +0 -5357
  528. package/dist/manager/_manager-chunks/globals-runtime-ZHrQFa3-.js +0 -10463
  529. package/dist/manager/_manager-chunks/runtime-B1L9TH89.js +0 -452
  530. package/dist/manager/_manager-chunks/runtime-BK0zF7FN.js +0 -22
  531. package/dist/manager/_manager-chunks/runtime-Bly6WJLN.js +0 -998
  532. package/dist/manager/_manager-chunks/runtime-DMig8mT7.js +0 -77
  533. package/dist/preview/_chunks/runtime-BTPtVY1p.js +0 -1102
  534. package/dist/preview/_chunks/runtime-BwSxqk3t.js +0 -63
  535. package/dist/preview/_chunks/runtime-DZToXfvO.js +0 -9767
  536. package/dist/preview/_chunks/runtime-DuHdxMFA.js +0 -387
@@ -1,47 +1,24 @@
1
- import CJS_COMPAT_NODE_URL_ro17f80mg6k from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ro17f80mg6k from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ro17f80mg6k from "node:module";
1
+ import CJS_COMPAT_NODE_URL_wrk1cj8d1xj from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_wrk1cj8d1xj from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_wrk1cj8d1xj from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ro17f80mg6k.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ro17f80mg6k.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ro17f80mg6k.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_wrk1cj8d1xj.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_wrk1cj8d1xj.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_wrk1cj8d1xj.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Forkbook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  require_dist
14
- } from "./chunk-JGGFYIG5.js";
14
+ } from "./chunk-CVHDAEDZ.js";
15
+ import {
16
+ RN_FORKBOOK_DIR
17
+ } from "./chunk-C6HQ6WLU.js";
15
18
  import {
16
19
  cache,
17
20
  up as up3
18
- } from "./chunk-UVINFLGY.js";
19
- import {
20
- FORKBOOK_PACKAGE_PATTERNS,
21
- FORKBOOK_RERUN_INSTRUCTION,
22
- JsPackageManager,
23
- defaultConfigDir,
24
- extractFrameworkPackageName,
25
- frameworkPackages,
26
- getAddonNames,
27
- getAgeInMinutes,
28
- getConfigInfo,
29
- getErrorLogs,
30
- getInterpretedFile,
31
- getLatestStableVersionAdheringToMinimumAgeGate,
32
- getPrettyPackageManagerName,
33
- getStorybookRerunCommand,
34
- hasStorybookMinimumAgeExclusions,
35
- loadMainConfig,
36
- normalizeAddonName,
37
- parsePackageData,
38
- parsePackageTimeMap,
39
- parsePositiveIntegerConfigValue,
40
- parseReleaseTime,
41
- validateConfigurationFiles,
42
- versions_default,
43
- withForkbookFramework
44
- } from "./chunk-GRBLDJCR.js";
21
+ } from "./chunk-ROJ6RSIJ.js";
45
22
  import {
46
23
  createModuleResolver,
47
24
  isSelfContained,
@@ -49,46 +26,45 @@ import {
49
26
  resolveReferencedValue,
50
27
  sourceOf,
51
28
  unwrapExpression
52
- } from "./chunk-YZFWBA5L.js";
53
- import {
54
- stripJsonComments
55
- } from "./chunk-SIEXZVCR.js";
29
+ } from "./chunk-LYS7TI35.js";
56
30
  import {
57
31
  logger
58
- } from "./chunk-6LMWA44H.js";
59
- import {
60
- STORY_FILE_TEST_REGEXP,
61
- execa,
62
- execaCommandSync,
63
- execaNode,
64
- getStoryImportPathFromEntry
65
- } from "./chunk-MK2KYAI6.js";
32
+ } from "./chunk-MDTXL6SN.js";
66
33
  import {
67
34
  BUN_LOCKFILE,
68
35
  BUN_LOCKFILE_BINARY,
69
36
  NPM_LOCKFILE,
70
37
  PNPM_LOCKFILE,
38
+ STORY_FILE_TEST_REGEXP,
71
39
  YARN_LOCKFILE,
40
+ exec,
41
+ execNode,
42
+ execSync,
43
+ findFilesUp,
72
44
  getProjectRoot,
73
- normalizeStoryPath,
74
- require_picomatch
75
- } from "./chunk-SLWQNBGO.js";
45
+ getStoryImportPathFromEntry,
46
+ normalizeStoryPath
47
+ } from "./chunk-53A5CYDK.js";
76
48
  import {
77
49
  any,
78
50
  from,
79
51
  up,
80
52
  up2
81
- } from "./chunk-JDXXX6LB.js";
53
+ } from "./chunk-MX5MVLEK.js";
54
+ import {
55
+ invariant
56
+ } from "./chunk-GQUFGJ4D.js";
82
57
  import {
83
58
  importModule,
84
59
  resolveModulePath,
85
60
  resolvePackageDir,
86
61
  safeResolveModule
87
- } from "./chunk-F3ZFKBHY.js";
62
+ } from "./chunk-PC57BIYZ.js";
88
63
  import {
89
64
  jsModuleExtensions,
90
- jsTsSourceExtensions
91
- } from "./chunk-TNJIXE37.js";
65
+ jsTsSourceExtensions,
66
+ storybookConfigExtensions
67
+ } from "./chunk-7IAYDGYH.js";
92
68
  import {
93
69
  ExecaCommandFailedError,
94
70
  PackageInstallDependencyConflictError,
@@ -99,26 +75,70 @@ import {
99
75
  PnpmIgnoredBuildsError,
100
76
  PnpmNoTtyModulesDirError,
101
77
  StorybookError
102
- } from "./chunk-U5W53R2J.js";
78
+ } from "./chunk-HGJMP4EI.js";
103
79
  import {
104
80
  require_picocolors
105
- } from "./chunk-2BUPBPFB.js";
81
+ } from "./chunk-HCDG54OG.js";
106
82
  import {
107
83
  slash
108
- } from "./chunk-DC7DKR5K.js";
84
+ } from "./chunk-3H5C52QU.js";
109
85
  import {
86
+ glob,
110
87
  globSync
111
- } from "./chunk-ZMAMXQKP.js";
88
+ } from "./chunk-TTLSBLPQ.js";
89
+ import {
90
+ require_picomatch
91
+ } from "./chunk-Z6CUUWJO.js";
112
92
  import {
113
93
  __toESM
114
- } from "./chunk-CXRU72ET.js";
94
+ } from "./chunk-YMJVSFJT.js";
95
+
96
+ // src/common/versions.ts
97
+ var versions_default = { "@aussieljk/forkbook": "0.0.1-21" };
115
98
 
116
99
  // src/common/presets.ts
117
100
  import { logger as logger2 } from "@aussieljk/forkbook/internal/node-logger";
118
101
  import { CriticalPresetLoadError } from "@aussieljk/forkbook/internal/server-errors";
119
102
  import { readFileSync } from "node:fs";
120
- import { isAbsolute, join, parse, resolve } from "pathe";
121
- import { dedent } from "ts-dedent";
103
+ import { isAbsolute, join, parse, resolve as resolve2 } from "pathe";
104
+ import { dedent as dedent2 } from "ts-dedent";
105
+
106
+ // src/common/utils/interpret-files.ts
107
+ import { existsSync } from "node:fs";
108
+ import { extname } from "node:path";
109
+ var typescriptFallbackExtensions = {
110
+ ".js": [".ts", ".tsx"],
111
+ ".mjs": [".mts"],
112
+ ".cjs": [".cts"],
113
+ ".jsx": [".tsx"]
114
+ }, supportedExtensions = storybookConfigExtensions;
115
+ function getInterpretedFile(pathToFile) {
116
+ return supportedExtensions.map((ext) => pathToFile.endsWith(ext) ? pathToFile : `${pathToFile}${ext}`).find((candidate) => existsSync(candidate));
117
+ }
118
+ var importResolver = createModuleResolver({
119
+ extensions: [...supportedExtensions],
120
+ mainFields: ["module", "main"]
121
+ });
122
+ function resolveImport(id, options) {
123
+ try {
124
+ return resolveSync(id, options.basedir);
125
+ } catch (error) {
126
+ let ext = extname(id), fallbackExtensions = typescriptFallbackExtensions[ext];
127
+ if (!fallbackExtensions)
128
+ throw error;
129
+ let fallbackError = error, baseId = id.slice(0, -ext.length);
130
+ for (let fallbackExtension of fallbackExtensions)
131
+ try {
132
+ return resolveSync(`${baseId}${fallbackExtension}`, options.basedir);
133
+ } catch (err) {
134
+ fallbackError = err;
135
+ }
136
+ throw fallbackError;
137
+ }
138
+ }
139
+ function resolveSync(id, basedir) {
140
+ return importResolver.resolveSync(basedir, id);
141
+ }
122
142
 
123
143
  // src/common/utils/strip-abs-node-modules-path.ts
124
144
  import { posix, sep } from "node:path";
@@ -130,11 +150,29 @@ function stripAbsNodeModulesPath(absPath) {
130
150
  return normalizePath(splits[splits.length - 1]);
131
151
  }
132
152
 
153
+ // src/common/utils/validate-configuration-files.ts
154
+ import { resolve } from "node:path";
155
+ import { once } from "@aussieljk/forkbook/internal/node-logger";
156
+ import { MainFileMissingError } from "@aussieljk/forkbook/internal/server-errors";
157
+ import { dedent } from "ts-dedent";
158
+ async function validateConfigurationFiles(configDir, cwd) {
159
+ let extensionsPattern = `{${Array.from(supportedExtensions).join(",")}}`, mainConfigMatches = await glob(slash(resolve(configDir, `main${extensionsPattern}`)), {
160
+ cwd: cwd ?? process.cwd(),
161
+ expandDirectories: !1
162
+ }), [mainConfigPath] = mainConfigMatches;
163
+ if (mainConfigMatches.length > 1 && once.warn(dedent`
164
+ Multiple main files found in your configDir (${resolve(configDir)}).
165
+ Forkbook will use the first one found and ignore the others. Please remove the extra files.
166
+ `), !mainConfigPath)
167
+ throw new MainFileMissingError({ location: configDir });
168
+ }
169
+
133
170
  // src/common/presets.ts
134
171
  var isObject = (val) => val != null && typeof val == "object" && Array.isArray(val) === !1, isFunction = (val) => typeof val == "function";
135
172
  function resolvePresetFunction(input, presetOptions, storybookOptions) {
136
173
  return isFunction(input) ? [...input({ ...storybookOptions, ...presetOptions })] : Array.isArray(input) ? [...input] : [];
137
174
  }
175
+ var presetNameOf = (preset) => typeof preset == "string" ? preset : preset.name;
138
176
  function readAddonManifest(dir) {
139
177
  try {
140
178
  let { name, exports } = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
@@ -174,12 +212,12 @@ var resolveAddonName = (configDir, name, options) => {
174
212
  name: resolved
175
213
  };
176
214
  }, map = ({ configDir }) => (item) => {
177
- let options = isObject(item) && item.options || void 0, name = isObject(item) ? item.name : item, resolved;
215
+ let options = typeof item == "string" ? void 0 : item.options || void 0, name = presetNameOf(item), resolved;
178
216
  try {
179
217
  resolved = resolveAddonName(configDir, name, options);
180
218
  } catch {
181
219
  logger2.error(
182
- `Addon value should end in /manager or /preview or /register OR it should be a valid preset https://storybook.js.org/docs/addons/writing-presets/
220
+ `Addon value should end in /manager or /preview or /register OR it should be a valid preset https://forkbook.ljk.dev/docs/addons/writing-presets
183
221
  ${item}`
184
222
  );
185
223
  return;
@@ -187,7 +225,7 @@ ${item}`
187
225
  if (!resolved) {
188
226
  let packageName = isAbsolute(name) ? readAddonManifest(name)?.name : void 0;
189
227
  logger2.warn(
190
- packageName ? dedent`
228
+ packageName ? dedent2`
191
229
  Could not resolve addon "${packageName}", skipping.
192
230
  It is installed at ${name}, but none of its preset, manager or preview entry points could be resolved.
193
231
  If your main config wraps it in getAbsolutePath(), try referencing "${packageName}" directly instead.
@@ -201,27 +239,23 @@ ${item}`
201
239
  };
202
240
  };
203
241
  async function getContent(input, configDir) {
204
- if (input.type === "virtual") {
242
+ if (typeof input == "object" && "type" in input && input.type === "virtual") {
205
243
  let { type, name: name2, ...rest } = input;
206
244
  return rest;
207
245
  }
208
- let name = input.name ? input.name : input;
246
+ let name = presetNameOf(input);
209
247
  return importModule(safeResolveModule({ specifier: name, parent: configDir }) ?? name);
210
248
  }
211
249
  async function loadPreset(input, level, storybookOptions) {
212
- let presetName = input.name ? input.name : input;
250
+ let presetName = presetNameOf(input);
213
251
  try {
214
- let presetOptions = input.options ? input.options : {}, contents = await getContent(input, storybookOptions.configDir);
252
+ let presetOptions = (typeof input == "string" ? void 0 : input.options) ?? {}, contents = await getContent(input, storybookOptions.configDir);
215
253
  if (typeof contents == "function" && (contents = contents(storybookOptions, presetOptions)), Array.isArray(contents))
216
254
  return await loadPresets(contents, level + 1, storybookOptions);
217
255
  if (isObject(contents)) {
218
- let {
219
- addons: addonsInput = [],
220
- presets: presetsInput = [],
221
- ...rest
222
- } = withForkbookFramework(contents), filter = (i) => !0;
256
+ let { addons: addonsInput = [], presets: presetsInput = [], ...rest } = contents, filter = (i) => !0;
223
257
  storybookOptions.isCritical !== !0 && (storybookOptions.build?.test?.disabledAddons?.length || 0) > 0 && (filter = (i) => {
224
- let name = i.name ? i.name : i;
258
+ let name = presetNameOf(i);
225
259
  return !storybookOptions.build?.test?.disabledAddons?.find((n) => name.includes(n));
226
260
  });
227
261
  let subPresets = resolvePresetFunction(
@@ -245,7 +279,7 @@ async function loadPreset(input, level, storybookOptions) {
245
279
  }
246
280
  ];
247
281
  }
248
- throw new Error(dedent`
282
+ throw new Error(dedent2`
249
283
  ${input} is not a valid preset
250
284
  `);
251
285
  } catch (error) {
@@ -291,14 +325,12 @@ function applyPresets(presets, extension, config, args, storybookOptions) {
291
325
  }
292
326
  async function getPresets(presets, storybookOptions) {
293
327
  let loadedPresets = await loadPresets(presets, 0, storybookOptions);
294
- return {
295
- apply: async (extension, config, args = {}) => applyPresets(loadedPresets, extension, config, args, storybookOptions)
296
- };
328
+ return { apply: async (extension, config, args = {}) => applyPresets(loadedPresets, extension, config, args, storybookOptions) };
297
329
  }
298
330
  async function loadAllPresets(options) {
299
331
  let { corePresets = [], overridePresets = [], ...restOptions } = options;
300
332
  validateConfigurationFiles(options.configDir);
301
- let mainUrl = getInterpretedFile(resolve(options.configDir, "main")), presetsConfig = [...corePresets, mainUrl, ...overridePresets];
333
+ let mainUrl = getInterpretedFile(resolve2(options.configDir, "main")), presetsConfig = [...corePresets, mainUrl, ...overridePresets];
302
334
  return getPresets(presetsConfig, restOptions);
303
335
  }
304
336
 
@@ -318,7 +350,7 @@ async function writeFileWithRetry(file, data, options) {
318
350
  return;
319
351
  } catch (err) {
320
352
  if (attempt < 5 && err instanceof Error && "code" in err && err.code === "EBUSY")
321
- await new Promise((resolve7) => setTimeout(resolve7, 100));
353
+ await new Promise((resolve10) => setTimeout(resolve10, 100));
322
354
  else
323
355
  throw err;
324
356
  }
@@ -412,97 +444,29 @@ function createFileSystemCache(options) {
412
444
  return new FileSystemCache(options);
413
445
  }
414
446
 
415
- // src/common/utils/resolve-path-in-sb-cache.ts
447
+ // src/common/utils/resolve-path-in-cache.ts
416
448
  import { join as join3 } from "node:path";
417
- function resolvePathInStorybookCache(fileOrDirectoryName, sub = "default") {
418
- let cacheDirectory = cache("storybook");
419
- cacheDirectory ||= join3(process.cwd(), "node_modules", ".cache", "storybook");
449
+ function resolvePathInForkbookCache(fileOrDirectoryName, sub = "default") {
450
+ let cacheDirectory = cache("forkbook");
451
+ cacheDirectory ||= join3(process.cwd(), "node_modules", ".cache", "forkbook");
420
452
  let version = versions_default["@aussieljk/forkbook"] || "unknown";
421
453
  return join3(cacheDirectory, version, sub, fileOrDirectoryName);
422
454
  }
423
455
 
424
456
  // src/common/utils/cache.ts
425
457
  var cache2 = createFileSystemCache({
426
- basePath: resolvePathInStorybookCache("dev-server"),
427
- ns: "storybook"
428
- // Optional. A grouping namespace for items.
458
+ basePath: resolvePathInForkbookCache("dev-server"),
459
+ ns: "forkbook"
460
+ // A grouping namespace for items.
429
461
  });
430
462
 
431
463
  // src/common/utils/cli.ts
432
464
  import { createWriteStream, mkdirSync as mkdirSync2 } from "node:fs";
433
465
  import { copyFile, readFile as readFile2, realpath, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
434
466
  import os from "node:os";
467
+ import { randomUUID } from "node:crypto";
435
468
  import { join as join4 } from "node:path";
436
469
 
437
- // ../../node_modules/crypto-random-string/index.js
438
- import { promisify } from "util";
439
- import crypto from "crypto";
440
- var randomBytesAsync = promisify(crypto.randomBytes), urlSafeCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~".split(""), numericCharacters = "0123456789".split(""), distinguishableCharacters = "CDEHKMPRTUWXY012458".split(""), asciiPrintableCharacters = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~".split(""), alphanumericCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""), generateForCustomCharacters = (length, characters) => {
441
- let characterCount = characters.length, maxValidSelector = Math.floor(65536 / characterCount) * characterCount - 1, entropyLength = 2 * Math.ceil(1.1 * length), string = "", stringLength = 0;
442
- for (; stringLength < length; ) {
443
- let entropy = crypto.randomBytes(entropyLength), entropyPosition = 0;
444
- for (; entropyPosition < entropyLength && stringLength < length; ) {
445
- let entropyValue = entropy.readUInt16LE(entropyPosition);
446
- entropyPosition += 2, !(entropyValue > maxValidSelector) && (string += characters[entropyValue % characterCount], stringLength++);
447
- }
448
- }
449
- return string;
450
- }, generateForCustomCharactersAsync = async (length, characters) => {
451
- let characterCount = characters.length, maxValidSelector = Math.floor(65536 / characterCount) * characterCount - 1, entropyLength = 2 * Math.ceil(1.1 * length), string = "", stringLength = 0;
452
- for (; stringLength < length; ) {
453
- let entropy = await randomBytesAsync(entropyLength), entropyPosition = 0;
454
- for (; entropyPosition < entropyLength && stringLength < length; ) {
455
- let entropyValue = entropy.readUInt16LE(entropyPosition);
456
- entropyPosition += 2, !(entropyValue > maxValidSelector) && (string += characters[entropyValue % characterCount], stringLength++);
457
- }
458
- }
459
- return string;
460
- }, generateRandomBytes = (byteLength, type, length) => crypto.randomBytes(byteLength).toString(type).slice(0, length), generateRandomBytesAsync = async (byteLength, type, length) => (await randomBytesAsync(byteLength)).toString(type).slice(0, length), allowedTypes = /* @__PURE__ */ new Set([
461
- void 0,
462
- "hex",
463
- "base64",
464
- "url-safe",
465
- "numeric",
466
- "distinguishable",
467
- "ascii-printable",
468
- "alphanumeric"
469
- ]), createGenerator = (generateForCustomCharacters2, generateRandomBytes2) => ({ length, type, characters }) => {
470
- if (!(length >= 0 && Number.isFinite(length)))
471
- throw new TypeError("Expected a `length` to be a non-negative finite number");
472
- if (type !== void 0 && characters !== void 0)
473
- throw new TypeError("Expected either `type` or `characters`");
474
- if (characters !== void 0 && typeof characters != "string")
475
- throw new TypeError("Expected `characters` to be string");
476
- if (!allowedTypes.has(type))
477
- throw new TypeError(`Unknown type: ${type}`);
478
- if (type === void 0 && characters === void 0 && (type = "hex"), type === "hex" || type === void 0 && characters === void 0)
479
- return generateRandomBytes2(Math.ceil(length * 0.5), "hex", length);
480
- if (type === "base64")
481
- return generateRandomBytes2(Math.ceil(length * 0.75), "base64", length);
482
- if (type === "url-safe")
483
- return generateForCustomCharacters2(length, urlSafeCharacters);
484
- if (type === "numeric")
485
- return generateForCustomCharacters2(length, numericCharacters);
486
- if (type === "distinguishable")
487
- return generateForCustomCharacters2(length, distinguishableCharacters);
488
- if (type === "ascii-printable")
489
- return generateForCustomCharacters2(length, asciiPrintableCharacters);
490
- if (type === "alphanumeric")
491
- return generateForCustomCharacters2(length, alphanumericCharacters);
492
- if (characters.length === 0)
493
- throw new TypeError("Expected `characters` string length to be greater than or equal to 1");
494
- if (characters.length > 65536)
495
- throw new TypeError("Expected `characters` string length to be less or equal to 65536");
496
- return generateForCustomCharacters2(length, characters.split(""));
497
- }, cryptoRandomString = createGenerator(generateForCustomCharacters, generateRandomBytes);
498
- cryptoRandomString.async = createGenerator(generateForCustomCharactersAsync, generateRandomBytesAsync);
499
- var crypto_random_string_default = cryptoRandomString;
500
-
501
- // ../../node_modules/unique-string/index.js
502
- function uniqueString() {
503
- return crypto_random_string_default({ length: 32 });
504
- }
505
-
506
470
  // src/common/satellite-addons.ts
507
471
  var satellite_addons_default = [
508
472
  "@storybook/addon-coverage",
@@ -515,7 +479,7 @@ var satellite_addons_default = [
515
479
  ];
516
480
 
517
481
  // src/common/utils/cli.ts
518
- var tempDir = () => realpath(os.tmpdir()), getPath = async (prefix = "") => join4(await tempDir(), prefix + uniqueString());
482
+ var tempDir = () => realpath(os.tmpdir()), getPath = async (prefix = "") => join4(await tempDir(), prefix + randomUUID());
519
483
  async function temporaryDirectory({ prefix = "" } = {}) {
520
484
  let directory = await getPath(prefix);
521
485
  return mkdirSync2(directory), directory;
@@ -534,15 +498,15 @@ function parseList(str) {
534
498
  function getEnvConfig(program, configEnv) {
535
499
  Object.keys(configEnv).forEach((fieldName) => {
536
500
  let envVarName = configEnv[fieldName], envVarValue = process.env[envVarName];
537
- envVarValue && (program[fieldName] = envVarValue);
501
+ envVarValue && !program[fieldName] && (program[fieldName] = envVarValue);
538
502
  });
539
503
  }
540
- var createLogStream = async (logFileName = "storybook.log") => {
504
+ var createLogStream = async (logFileName = "forkbook.log") => {
541
505
  let finalLogPath = join4(process.cwd(), logFileName), temporaryLogPath = await temporaryFile({ name: logFileName }), logStream = createWriteStream(temporaryLogPath, { encoding: "utf8" });
542
- return new Promise((resolve7, reject) => {
506
+ return new Promise((resolve10, reject) => {
543
507
  logStream.once("open", () => {
544
508
  let clearLogFile = async () => writeFile2(temporaryLogPath, ""), removeLogFile = async () => rm2(temporaryLogPath, { recursive: !0, force: !0 });
545
- resolve7({ logStream, moveLogFile: async () => copyFile(temporaryLogPath, finalLogPath).then(removeLogFile), clearLogFile, removeLogFile, readLogFile: async () => readFile2(temporaryLogPath, { encoding: "utf8" }) });
509
+ resolve10({ logStream, moveLogFile: async () => copyFile(temporaryLogPath, finalLogPath).then(removeLogFile), clearLogFile, removeLogFile, readLogFile: async () => readFile2(temporaryLogPath, { encoding: "utf8" }) });
546
510
  }), logStream.once("error", reject);
547
511
  });
548
512
  }, isCorePackage = (pkg) => pkg === "@aussieljk/forkbook" || pkg.startsWith("@aussieljk/forkbook/"), isSatelliteAddon = (pkg) => satellite_addons_default.includes(pkg);
@@ -603,7 +567,7 @@ function readManifestName(dir) {
603
567
  }
604
568
 
605
569
  // src/common/utils/common-glob-options.ts
606
- var NODE_MODULES_RE = /node_modules/, commonGlobOptions = (glob) => NODE_MODULES_RE.test(glob) ? {} : { ignore: ["**/node_modules/**"] };
570
+ var NODE_MODULES_RE = /node_modules/, commonGlobOptions = (glob2) => NODE_MODULES_RE.test(glob2) ? {} : { ignore: ["**/node_modules/**"] };
607
571
 
608
572
  // src/common/utils/deep-merge.ts
609
573
  function deepMerge(target, source) {
@@ -613,6 +577,30 @@ function deepMerge(target, source) {
613
577
  return result;
614
578
  }
615
579
 
580
+ // src/common/utils/default-config-dir.ts
581
+ function defaultConfigDir() {
582
+ return ".forkbook";
583
+ }
584
+
585
+ // src/common/utils/framework.ts
586
+ import {
587
+ SupportedBuilder,
588
+ SupportedFramework,
589
+ SupportedRenderer
590
+ } from "@aussieljk/forkbook/internal/types";
591
+ var frameworkToRenderer = {
592
+ // frameworks
593
+ [SupportedFramework.NEXTJS_VITE]: SupportedRenderer.REACT,
594
+ [SupportedFramework.REACT_VITE]: SupportedRenderer.REACT,
595
+ // renderers
596
+ [SupportedRenderer.REACT_NATIVE]: SupportedRenderer.REACT_NATIVE,
597
+ [SupportedRenderer.REACT]: SupportedRenderer.REACT
598
+ }, frameworkToBuilder = {
599
+ // frameworks
600
+ [SupportedFramework.NEXTJS_VITE]: SupportedBuilder.VITE,
601
+ [SupportedFramework.REACT_VITE]: SupportedBuilder.VITE
602
+ };
603
+
616
604
  // src/common/utils/get-builder-options.ts
617
605
  async function getBuilderOptions(options) {
618
606
  let framework = await options.presets.apply("framework", {}, options);
@@ -622,8 +610,19 @@ async function getBuilderOptions(options) {
622
610
  return typeof builder != "string" && builder?.options ? builder.options : {};
623
611
  }
624
612
 
613
+ // src/common/utils/get-pkg-pr-new-package-specifier.ts
614
+ var PKG_PR_NEW_FORKBOOK_SPECIFIER_RE = /^(https?:\/\/[^/\s]*pkg\.pr\.new\/(?:[^@\s/]+\/[^@\s/]+\/)?)(?:create-storybook|storybook|@storybook\/[^@\s]+)(@[^\s]+)$/, isPkgPrNewVersionSpecifier = (storybookVersionSpecifier) => !!storybookVersionSpecifier?.match(PKG_PR_NEW_FORKBOOK_SPECIFIER_RE), getPkgPrNewPackageSpecifier = (packageName, storybookVersionSpecifier) => {
615
+ if (!storybookVersionSpecifier)
616
+ return;
617
+ let match = storybookVersionSpecifier.match(PKG_PR_NEW_FORKBOOK_SPECIFIER_RE);
618
+ if (!match)
619
+ return;
620
+ let [, prefix, suffix] = match;
621
+ return `${prefix}${packageName}${suffix}`;
622
+ };
623
+
625
624
  // src/common/utils/get-storybook-version-specifier-from-ancestry.ts
626
- var PKG_PR_NEW_CLI_SPECIFIER_IN_TEXT_RE = /https?:\/\/[^/\s'"]*pkg\.pr\.new\/(?:[^@\s/]+\/[^@\s/]+\/)?(?:create-storybook|storybook)@[^\s'"]+/, PACKAGE_AT_SPECIFIER_RE = /\s(?:create-storybook|storybook)@([^\s'"]+)/, stripQuotedUrls = (command) => command.replace(/['"](https?:\/\/[^'"]+)['"]/g, "$1"), getStorybookVersionSpecifierFromAncestry = (ancestry) => {
625
+ var PKG_PR_NEW_CLI_SPECIFIER_IN_TEXT_RE = /https?:\/\/[^/\s'"]*pkg\.pr\.new\/(?:[^@\s/]+\/[^@\s/]+\/)?(?:create-storybook|storybook)@[^\s'"]+/, PACKAGE_AT_SPECIFIER_RE = /\s@aussieljk\/forkbook@([^\s'"]+)/, stripQuotedUrls = (command) => command.replace(/['"](https?:\/\/[^'"]+)['"]/g, "$1"), getStorybookVersionSpecifierFromAncestry = (ancestry) => {
627
626
  for (let ancestor of ancestry.toReversed()) {
628
627
  let command = ancestor.command;
629
628
  if (!command)
@@ -643,37 +642,881 @@ var FORKBOOK_VERSION_SPECIFIER_ENV = "FORKBOOK_VERSION_SPECIFIER", resolveStoryb
643
642
  return fromEnv || getStorybookVersionSpecifierFromAncestry(ancestry);
644
643
  };
645
644
 
645
+ // src/common/utils/get-framework-name.ts
646
+ import { dedent as dedent4 } from "ts-dedent";
647
+
648
+ // src/common/utils/get-storybook-info.ts
649
+ import { existsSync as existsSync2, readFileSync as readFileSync5 } from "node:fs";
650
+ import { basename, dirname as dirname3, join as join8 } from "node:path";
651
+ import {
652
+ SupportedBuilder as SupportedBuilder2,
653
+ SupportedFramework as SupportedFramework2,
654
+ SupportedRenderer as SupportedRenderer2
655
+ } from "@aussieljk/forkbook/internal/types";
656
+
657
+ // src/common/js-package-manager/JsPackageManager.ts
658
+ import { readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "node:fs";
659
+ import { dirname as dirname2, isAbsolute as isAbsolute2, join as join6, normalize as normalize2, resolve as resolve3 } from "node:path";
660
+ import { logger as logger5, prompt } from "@aussieljk/forkbook/internal/node-logger";
661
+
662
+ // ../../node_modules/detect-indent/index.js
663
+ var INDENT_REGEX = /^(?:( )+|\t+)/, INDENT_TYPE_SPACE = "space";
664
+ function shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, value) {
665
+ return ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && value === 1;
666
+ }
667
+ function makeIndentsMap(string, ignoreSingleSpaces) {
668
+ let indents = /* @__PURE__ */ new Map(), previousSize = 0, previousIndentType, key;
669
+ for (let line of string.split(/\n/g)) {
670
+ if (!line)
671
+ continue;
672
+ let matches = line.match(INDENT_REGEX);
673
+ if (matches === null)
674
+ previousSize = 0, previousIndentType = "";
675
+ else {
676
+ let indent = matches[0].length, indentType = matches[1] ? INDENT_TYPE_SPACE : "tab";
677
+ if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, indent))
678
+ continue;
679
+ indentType !== previousIndentType && (previousSize = 0), previousIndentType = indentType;
680
+ let use = 1, weight = 0, indentDifference = indent - previousSize;
681
+ if (previousSize = indent, indentDifference === 0)
682
+ use = 0, weight = 1;
683
+ else {
684
+ let absoluteIndentDifference = Math.abs(indentDifference);
685
+ if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, absoluteIndentDifference))
686
+ continue;
687
+ key = encodeIndentsKey(indentType, absoluteIndentDifference);
688
+ }
689
+ let entry = indents.get(key);
690
+ indents.set(key, entry === void 0 ? [1, 0] : [entry[0] + use, entry[1] + weight]);
691
+ }
692
+ }
693
+ return indents;
694
+ }
695
+ function encodeIndentsKey(indentType, indentAmount) {
696
+ return (indentType === INDENT_TYPE_SPACE ? "s" : "t") + String(indentAmount);
697
+ }
698
+ function decodeIndentsKey(indentsKey) {
699
+ let type = indentsKey[0] === "s" ? INDENT_TYPE_SPACE : "tab", amount = Number(indentsKey.slice(1));
700
+ return { type, amount };
701
+ }
702
+ function getMostUsedKey(indents) {
703
+ let result, maxUsed = 0, maxWeight = 0;
704
+ for (let [key, [usedCount, weight]] of indents)
705
+ (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) && (maxUsed = usedCount, maxWeight = weight, result = key);
706
+ return result;
707
+ }
708
+ function makeIndentString(type, amount) {
709
+ return (type === INDENT_TYPE_SPACE ? " " : " ").repeat(amount);
710
+ }
711
+ function detectIndent(string) {
712
+ if (typeof string != "string")
713
+ throw new TypeError("Expected a string");
714
+ let indents = makeIndentsMap(string, !0);
715
+ indents.size === 0 && (indents = makeIndentsMap(string, !1));
716
+ let keyOfMostUsedIndent = getMostUsedKey(indents), type, amount = 0, indent = "";
717
+ return keyOfMostUsedIndent !== void 0 && ({ type, amount } = decodeIndentsKey(keyOfMostUsedIndent), indent = makeIndentString(type, amount)), {
718
+ amount,
719
+ type,
720
+ indent
721
+ };
722
+ }
723
+
724
+ // src/common/js-package-manager/JsPackageManager.ts
725
+ var import_picocolors = __toESM(require_picocolors(), 1);
726
+ import { coerce, gt as gt2, satisfies, validRange } from "semver";
727
+
728
+ // src/common/utils/HandledError.ts
729
+ var HandledError = class extends Error {
730
+ constructor(error) {
731
+ super(String(error));
732
+ this.handled = !0;
733
+ typeof error != "string" && (this.cause = error);
734
+ }
735
+ };
736
+
737
+ // src/common/js-package-manager/util.ts
738
+ import { gt, prerelease, valid } from "semver";
739
+ var FORKBOOK_PACKAGE_PATTERNS = ["@aussieljk/forkbook", "@storybook/*"], escapePatternForRegex = (pattern) => pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), packagePatternToRegex = (pattern) => new RegExp(`^${escapePatternForRegex(pattern).replace(/\\\*/g, ".*")}$`), hasStorybookMinimumAgeExclusions = (configuredPatterns) => FORKBOOK_PACKAGE_PATTERNS.every(
740
+ (storybookPattern) => configuredPatterns.some(
741
+ (configuredPattern) => packagePatternToRegex(configuredPattern).test(storybookPattern)
742
+ )
743
+ ), parsePackageData = (packageName = "") => {
744
+ let [first, second, third] = packageName.replace(/[└─├]+/g, "").trim().split("@"), version = (third || second).replace("npm:", "");
745
+ return { name: third ? `@${second}` : first, value: { version, location: "" } };
746
+ }, parsePositiveIntegerConfigValue = (value) => {
747
+ let normalizedValue = value?.trim() ?? "";
748
+ if (!normalizedValue || normalizedValue === "undefined" || normalizedValue === "null" || normalizedValue === "false")
749
+ return null;
750
+ let parsedValue = Number.parseInt(normalizedValue, 10);
751
+ return !Number.isFinite(parsedValue) || parsedValue <= 0 ? null : parsedValue;
752
+ }, parseReleaseTime = (value) => {
753
+ if (typeof value != "string" || value.length === 0)
754
+ return null;
755
+ let releaseTime = new Date(value);
756
+ return Number.isNaN(releaseTime.getTime()) ? null : releaseTime;
757
+ }, parsePackageTimeMap = (value) => {
758
+ if (Array.isArray(value) && value.length === 1 && (value = value[0]), !value || typeof value != "object" || Array.isArray(value))
759
+ return null;
760
+ let timeMap = {};
761
+ for (let [version, releaseTime] of Object.entries(value))
762
+ typeof releaseTime == "string" && releaseTime.length > 0 && (timeMap[version] = releaseTime);
763
+ return timeMap;
764
+ }, getAgeInMinutes = (publishedAt, now = /* @__PURE__ */ new Date()) => Math.floor((now.getTime() - publishedAt.getTime()) / 6e4), getLatestStableVersionAdheringToMinimumAgeGate = (timeMap, minimumAgeGateMinutes, now = /* @__PURE__ */ new Date()) => {
765
+ let cutoff = now.getTime() - minimumAgeGateMinutes * 6e4, latestStableVersion = null;
766
+ for (let [version, releaseTime] of Object.entries(timeMap)) {
767
+ if (!valid(version) || prerelease(version))
768
+ continue;
769
+ let publishedAt = parseReleaseTime(releaseTime);
770
+ !publishedAt || publishedAt.getTime() > cutoff || (!latestStableVersion || gt(version, latestStableVersion)) && (latestStableVersion = version);
771
+ }
772
+ return latestStableVersion;
773
+ };
774
+ function getVitestStorybookRunCommand(packageManager, file) {
775
+ let args = ["vitest", "--project", "storybook", "run"];
776
+ return file && args.push(file), packageManager.getPackageCommand(args);
777
+ }
778
+ function getMswInitCommand(packageManager) {
779
+ return packageManager.getPackageCommand(["msw", "init", "./public", "--save"]);
780
+ }
781
+ var FORKBOOK_RERUN_INSTRUCTION = "Please rerun Forkbook creation with:", getStorybookRerunCommand = (compatibleVersion) => compatibleVersion ? `npx @aussieljk/forkbook@${compatibleVersion} init` : "npx @aussieljk/forkbook@<compatible-version> init", getErrorLogs = (error) => {
782
+ if (typeof error == "string")
783
+ return error;
784
+ if (error && typeof error == "object") {
785
+ let structuredError = error, structuredLogs = [
786
+ structuredError.shortMessage,
787
+ structuredError.originalMessage,
788
+ structuredError.stderr,
789
+ structuredError.stdout,
790
+ structuredError.message
791
+ ].filter((entry) => typeof entry == "string" && entry.length > 0);
792
+ if (structuredLogs.length > 0)
793
+ return structuredLogs.join(`
794
+ `);
795
+ }
796
+ return String(error);
797
+ }, INSTALL_ERROR_TAIL_LINES = 15, getInstallErrorTail = (error, lines = INSTALL_ERROR_TAIL_LINES) => {
798
+ let output = getErrorLogs(error).trimEnd();
799
+ return output ? output.split(`
800
+ `).slice(-lines).join(`
801
+ `).trim() : "";
802
+ };
803
+
804
+ // src/common/js-package-manager/vite-plus-versions.ts
805
+ import { logger as logger4 } from "@aussieljk/forkbook/internal/node-logger";
806
+ var cachedVersions;
807
+ async function getVitePlusVersions() {
808
+ if (cachedVersions !== void 0)
809
+ return cachedVersions;
810
+ try {
811
+ let mod = await import("vite-plus/versions"), versions = mod.versions ?? mod;
812
+ if (versions && typeof versions.vite == "string")
813
+ return logger4.debug(`Detected vite-plus: vite=${versions.vite}, vitest=${versions.vitest ?? "N/A"}`), cachedVersions = versions, versions;
814
+ } catch {
815
+ }
816
+ return cachedVersions = null, null;
817
+ }
818
+ function clearVitePlusCache() {
819
+ cachedVersions = void 0;
820
+ }
821
+
822
+ // src/common/js-package-manager/JsPackageManager.ts
823
+ var PackageManagerName = /* @__PURE__ */ ((PackageManagerName2) => (PackageManagerName2.NPM = "npm", PackageManagerName2.YARN1 = "yarn1", PackageManagerName2.YARN2 = "yarn2", PackageManagerName2.PNPM = "pnpm", PackageManagerName2.BUN = "bun", PackageManagerName2))(PackageManagerName || {}), indentSymbol = /* @__PURE__ */ Symbol("indent"), PACKAGE_MANAGER_LABEL = {
824
+ npm: "npm",
825
+ yarn1: "Yarn Classic (v1)",
826
+ yarn2: "Yarn Berry",
827
+ pnpm: "pnpm",
828
+ bun: "Bun"
829
+ };
830
+ function isValidPackageManagerName(name) {
831
+ return Object.hasOwn(PACKAGE_MANAGER_LABEL, name);
832
+ }
833
+ function getPrettyPackageManagerName(packageManager) {
834
+ return packageManager ? isValidPackageManagerName(packageManager) ? PACKAGE_MANAGER_LABEL[packageManager] : packageManager : "unknown package manager";
835
+ }
836
+ function getPackageDetails(pkg) {
837
+ let isScopedPackage = pkg.startsWith("@"), scopeSeparatorIndex = isScopedPackage ? pkg.indexOf("/") : -1, versionSeparatorIndex = isScopedPackage ? scopeSeparatorIndex === -1 ? -1 : pkg.indexOf("@", scopeSeparatorIndex + 1) : pkg.indexOf("@");
838
+ if (versionSeparatorIndex <= 0)
839
+ return [pkg, void 0];
840
+ let packageName = pkg.slice(0, versionSeparatorIndex), packageVersion = pkg.slice(versionSeparatorIndex + 1);
841
+ return [packageName, packageVersion];
842
+ }
843
+ var JsPackageManager = class _JsPackageManager {
844
+ static {
845
+ /** Cache for latest version results to avoid repeated network calls. */
846
+ this.latestVersionCache = /* @__PURE__ */ new Map();
847
+ }
848
+ static {
849
+ /** Cache for installed version results to avoid repeated file system calls. */
850
+ this.installedVersionCache = /* @__PURE__ */ new Map();
851
+ }
852
+ static {
853
+ /** Cache for package.json files to avoid repeated file system calls. */
854
+ this.packageJsonCache = /* @__PURE__ */ new Map();
855
+ }
856
+ constructor(options) {
857
+ this.cwd = options?.cwd || process.cwd(), this.instanceDir = options?.configDir ? isAbsolute2(options?.configDir) ? dirname2(options?.configDir) : dirname2(join6(this.cwd, options?.configDir)) : this.cwd, this.packageJsonPaths = _JsPackageManager.listAllPackageJsonPaths(
858
+ this.instanceDir,
859
+ options?.storiesPaths
860
+ ), this.primaryPackageJson = this.#getPrimaryPackageJson();
861
+ }
862
+ isStorybookInMonorepo() {
863
+ let turboJsonPath = up2("turbo.json", { last: getProjectRoot() }), rushJsonPath = up2("rush.json", { last: getProjectRoot() }), nxJsonPath = up2("nx.json", { last: getProjectRoot() });
864
+ if (turboJsonPath || rushJsonPath || nxJsonPath)
865
+ return !0;
866
+ let packageJsonPaths = findFilesUp(["package.json"]);
867
+ if (packageJsonPaths.length === 0)
868
+ return !1;
869
+ for (let packageJsonPath of packageJsonPaths) {
870
+ let packageJsonFile = readFileSync4(packageJsonPath, "utf8");
871
+ if (JSON.parse(packageJsonFile).workspaces)
872
+ return !0;
873
+ }
874
+ return !1;
875
+ }
876
+ async installDependencies(options) {
877
+ try {
878
+ await prompt.executeTaskWithSpinner(() => this.runInstall(options), {
879
+ id: "install-dependencies",
880
+ intro: "Installing dependencies...",
881
+ error: "Installation of dependencies failed!",
882
+ success: "Dependencies installed"
883
+ });
884
+ } catch (error) {
885
+ let tail = getInstallErrorTail(error);
886
+ throw tail && (logger5.error(tail), error instanceof Error && !error.message.includes(tail) && (error.message = `${error.message}
887
+
888
+ ${tail}`)), error;
889
+ }
890
+ this.clearInstalledVersionCache();
891
+ }
892
+ async precheckStorybookPackageInstall(options) {
893
+ }
894
+ async dedupeDependencies(options) {
895
+ await prompt.executeTask(
896
+ (_signal) => this.runInternalCommand("dedupe", [...options?.force ? ["--force"] : []], this.cwd),
897
+ {
898
+ intro: "Deduplicating dependencies...",
899
+ error: "An error occurred while deduplicating dependencies.",
900
+ success: "Dependencies deduplicated"
901
+ }
902
+ ), this.clearInstalledVersionCache();
903
+ }
904
+ /** Read the `package.json` file available in the provided directory */
905
+ static getPackageJson(packageJsonPath) {
906
+ let absolutePath = normalize2(resolve3(packageJsonPath)), cached = _JsPackageManager.packageJsonCache.get(absolutePath);
907
+ if (cached)
908
+ return logger5.debug(`Using cached package.json for ${absolutePath}...`), cached;
909
+ let jsonContent = readFileSync4(absolutePath, "utf8"), packageJSON = JSON.parse(jsonContent);
910
+ packageJSON[indentSymbol] = detectIndent(jsonContent).indent ?? 2;
911
+ let result = {
912
+ ...packageJSON,
913
+ dependencies: { ...packageJSON.dependencies || {} },
914
+ devDependencies: { ...packageJSON.devDependencies || {} },
915
+ peerDependencies: { ...packageJSON.peerDependencies || {} }
916
+ };
917
+ return _JsPackageManager.packageJsonCache.set(absolutePath, result), result;
918
+ }
919
+ #getIndent(filePath) {
920
+ try {
921
+ return _JsPackageManager.getPackageJson(filePath)[indentSymbol];
922
+ } catch {
923
+ return 2;
924
+ }
925
+ }
926
+ writePackageJson(packageJson, directory = this.cwd) {
927
+ let packageJsonToWrite = { ...packageJson };
928
+ ["dependencies", "devDependencies", "peerDependencies"].forEach((type) => {
929
+ packageJsonToWrite[type] && Object.keys(packageJsonToWrite[type]).length === 0 && delete packageJsonToWrite[type];
930
+ });
931
+ let filePath = join6(directory, "package.json"), indent = this.#getIndent(filePath), packageJsonPath = normalize2(resolve3(directory, "package.json")), content = `${JSON.stringify(packageJsonToWrite, null, indent)}
932
+ `;
933
+ writeFileSync2(packageJsonPath, content, "utf8");
934
+ let cachedPackageJson = packageJsonToWrite;
935
+ cachedPackageJson.dependencies = { ...packageJsonToWrite.dependencies || {} }, cachedPackageJson.devDependencies = { ...packageJsonToWrite.devDependencies || {} }, cachedPackageJson.peerDependencies = { ...packageJsonToWrite.peerDependencies || {} }, cachedPackageJson[indentSymbol] = indent, _JsPackageManager.packageJsonCache.set(packageJsonPath, cachedPackageJson);
936
+ }
937
+ getAllDependencies() {
938
+ let allDependencies = {};
939
+ for (let packageJsonPath of this.packageJsonPaths) {
940
+ let packageJson = _JsPackageManager.getPackageJson(packageJsonPath), { dependencies, devDependencies, peerDependencies } = packageJson;
941
+ Object.assign(allDependencies, dependencies, devDependencies, peerDependencies);
942
+ }
943
+ return allDependencies;
944
+ }
945
+ isDependencyInstalled(dependency) {
946
+ return Object.keys(this.getAllDependencies()).includes(dependency);
947
+ }
948
+ /**
949
+ * Resolve the effective version/range of a declared dependency: the installed version if present,
950
+ * otherwise the declared semver range. Returns null when the package is not declared or only a
951
+ * non-semver specifier is declared. PNPMProxy additionally resolves pnpm `catalog:` references.
952
+ */
953
+ async getDeclaredVersionSpecifier(packageName) {
954
+ let installed = await this.getInstalledVersion(packageName);
955
+ if (installed)
956
+ return installed;
957
+ let declared = this.getAllDependencies()[packageName];
958
+ return declared && validRange(declared) ? declared : null;
959
+ }
960
+ /**
961
+ * Pin `packages` to `version`, mirroring how `anchorPackage` is declared. The base implementation
962
+ * pins each directly (`pkg@version`). PNPMProxy overrides this to honor pnpm catalogs: when
963
+ * `anchorPackage` is declared through a catalog, the packages are registered in that catalog and
964
+ * referenced as `catalog:` instead. Returns the install specifiers to write to package.json.
965
+ */
966
+ applyVersionToRelatedPackages(packages, version, _anchorPackage) {
967
+ return packages.map((pkg) => `${pkg}@${version}`);
968
+ }
969
+ /**
970
+ * Add dependencies to a project using `yarn add` or `npm install`.
971
+ *
972
+ * @example
973
+ *
974
+ * ```ts
975
+ * addDependencies(options, [
976
+ * `@aussieljk/forkbook/react@${storybookVersion}`,
977
+ * `@aussieljk/forkbook/addon-links@${linksVersion}`,
978
+ * ]);
979
+ * ```
980
+ *
981
+ * @param {Object} options Contains `skipInstall`, `packageJson` and `installAsDevDependencies`
982
+ * which we use to determine how we install packages.
983
+ * @param {Array} dependencies Contains a list of packages to add.
984
+ */
985
+ async addDependencies(options, dependencies) {
986
+ let {
987
+ skipInstall,
988
+ writeOutputToFile = !0,
989
+ packageJsonInfo = this.primaryPackageJson
990
+ } = options;
991
+ if (skipInstall) {
992
+ let { operationDir, packageJson } = packageJsonInfo, dependenciesMap = {};
993
+ for (let dep of dependencies) {
994
+ let [packageName, packageVersion] = getPackageDetails(dep);
995
+ dependenciesMap[packageName] = packageVersion ?? "latest";
996
+ }
997
+ let targetDeps = packageJson[options.type];
998
+ Object.assign(targetDeps, dependenciesMap), this.writePackageJson(packageJson, operationDir);
999
+ } else
1000
+ try {
1001
+ let result = this.runAddDeps(
1002
+ dependencies,
1003
+ options.type === "devDependencies",
1004
+ writeOutputToFile
1005
+ );
1006
+ return this.clearInstalledVersionCache(), result;
1007
+ } catch (e) {
1008
+ throw logger5.error(`
1009
+ An error occurred while adding dependencies to your package.json:`), logger5.log(String(e)), typeof e == "object" && e !== null && "fromStorybook" in e && e.fromStorybook ? e : new HandledError(e);
1010
+ }
1011
+ }
1012
+ /**
1013
+ * Removing dependencies from the package.json file, which is found first starting from the
1014
+ * instance root. The method does not run a package manager install like `npm install`.
1015
+ *
1016
+ * @example
1017
+ *
1018
+ * ```ts
1019
+ * removeDependencies([`@aussieljk/forkbook/react`]);
1020
+ * ```
1021
+ *
1022
+ * @param dependencies Contains a list of packages to remove.
1023
+ */
1024
+ async removeDependencies(dependencies) {
1025
+ for (let pjPath of this.packageJsonPaths)
1026
+ try {
1027
+ let packageJson = _JsPackageManager.getPackageJson(pjPath), modified = !1;
1028
+ if (dependencies.forEach((dep) => {
1029
+ packageJson.dependencies && packageJson.dependencies[dep] && (delete packageJson.dependencies[dep], modified = !0), packageJson.devDependencies && packageJson.devDependencies[dep] && (delete packageJson.devDependencies[dep], modified = !0), packageJson.peerDependencies && packageJson.peerDependencies[dep] && (delete packageJson.peerDependencies[dep], modified = !0);
1030
+ }), modified) {
1031
+ this.writePackageJson(packageJson, dirname2(pjPath));
1032
+ break;
1033
+ }
1034
+ } catch (e) {
1035
+ logger5.warn(`Could not process ${pjPath} for dependency removal: ${String(e)}`);
1036
+ }
1037
+ }
1038
+ /**
1039
+ * Return an array of strings matching following format: `<storybook_package_name>@<package_latest_version>`
1040
+ *
1041
+ * For packages in the storybook monorepo, when the latest version is equal to the version of the
1042
+ * current CLI the version is not added to the string.
1043
+ *
1044
+ * When a package is in the monorepo, and the version is not equal to the CLI version, the version
1045
+ * is taken from the versions.ts file and added to the string.
1046
+ *
1047
+ * When a package is not in the monorepo, we don't change the package version and return the package name as is.
1048
+ * The package manager will resolve the latest version of the package upon installing it.
1049
+ *
1050
+ * @param packages
1051
+ */
1052
+ getVersionedPackages(packages, options) {
1053
+ return Promise.all(
1054
+ packages.map(async (pkg) => {
1055
+ let [packageName, packageVersion] = getPackageDetails(pkg);
1056
+ if (!(packageName in versions_default))
1057
+ return pkg;
1058
+ if (packageName in versions_default) {
1059
+ let pkgPrNewSpecifier = getPkgPrNewPackageSpecifier(
1060
+ packageName,
1061
+ options?.storybookVersionSpecifier
1062
+ );
1063
+ if (pkgPrNewSpecifier)
1064
+ return `${packageName}@${pkgPrNewSpecifier}`;
1065
+ }
1066
+ let latestInRange = await this.latestVersion(packageName, packageVersion), currentVersion = versions_default[packageName];
1067
+ return currentVersion === latestInRange || !currentVersion ? `${packageName}@^${latestInRange}` : `${packageName}@${currentVersion}`;
1068
+ })
1069
+ );
1070
+ }
1071
+ /**
1072
+ * Return an array of string standing for the latest version of the input packages. To be able to
1073
+ * identify which version goes with which package the order of the input array is keep.
1074
+ *
1075
+ * @param packageNames
1076
+ */
1077
+ getVersions(...packageNames) {
1078
+ return Promise.all(
1079
+ packageNames.map((packageName) => this.getVersion(packageName))
1080
+ );
1081
+ }
1082
+ /**
1083
+ * Return the latest version of the input package available on npmjs registry. If constraint are
1084
+ * provided it return the latest version matching the constraints.
1085
+ *
1086
+ * For `@storybook/*` packages the latest version is retrieved from `cli/src/versions.json` file
1087
+ * directly
1088
+ *
1089
+ * @param packageName The name of the package
1090
+ * @param constraint A valid semver constraint, example: '1.x || >=2.5.0 || 5.0.0 - 7.2.3'
1091
+ */
1092
+ async getVersion(packageName, constraint) {
1093
+ let current;
1094
+ packageName in versions_default && (current = versions_default[packageName]);
1095
+ let latest;
1096
+ try {
1097
+ if (latest = await this.latestVersion(packageName, constraint), !latest)
1098
+ throw new Error(`No version found for ${packageName}`);
1099
+ } catch (e) {
1100
+ if (current)
1101
+ return logger5.warn(`
1102
+ ${import_picocolors.default.yellow(String(e))}`), current;
1103
+ throw logger5.error(`
1104
+ ${import_picocolors.default.red(String(e))}`), new HandledError(e);
1105
+ }
1106
+ return `^${current && (!constraint || satisfies(current, constraint)) && gt2(current, latest) ? current : latest}`;
1107
+ }
1108
+ /**
1109
+ * Get the latest version of the package available on npmjs.com. If constraint is set then it
1110
+ * returns a version satisfying it, otherwise the latest version available is returned.
1111
+ *
1112
+ * @param packageName Name of the package
1113
+ * @param constraint Version range to use to constraint the returned version
1114
+ */
1115
+ async latestVersion(packageName, constraint) {
1116
+ let cacheKey = constraint ? `${packageName}@${constraint}` : packageName, cachedVersion = _JsPackageManager.latestVersionCache.get(cacheKey);
1117
+ if (cachedVersion)
1118
+ return logger5.debug(`Using cached version for ${packageName}...`), cachedVersion;
1119
+ let result;
1120
+ logger5.debug(`Getting CLI versions from NPM for ${packageName}...`);
1121
+ try {
1122
+ if (!constraint)
1123
+ result = await this.runGetVersions(packageName, !1);
1124
+ else {
1125
+ let latestVersionSatisfyingTheConstraint = (await this.runGetVersions(packageName, !0)).reverse().find((version) => satisfies(version, constraint));
1126
+ invariant(
1127
+ latestVersionSatisfyingTheConstraint != null,
1128
+ `No version satisfying the constraint: ${packageName}${constraint}`
1129
+ ), result = latestVersionSatisfyingTheConstraint;
1130
+ }
1131
+ return _JsPackageManager.latestVersionCache.set(cacheKey, result), result;
1132
+ } catch (e) {
1133
+ return logger5.debug(`Failed to fetch the latest version for ${packageName}: ${String(e)}`), _JsPackageManager.latestVersionCache.set(cacheKey, null), null;
1134
+ }
1135
+ }
1136
+ /**
1137
+ * Clear the latest version cache. Useful for testing or when you want to refresh version
1138
+ * information.
1139
+ *
1140
+ * @param packageName Optional package name to clear only specific entries. If not provided,
1141
+ * clears all cache.
1142
+ */
1143
+ static clearLatestVersionCache(packageName) {
1144
+ packageName ? Array.from(_JsPackageManager.latestVersionCache.keys()).filter(
1145
+ (key) => key === packageName || key.startsWith(`${packageName}@`)
1146
+ ).forEach((key) => _JsPackageManager.latestVersionCache.delete(key)) : _JsPackageManager.latestVersionCache.clear();
1147
+ }
1148
+ /**
1149
+ * Clear the installed version cache for a specific package or all packages.
1150
+ *
1151
+ * @param packageName Optional package name to clear from cache. If not provided, clears all.
1152
+ */
1153
+ clearInstalledVersionCache(packageName) {
1154
+ packageName ? Array.from(_JsPackageManager.installedVersionCache.keys()).filter(
1155
+ (key) => key.endsWith(`::${packageName}`)
1156
+ ).forEach((key) => _JsPackageManager.installedVersionCache.delete(key)) : _JsPackageManager.installedVersionCache.clear();
1157
+ }
1158
+ /**
1159
+ * Clear both the latest version cache and installed version cache. This should be called after
1160
+ * any operation that modifies dependencies.
1161
+ */
1162
+ clearAllVersionCaches() {
1163
+ _JsPackageManager.clearLatestVersionCache(), this.clearInstalledVersionCache();
1164
+ }
1165
+ addStorybookCommandInScripts(options) {
1166
+ let storybookCmd = `forkbook dev -p ${options?.port ?? 6006}`, buildStorybookCmd = "forkbook build", preCommand = options?.preCommand ? this.getRunCommand(options.preCommand) : void 0;
1167
+ this.addScripts({
1168
+ forkbook: [preCommand, storybookCmd].filter(Boolean).join(" && "),
1169
+ "build-forkbook": [preCommand, buildStorybookCmd].filter(Boolean).join(" && ")
1170
+ });
1171
+ }
1172
+ addScripts(scripts) {
1173
+ let { operationDir, packageJson } = this.#getPrimaryPackageJson();
1174
+ packageJson.scripts = {
1175
+ ...packageJson.scripts,
1176
+ ...scripts
1177
+ }, this.writePackageJson(packageJson, operationDir);
1178
+ }
1179
+ addPackageResolutions(versions) {
1180
+ let { operationDir, packageJson } = this.#getPrimaryPackageJson(), resolutions = this.getResolutions(packageJson, versions);
1181
+ this.writePackageJson({ ...packageJson, ...resolutions }, operationDir);
1182
+ }
1183
+ /** Returns the installed version of a specified package */
1184
+ async getInstalledVersion(packageName) {
1185
+ let cacheKey = packageName;
1186
+ try {
1187
+ let cachedVersion = _JsPackageManager.installedVersionCache.get(cacheKey);
1188
+ if (cachedVersion !== void 0)
1189
+ return logger5.debug(`Using cached installed version for ${packageName}...`), cachedVersion;
1190
+ logger5.debug(`Getting installed version for ${packageName}...`);
1191
+ let version = null, vitePlusVersions = await getVitePlusVersions();
1192
+ if (vitePlusVersions?.[packageName] && (version = vitePlusVersions[packageName]), !version) {
1193
+ let installations = await this.findInstallations([packageName]);
1194
+ installations && (version = Object.entries(installations.dependencies)[0]?.[1]?.[0].version || null);
1195
+ }
1196
+ if (!version)
1197
+ return logger5.debug(`No installations found for ${packageName}`), _JsPackageManager.installedVersionCache.set(cacheKey, null), null;
1198
+ let coercedVersion = coerce(version, { includePrerelease: !0 })?.toString() ?? version;
1199
+ return logger5.debug(`Installed version for ${packageName}: ${coercedVersion}`), _JsPackageManager.installedVersionCache.set(cacheKey, coercedVersion), coercedVersion;
1200
+ } catch (e) {
1201
+ return logger5.error(`Error getting installed version for ${packageName}: ${String(e)}`), _JsPackageManager.installedVersionCache.set(cacheKey, null), null;
1202
+ }
1203
+ }
1204
+ async isPackageInstalled(packageName) {
1205
+ return await this.getInstalledVersion(packageName) !== null;
1206
+ }
1207
+ /**
1208
+ * Searches for a dependency/devDependency in all package.json files and returns the version of
1209
+ * the dependency.
1210
+ */
1211
+ getDependencyVersion(dependency) {
1212
+ return logger5.debug(`Getting dependency version for ${dependency}...`), this.packageJsonPaths.map((path) => {
1213
+ let packageJson = _JsPackageManager.getPackageJson(path);
1214
+ return packageJson.dependencies?.[dependency] ?? packageJson.devDependencies?.[dependency];
1215
+ }).filter(Boolean)[0] ?? null;
1216
+ }
1217
+ // Helper to read and check a package.json for storybook dependency
1218
+ static hasStorybookDependency(packageJsonPath) {
1219
+ try {
1220
+ let content = readFileSync4(packageJsonPath, "utf-8"), packageJson = JSON.parse(content);
1221
+ return !!(packageJson.dependencies && packageJson.dependencies.storybook || packageJson.devDependencies && packageJson.devDependencies.storybook);
1222
+ } catch {
1223
+ return !1;
1224
+ }
1225
+ }
1226
+ // Helper to read and check a package.json for storybook dependency
1227
+ static hasAnyStorybookDependency(packageJsonPath) {
1228
+ try {
1229
+ let content = readFileSync4(packageJsonPath, "utf-8"), packageJson = JSON.parse(content), allDeps = {
1230
+ ...packageJson.dependencies,
1231
+ ...packageJson.devDependencies
1232
+ };
1233
+ return Object.keys(allDeps).some(
1234
+ (dep) => dep.includes("storybook") || dep === "@aussieljk/forkbook"
1235
+ );
1236
+ } catch {
1237
+ return !1;
1238
+ }
1239
+ }
1240
+ /**
1241
+ * Find the primary package.json file in the project root. The primary package.json file is the
1242
+ * one that contains the `storybook` dependency. If no primary package.json file is found, the
1243
+ * function will return the package.json file in the project root.
1244
+ */
1245
+ #findPrimaryPackageJsonPath() {
1246
+ for (let packageJsonPath of this.packageJsonPaths)
1247
+ if (_JsPackageManager.hasStorybookDependency(packageJsonPath))
1248
+ return packageJsonPath;
1249
+ return this.packageJsonPaths[0] ?? resolve3(this.cwd, "package.json");
1250
+ }
1251
+ /** List all package.json files starting from the given directory and stopping at the project root. */
1252
+ static listAllPackageJsonPaths(instanceDir, storiesPaths) {
1253
+ let packageJsonPaths = findFilesUp(["package.json"], instanceDir);
1254
+ if (!storiesPaths)
1255
+ return packageJsonPaths;
1256
+ let projectRoot = getProjectRoot(), relevantPackageJsons = globSync("**/package.json", {
1257
+ cwd: projectRoot,
1258
+ absolute: !0,
1259
+ expandDirectories: !1,
1260
+ ignore: ["**/node_modules/**", "**/dist/**"]
1261
+ }).filter((packageJsonPath) => {
1262
+ let packageDir = dirname2(packageJsonPath);
1263
+ return storiesPaths.some((storyPath) => storyPath.startsWith(packageDir));
1264
+ });
1265
+ return Array.from(/* @__PURE__ */ new Set([...packageJsonPaths, ...relevantPackageJsons]));
1266
+ }
1267
+ /**
1268
+ * Get the primary package.json file and its operation directory. The primary package.json file is
1269
+ * the one that contains the storybook dependency. If the primary package.json file is not found,
1270
+ * the function returns information about thepackage.json file in the current working directory.
1271
+ */
1272
+ #getPrimaryPackageJson() {
1273
+ let finalTargetPackageJsonPath = this.#findPrimaryPackageJsonPath();
1274
+ return _JsPackageManager.getPackageJsonInfo(finalTargetPackageJsonPath);
1275
+ }
1276
+ static getPackageJsonInfo(packageJsonPath) {
1277
+ logger5.debug(`Getting package.json info for ${packageJsonPath}...`);
1278
+ let operationDir = dirname2(packageJsonPath);
1279
+ return {
1280
+ packageJsonPath,
1281
+ operationDir,
1282
+ get packageJson() {
1283
+ return _JsPackageManager.getPackageJson(packageJsonPath);
1284
+ }
1285
+ };
1286
+ }
1287
+ };
1288
+
1289
+ // src/common/utils/normalize-path.ts
1290
+ import { posix as posix2 } from "node:path";
1291
+ function normalizePath2(p) {
1292
+ return posix2.normalize(p.replace(/\\/g, "/"));
1293
+ }
1294
+
1295
+ // src/common/utils/get-addon-names.ts
1296
+ var normalizeAddonName = (addon) => {
1297
+ let name = "";
1298
+ if (typeof addon == "string" ? name = addon : typeof addon == "object" && (name = addon.name), !name.startsWith("."))
1299
+ return name = normalizePath2(name), name = name.replace(/.*node_modules\//, ""), name.replace(/\/dist\/.*$/, "").replace(/\.[mc]?[tj]?sx?$/, "").replace(/\/register$/, "").replace(/\/manager$/, "").replace(/\/preset$/, "");
1300
+ }, getAddonNames = (mainConfig) => (mainConfig.addons || []).map(normalizeAddonName).filter((item) => item != null);
1301
+
1302
+ // src/common/utils/get-renderer-name.ts
1303
+ async function getRendererName(options) {
1304
+ let core = await options.presets.apply("core", {}, options);
1305
+ return !core || !core.renderer ? getFrameworkName(options) : core.renderer;
1306
+ }
1307
+ async function extractRenderer(frameworkName) {
1308
+ let extractedFrameworkName = extractFrameworkPackageName(frameworkName), framework = frameworkPackages[extractedFrameworkName];
1309
+ return framework ? frameworkToRenderer[framework] : null;
1310
+ }
1311
+
1312
+ // src/common/utils/get-storybook-configuration.ts
1313
+ function getStorybookConfiguration(storybookScript, shortName, longName) {
1314
+ if (!storybookScript)
1315
+ return null;
1316
+ let parts = storybookScript.split(/[\s='"]+/), index = parts.indexOf(longName);
1317
+ return index === -1 && (index = parts.indexOf(shortName)), index === -1 ? null : parts[index + 1];
1318
+ }
1319
+
1320
+ // src/common/utils/load-main-config.ts
1321
+ import { readFile as readFile3, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
1322
+ import { join as join7, parse as parse2, relative, resolve as resolve4 } from "node:path";
1323
+ import { logger as logger6 } from "@aussieljk/forkbook/internal/node-logger";
1324
+ import { MainFileEvaluationError } from "@aussieljk/forkbook/internal/server-errors";
1325
+ import { dedent as dedent3 } from "ts-dedent";
1326
+ async function loadMainConfig({
1327
+ configDir = defaultConfigDir(),
1328
+ cwd,
1329
+ skipCache
1330
+ }) {
1331
+ await validateConfigurationFiles(configDir, cwd);
1332
+ let mainPath = getInterpretedFile(resolve4(configDir, "main"));
1333
+ try {
1334
+ return await importModule(mainPath, { skipCache });
1335
+ } catch (e) {
1336
+ if (!(e instanceof Error))
1337
+ throw e;
1338
+ if (e.message.includes("not defined in ES module scope")) {
1339
+ logger6.info(
1340
+ "Loading main config failed as the file does not seem to be valid ESM. Trying a temporary fix, please ensure the main config is valid ESM."
1341
+ );
1342
+ let comment = "// end of Forkbook 10 migration assistant header, you can delete the above code", content = await readFile3(mainPath, "utf-8");
1343
+ if (!content.includes(comment)) {
1344
+ let header = dedent3`
1345
+ import { createRequire } from "node:module";
1346
+ import { dirname } from "node:path";
1347
+ import { fileURLToPath } from "node:url";
1348
+
1349
+ const __filename = fileURLToPath(import.meta.url);
1350
+ const __dirname = dirname(__filename);
1351
+ const require = createRequire(import.meta.url);
1352
+ `, { ext, name, dir } = parse2(mainPath), modifiedMainPath = join7(dir, `${name}.tmp.${ext}`);
1353
+ await writeFile3(modifiedMainPath, [header, comment, content].join(`
1354
+
1355
+ `));
1356
+ let out;
1357
+ try {
1358
+ out = await importModule(modifiedMainPath);
1359
+ } finally {
1360
+ await rm3(modifiedMainPath);
1361
+ }
1362
+ return out;
1363
+ }
1364
+ }
1365
+ throw new MainFileEvaluationError({
1366
+ location: relative(process.cwd(), mainPath),
1367
+ error: e
1368
+ });
1369
+ }
1370
+ }
1371
+
1372
+ // src/common/utils/get-storybook-info.ts
1373
+ var rendererPackages = {
1374
+ "@aussieljk/forkbook/react": SupportedRenderer2.REACT,
1375
+ "@storybook/react-native": SupportedRenderer2.REACT_NATIVE
1376
+ }, frameworkPackages = {
1377
+ "@aussieljk/forkbook/react-vite": SupportedFramework2.REACT_VITE,
1378
+ "@aussieljk/forkbook/nextjs-vite": SupportedFramework2.NEXTJS_VITE
1379
+ }, builderPackages = {
1380
+ "@aussieljk/forkbook/builder-vite": SupportedBuilder2.VITE
1381
+ }, findDependency = ({ dependencies, devDependencies, peerDependencies }, predicate) => [
1382
+ Object.entries(dependencies || {}).find(predicate),
1383
+ Object.entries(devDependencies || {}).find(predicate),
1384
+ Object.entries(peerDependencies || {}).find(predicate)
1385
+ ], getStorybookVersionSpecifier = (configDir) => {
1386
+ let packageJsonPaths = JsPackageManager.listAllPackageJsonPaths(dirname3(configDir));
1387
+ for (let packageJsonPath of packageJsonPaths) {
1388
+ let packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf-8")), [dep, devDep, peerDep] = findDependency(
1389
+ packageJson,
1390
+ ([key]) => key === "@aussieljk/forkbook"
1391
+ ), [pkg, version] = dep || devDep || peerDep || [];
1392
+ if (pkg && version)
1393
+ return version;
1394
+ }
1395
+ }, findConfigFile = (prefix, configDir) => {
1396
+ let filePrefix = join8(configDir, prefix), extension = storybookConfigExtensions.find((ext) => existsSync2(`${filePrefix}${ext}`));
1397
+ return extension ? `${filePrefix}${extension}` : null;
1398
+ }, getConfigInfo = (configDir) => {
1399
+ let storybookConfigDir = configDir ?? defaultConfigDir();
1400
+ if (!existsSync2(storybookConfigDir)) {
1401
+ let packageJsonPaths = JsPackageManager.listAllPackageJsonPaths(storybookConfigDir);
1402
+ for (let packageJsonPath of packageJsonPaths) {
1403
+ let storybookScript = JSON.parse(readFileSync5(packageJsonPath, "utf-8")).scripts?.forkbook;
1404
+ if (storybookScript && !configDir) {
1405
+ let configParam = getStorybookConfiguration(storybookScript, "-c", "--config-dir");
1406
+ if (configParam) {
1407
+ storybookConfigDir = configParam;
1408
+ break;
1409
+ }
1410
+ }
1411
+ }
1412
+ }
1413
+ return {
1414
+ configDir: storybookConfigDir,
1415
+ mainConfigPath: findConfigFile("main", storybookConfigDir),
1416
+ previewConfigPath: findConfigFile("preview", storybookConfigDir),
1417
+ managerConfigPath: findConfigFile("manager", storybookConfigDir)
1418
+ };
1419
+ }, getStorybookInfo = async (configDir = defaultConfigDir(), cwd, { skipCache } = {}) => {
1420
+ let configInfo = getConfigInfo(configDir), mainConfig = await loadMainConfig({
1421
+ configDir: configInfo.configDir,
1422
+ cwd,
1423
+ // When the main config may have been rewritten earlier in the same process (e.g. by
1424
+ // `forkbook add`), callers must skip the module cache to read the
1425
+ // current on-disk config instead of a stale, previously-evaluated version.
1426
+ skipCache
1427
+ });
1428
+ invariant(mainConfig, `Unable to find or evaluate ${configInfo.mainConfigPath}`);
1429
+ let frameworkValue = mainConfig.framework, frameworkField = typeof frameworkValue == "string" ? frameworkValue : frameworkValue?.name, addons = getAddonNames(mainConfig), versionSpecifier = getStorybookVersionSpecifier(configDir);
1430
+ if (!frameworkField)
1431
+ return basename(configInfo.configDir) === RN_FORKBOOK_DIR ? {
1432
+ ...configInfo,
1433
+ versionSpecifier,
1434
+ addons,
1435
+ mainConfig,
1436
+ frameworkPackage: "@storybook/react-native",
1437
+ rendererPackage: "@storybook/react-native",
1438
+ renderer: SupportedRenderer2.REACT_NATIVE,
1439
+ mainConfigPath: configInfo.mainConfigPath ?? void 0,
1440
+ previewConfigPath: configInfo.previewConfigPath ?? void 0,
1441
+ managerConfigPath: configInfo.managerConfigPath ?? void 0
1442
+ } : {
1443
+ ...configInfo,
1444
+ versionSpecifier,
1445
+ addons,
1446
+ mainConfig,
1447
+ mainConfigPath: configInfo.mainConfigPath ?? void 0,
1448
+ previewConfigPath: configInfo.previewConfigPath ?? void 0,
1449
+ managerConfigPath: configInfo.managerConfigPath ?? void 0
1450
+ };
1451
+ let frameworkPackage = extractFrameworkPackageName(frameworkField), framework = frameworkPackages[frameworkPackage], renderer = await extractRenderer(frameworkPackage), builder = frameworkToBuilder[framework], rendererPackage = Object.entries(rendererPackages).find(
1452
+ ([, value]) => value === renderer
1453
+ )?.[0], builderPackage = Object.entries(builderPackages).find(
1454
+ ([, value]) => value === builder
1455
+ )?.[0];
1456
+ return {
1457
+ ...configInfo,
1458
+ addons,
1459
+ mainConfig,
1460
+ framework,
1461
+ versionSpecifier,
1462
+ renderer: renderer ?? void 0,
1463
+ builder: builder ?? void 0,
1464
+ frameworkPackage,
1465
+ rendererPackage,
1466
+ builderPackage,
1467
+ mainConfigPath: configInfo.mainConfigPath ?? void 0,
1468
+ previewConfigPath: configInfo.previewConfigPath ?? void 0,
1469
+ managerConfigPath: configInfo.managerConfigPath ?? void 0
1470
+ };
1471
+ };
1472
+
1473
+ // src/common/utils/get-framework-name.ts
1474
+ async function getFrameworkName(options) {
1475
+ let framework = await options.presets.apply("framework", "", options);
1476
+ if (!framework)
1477
+ throw new Error(dedent4`
1478
+ You must specify a framework in '.forkbook/main.js' config.
1479
+
1480
+ https://forkbook.ljk.dev/docs/migration#framework-field-mandatory
1481
+ `);
1482
+ return typeof framework == "object" ? framework.name : framework;
1483
+ }
1484
+ var extractFrameworkPackageName = (framework) => {
1485
+ let normalizedPath = normalizePath2(framework);
1486
+ return Object.keys(frameworkPackages).find((pkg) => normalizedPath.endsWith(pkg)) ?? framework;
1487
+ };
1488
+
646
1489
  // src/common/utils/get-storybook-refs.ts
647
- import { readFile as readFile4 } from "node:fs/promises";
648
- import { dirname as dirname3 } from "node:path";
1490
+ import { readFile as readFile5 } from "node:fs/promises";
1491
+ import { dirname as dirname5 } from "node:path";
649
1492
 
650
1493
  // src/common/utils/read-dependency-manifest.ts
651
- import { readFile as readFile3 } from "node:fs/promises";
652
- import { dirname as dirname2, join as join6 } from "node:path";
653
- import { logger as logger4 } from "@aussieljk/forkbook/internal/node-logger";
1494
+ import { readFile as readFile4 } from "node:fs/promises";
1495
+ import { dirname as dirname4, join as join9 } from "node:path";
1496
+ import { logger as logger7 } from "@aussieljk/forkbook/internal/node-logger";
654
1497
  var readDependencyManifest = async (directory, dependency) => {
655
- let subpath = from(directory, join6(dependency, "package.json"), !0);
1498
+ let subpath = from(directory, join9(dependency, "package.json"), !0);
656
1499
  if (subpath)
657
1500
  try {
658
- let manifest = JSON.parse(await readFile3(subpath, { encoding: "utf8" }));
1501
+ let manifest = JSON.parse(await readFile4(subpath, { encoding: "utf8" }));
659
1502
  if (manifest?.name)
660
1503
  return manifest;
661
1504
  } catch {
662
1505
  }
663
1506
  let entry = from(directory, dependency, !0);
664
1507
  if (!entry) {
665
- logger4.debug(`readDependencyManifest: could not resolve "${dependency}"`);
1508
+ logger7.debug(`readDependencyManifest: could not resolve "${dependency}"`);
666
1509
  return;
667
1510
  }
668
- let dir = dirname2(entry);
1511
+ let dir = dirname4(entry);
669
1512
  for (; ; ) {
670
1513
  try {
671
- let manifest = JSON.parse(await readFile3(join6(dir, "package.json"), { encoding: "utf8" }));
1514
+ let manifest = JSON.parse(await readFile4(join9(dir, "package.json"), { encoding: "utf8" }));
672
1515
  if (manifest?.name)
673
1516
  return manifest;
674
1517
  } catch {
675
1518
  }
676
- let parent = dirname2(dir);
1519
+ let parent = dirname4(dir);
677
1520
  if (parent === dir)
678
1521
  return;
679
1522
  dir = parent;
@@ -685,24 +1528,23 @@ var getAutoRefs = async (options) => {
685
1528
  let location = up3({ cwd: options.configDir, last: getProjectRoot() });
686
1529
  if (!location)
687
1530
  return {};
688
- let directory = dirname3(location), { dependencies = [], devDependencies = [] } = JSON.parse(await readFile4(location, { encoding: "utf8" })) || {}, deps = Object.keys({ ...dependencies, ...devDependencies });
689
- return (await Promise.all(
1531
+ let directory = dirname5(location), { dependencies = [], devDependencies = [] } = JSON.parse(await readFile5(location, { encoding: "utf8" })) || {}, deps = Object.keys({ ...dependencies, ...devDependencies }), list = await Promise.all(
690
1532
  deps.map(async (d) => {
691
- let manifest = await readDependencyManifest(directory, d);
692
- if (manifest?.storybook?.url)
693
- return { id: manifest.name, ...manifest.storybook, version: manifest.version };
1533
+ let manifest = await readDependencyManifest(directory, d), ref = manifest?.storybook;
1534
+ if (manifest?.name && ref?.url)
1535
+ return { id: manifest.name, url: ref.url, title: ref.title, version: manifest.version };
694
1536
  })
695
- )).filter(Boolean).reduce(
696
- (acc, cur) => ({
697
- ...acc,
698
- [cur.id]: {
699
- id: cur.id.toLowerCase(),
700
- url: stripTrailingSlash(cur.url),
701
- title: cur.title,
702
- version: cur.version
1537
+ );
1538
+ return Object.fromEntries(
1539
+ list.filter((ref) => ref !== void 0).map((ref) => [
1540
+ ref.id,
1541
+ {
1542
+ id: ref.id.toLowerCase(),
1543
+ url: stripTrailingSlash(ref.url),
1544
+ title: ref.title,
1545
+ version: ref.version
703
1546
  }
704
- }),
705
- {}
1547
+ ])
706
1548
  );
707
1549
  }, checkRef = async (url) => {
708
1550
  try {
@@ -745,16 +1587,16 @@ async function getRefs(options) {
745
1587
 
746
1588
  // src/common/utils/glob-to-regexp.ts
747
1589
  var pico = __toESM(require_picomatch(), 1);
748
- function globToRegexp(glob) {
749
- let regex = pico.makeRe(glob, {
1590
+ function globToRegexp(glob2) {
1591
+ let regex = pico.makeRe(glob2, {
750
1592
  fastpaths: !1,
751
1593
  noglobstar: !1,
752
1594
  bash: !1
753
1595
  });
754
1596
  if (!regex.source.startsWith("^"))
755
- throw new Error(`Invalid glob: >> ${glob} >> ${regex}`);
756
- return glob.startsWith("./") ? new RegExp(
757
- ["^\\.", glob.startsWith("./**") ? "" : "[\\\\/]", regex.source.substring(1)].join("")
1597
+ throw new Error(`Invalid glob: >> ${glob2} >> ${regex}`);
1598
+ return glob2.startsWith("./") ? new RegExp(
1599
+ ["^\\.", glob2.startsWith("./**") ? "" : "[\\\\/]", regex.source.substring(1)].join("")
758
1600
  ) : regex;
759
1601
  }
760
1602
 
@@ -765,14 +1607,14 @@ var interpolate = (template, bindings) => Object.entries(bindings).reduce((acc,
765
1607
  }, template);
766
1608
 
767
1609
  // src/common/utils/load-manager-or-addons-file.ts
768
- import { resolve as resolve2 } from "node:path";
769
- import { logger as logger5 } from "@aussieljk/forkbook/internal/node-logger";
770
- import { dedent as dedent2 } from "ts-dedent";
1610
+ import { resolve as resolve5 } from "node:path";
1611
+ import { logger as logger8 } from "@aussieljk/forkbook/internal/node-logger";
1612
+ import { dedent as dedent5 } from "ts-dedent";
771
1613
  function loadManagerOrAddonsFile({ configDir }) {
772
- let storybookCustomAddonsPath = getInterpretedFile(resolve2(configDir, "addons")), storybookCustomManagerPath = getInterpretedFile(resolve2(configDir, "manager"));
773
- if ((storybookCustomAddonsPath || storybookCustomManagerPath) && logger5.step("Loading custom manager config"), storybookCustomAddonsPath && storybookCustomManagerPath)
774
- throw new Error(dedent2`
775
- You have both a "addons.js" and a "manager.js", remove the "addons.js" file from your configDir (${resolve2(
1614
+ let storybookCustomAddonsPath = getInterpretedFile(resolve5(configDir, "addons")), storybookCustomManagerPath = getInterpretedFile(resolve5(configDir, "manager"));
1615
+ if ((storybookCustomAddonsPath || storybookCustomManagerPath) && logger8.step("Loading custom manager config"), storybookCustomAddonsPath && storybookCustomManagerPath)
1616
+ throw new Error(dedent5`
1617
+ You have both a "addons.js" and a "manager.js", remove the "addons.js" file from your configDir (${resolve5(
776
1618
  configDir,
777
1619
  "addons"
778
1620
  )})`);
@@ -780,13 +1622,13 @@ function loadManagerOrAddonsFile({ configDir }) {
780
1622
  }
781
1623
 
782
1624
  // src/common/utils/load-preview-or-config-file.ts
783
- import { resolve as resolve3 } from "node:path";
784
- import { dedent as dedent3 } from "ts-dedent";
1625
+ import { resolve as resolve6 } from "node:path";
1626
+ import { dedent as dedent6 } from "ts-dedent";
785
1627
  function loadPreviewOrConfigFile({ configDir }) {
786
- let storybookConfigPath = getInterpretedFile(resolve3(configDir, "config")), storybookPreviewPath = getInterpretedFile(resolve3(configDir, "preview"));
1628
+ let storybookConfigPath = getInterpretedFile(resolve6(configDir, "config")), storybookPreviewPath = getInterpretedFile(resolve6(configDir, "preview"));
787
1629
  if (storybookConfigPath && storybookPreviewPath)
788
- throw new Error(dedent3`
789
- You have both a "config.js" and a "preview.js", remove the "config.js" file from your configDir (${resolve3(
1630
+ throw new Error(dedent6`
1631
+ You have both a "config.js" and a "preview.js", remove the "config.js" file from your configDir (${resolve6(
790
1632
  configDir,
791
1633
  "config"
792
1634
  )})`);
@@ -794,19 +1636,19 @@ function loadPreviewOrConfigFile({ configDir }) {
794
1636
  }
795
1637
 
796
1638
  // src/common/utils/log-config.ts
797
- var import_picocolors = __toESM(require_picocolors(), 1);
1639
+ var import_picocolors2 = __toESM(require_picocolors(), 1);
798
1640
  function logConfig(caption, config) {
799
- console.log(import_picocolors.default.cyan(String(caption))), console.dir(config, { depth: null });
1641
+ console.log(import_picocolors2.default.cyan(String(caption))), console.dir(config, { depth: null });
800
1642
  }
801
1643
 
802
1644
  // src/common/utils/normalize-stories.ts
803
1645
  var pico2 = __toESM(require_picomatch(), 1);
804
1646
  import { lstatSync } from "node:fs";
805
- import { basename, dirname as dirname4, relative, resolve as resolve4 } from "node:path";
1647
+ import { basename as basename2, dirname as dirname6, relative as relative2, resolve as resolve7 } from "node:path";
806
1648
  import { InvalidStoriesEntryError } from "@aussieljk/forkbook/internal/server-errors";
807
1649
  var DEFAULT_TITLE_PREFIX = "", DEFAULT_FILES_PATTERN = "**/*.@(mdx|stories.@(js|jsx|mjs|ts|tsx))", isDirectory = (configDir, entry) => {
808
1650
  try {
809
- return lstatSync(resolve4(configDir, entry)).isDirectory();
1651
+ return lstatSync(resolve7(configDir, entry)).isDirectory();
810
1652
  } catch {
811
1653
  return !1;
812
1654
  }
@@ -815,7 +1657,7 @@ var DEFAULT_TITLE_PREFIX = "", DEFAULT_FILES_PATTERN = "**/*.@(mdx|stories.@(js|
815
1657
  workingDir,
816
1658
  directory
817
1659
  }) => {
818
- let directoryFromConfig = resolve4(configDir, directory), directoryFromWorking = relative(workingDir, directoryFromConfig);
1660
+ let directoryFromConfig = resolve7(configDir, directory), directoryFromWorking = relative2(workingDir, directoryFromConfig);
819
1661
  return normalizeStoryPath(directoryFromWorking);
820
1662
  }, normalizeStoriesEntry = (entry, { configDir, workingDir, defaultFilesPattern = DEFAULT_FILES_PATTERN }) => {
821
1663
  let specifierWithoutMatcher;
@@ -834,8 +1676,8 @@ var DEFAULT_TITLE_PREFIX = "", DEFAULT_FILES_PATTERN = "**/*.@(mdx|stories.@(js|
834
1676
  files: defaultFilesPattern
835
1677
  } : specifierWithoutMatcher = {
836
1678
  titlePrefix: DEFAULT_TITLE_PREFIX,
837
- directory: dirname4(entry),
838
- files: basename(entry)
1679
+ directory: dirname6(entry),
1680
+ files: basename2(entry)
839
1681
  };
840
1682
  } else
841
1683
  specifierWithoutMatcher = {
@@ -862,9 +1704,9 @@ var DEFAULT_TITLE_PREFIX = "", DEFAULT_FILES_PATTERN = "**/*.@(mdx|stories.@(js|
862
1704
  };
863
1705
 
864
1706
  // src/common/utils/readTemplate.ts
865
- import { readFile as readFile5 } from "node:fs/promises";
1707
+ import { readFile as readFile6 } from "node:fs/promises";
866
1708
  async function readTemplate(filename) {
867
- return readFile5(filename, {
1709
+ return readFile6(filename, {
868
1710
  encoding: "utf8"
869
1711
  });
870
1712
  }
@@ -1013,27 +1855,27 @@ function getComponentExpressionName(node) {
1013
1855
 
1014
1856
  // src/common/utils/remove.ts
1015
1857
  import { readConfig, writeConfig } from "@aussieljk/forkbook/internal/csf-tools";
1016
- import { logger as logger6 } from "@aussieljk/forkbook/internal/node-logger";
1017
- import { dedent as dedent4 } from "ts-dedent";
1858
+ import { logger as logger9 } from "@aussieljk/forkbook/internal/node-logger";
1859
+ import { dedent as dedent7 } from "ts-dedent";
1018
1860
  async function removeAddon(addon, options) {
1019
1861
  let { packageManager, skipInstall } = options, { mainConfigPath, configDir } = getConfigInfo(options.configDir);
1020
1862
  if (typeof configDir > "u")
1021
- throw new Error(dedent4`
1863
+ throw new Error(dedent7`
1022
1864
  Unable to find storybook config directory
1023
1865
  `);
1024
1866
  if (!mainConfigPath) {
1025
- logger6.error("Unable to find storybook main.js config");
1867
+ logger9.error("Unable to find the Forkbook main config");
1026
1868
  return;
1027
1869
  }
1028
1870
  let main = await readConfig(mainConfigPath);
1029
- logger6.debug(`Uninstalling ${addon}`), await packageManager.removeDependencies([addon]), skipInstall || await packageManager.installDependencies();
1871
+ logger9.debug(`Uninstalling ${addon}`), await packageManager.removeDependencies([addon]), skipInstall || await packageManager.installDependencies();
1030
1872
  try {
1031
1873
  let entries = (main.getNamesFromPath(["addons"]) ?? []).filter(
1032
1874
  (name) => normalizeAddonName(name) === addon
1033
1875
  );
1034
- entries.length > 0 && (logger6.debug(`Removing '${addon}' from main.js addons field.`), entries.forEach((entry) => main.removeEntryFromArray(["addons"], entry)), await writeConfig(main));
1876
+ entries.length > 0 && (logger9.debug(`Removing '${addon}' from main.js addons field.`), entries.forEach((entry) => main.removeEntryFromArray(["addons"], entry)), await writeConfig(main));
1035
1877
  } catch (err) {
1036
- logger6.warn(`Failed to remove '${addon}' from main.js addons field. ${String(err)}`);
1878
+ logger9.warn(`Failed to remove '${addon}' from main.js addons field. ${String(err)}`);
1037
1879
  }
1038
1880
  }
1039
1881
 
@@ -1044,28 +1886,29 @@ function isPreservingSymlinks() {
1044
1886
  }
1045
1887
 
1046
1888
  // src/common/utils/template.ts
1047
- import { existsSync, readFileSync as readFileSync4 } from "node:fs";
1048
- import { join as join7, resolve as resolve5 } from "pathe";
1889
+ import { existsSync as existsSync3, readFileSync as readFileSync6 } from "node:fs";
1890
+ import { join as join10, resolve as resolve8 } from "pathe";
1049
1891
  var interpolate2 = (string, data = {}) => Object.entries(data).reduce((acc, [k, v]) => acc.replace(new RegExp(`%${k}%`, "g"), v), string);
1050
1892
  function getPreviewBodyTemplate(configDirPath, interpolations) {
1051
- let base = readFileSync4(
1052
- join7(resolvePackageDir("@aussieljk/forkbook"), "assets/server/base-preview-body.html"),
1893
+ let base = readFileSync6(
1894
+ join10(resolvePackageDir("@aussieljk/forkbook"), "assets/server/base-preview-body.html"),
1053
1895
  "utf8"
1054
- ), bodyHtmlPath = resolve5(configDirPath, "preview-body.html"), result = base;
1055
- return existsSync(bodyHtmlPath) && (result = readFileSync4(bodyHtmlPath, "utf8") + result), interpolate2(result, interpolations);
1896
+ ), bodyHtmlPath = resolve8(configDirPath, "preview-body.html"), result = base;
1897
+ return existsSync3(bodyHtmlPath) && (result = readFileSync6(bodyHtmlPath, "utf8") + result), interpolate2(result, interpolations);
1056
1898
  }
1057
1899
  function getPreviewHeadTemplate(configDirPath, interpolations) {
1058
- let base = readFileSync4(
1059
- join7(resolvePackageDir("@aussieljk/forkbook"), "assets/server/base-preview-head.html"),
1900
+ let base = readFileSync6(
1901
+ join10(resolvePackageDir("@aussieljk/forkbook"), "assets/server/base-preview-head.html"),
1060
1902
  "utf8"
1061
- ), headHtmlPath = resolve5(configDirPath, "preview-head.html"), result = base;
1062
- return existsSync(headHtmlPath) && (result += readFileSync4(headHtmlPath, "utf8")), interpolate2(result, interpolations);
1903
+ ), headHtmlPath = resolve8(configDirPath, "preview-head.html"), result = base;
1904
+ return existsSync3(headHtmlPath) && (result += readFileSync6(headHtmlPath, "utf8")), interpolate2(result, interpolations);
1063
1905
  }
1064
1906
 
1065
1907
  // src/common/utils/tsconfig.ts
1066
- import { existsSync as existsSync2, readFileSync as readFileSync5, statSync } from "node:fs";
1067
- import { basename as basename2, dirname as dirname5, extname, relative as relative2, resolve as resolve6 } from "node:path";
1908
+ import { existsSync as existsSync4, readFileSync as readFileSync7, statSync } from "node:fs";
1909
+ import { basename as basename3, dirname as dirname7, extname as extname2, relative as relative3, resolve as resolve9 } from "node:path";
1068
1910
  var import_picomatch = __toESM(require_picomatch(), 1);
1911
+ import { parse as parseJsonc } from "jsonc-parser";
1069
1912
  var TSCONFIG_CANDIDATES = ["tsconfig.json", "tsconfig.base.json", "tsconfig.app.json"], DEFAULT_EXCLUDE_PATTERNS = ["node_modules", "bower_components", "jspm_packages"], findTsconfigPath = (cwd) => {
1070
1913
  let projectRoot = getProjectRoot();
1071
1914
  for (let candidate of TSCONFIG_CANDIDATES) {
@@ -1077,16 +1920,16 @@ var TSCONFIG_CANDIDATES = ["tsconfig.json", "tsconfig.base.json", "tsconfig.app.
1077
1920
  let rootTsconfigPath = findTsconfigPath(cwd);
1078
1921
  if (!rootTsconfigPath)
1079
1922
  return;
1080
- let absoluteFilePath = resolve6(filePath), matchingConfigs = collectTsconfigEntries(rootTsconfigPath, /* @__PURE__ */ new Set()).filter(
1923
+ let absoluteFilePath = resolve9(filePath), matchingConfigs = collectTsconfigEntries(rootTsconfigPath, /* @__PURE__ */ new Set()).filter(
1081
1924
  (entry) => tsconfigIncludesFile(entry, absoluteFilePath)
1082
1925
  );
1083
1926
  return matchingConfigs.sort((left, right) => compareTsconfigEntries(absoluteFilePath, left, right)), matchingConfigs[0]?.path ?? rootTsconfigPath;
1084
- }, findTsconfigPathForPath = (path) => isDirectoryPath(path) ? findTsconfigPath(path) : findTsconfigPathForFile(dirname5(path), path), getTsconfigPathsBaseDir = (configPath) => {
1085
- let normalizedConfigPath = resolve6(configPath), resolved = resolvePathsBase(normalizedConfigPath, /* @__PURE__ */ new Set());
1086
- return resolved.absoluteBaseUrl ?? resolved.pathsBasePath ?? dirname5(normalizedConfigPath);
1927
+ }, findTsconfigPathForPath = (path) => isDirectoryPath(path) ? findTsconfigPath(path) : findTsconfigPathForFile(dirname7(path), path), getTsconfigPathsBaseDir = (configPath) => {
1928
+ let normalizedConfigPath = resolve9(configPath), resolved = resolvePathsBase(normalizedConfigPath, /* @__PURE__ */ new Set());
1929
+ return resolved.absoluteBaseUrl ?? resolved.pathsBasePath ?? dirname7(normalizedConfigPath);
1087
1930
  };
1088
1931
  function resolvePathsBase(configPath, seen) {
1089
- let normalizedConfigPath = resolve6(configPath);
1932
+ let normalizedConfigPath = resolve9(configPath);
1090
1933
  if (seen.has(normalizedConfigPath))
1091
1934
  return {};
1092
1935
  seen.add(normalizedConfigPath);
@@ -1103,20 +1946,20 @@ function resolvePathsBase(configPath, seen) {
1103
1946
  }
1104
1947
  let ownBaseUrl = config.compilerOptions?.baseUrl, ownPaths = config.compilerOptions?.paths;
1105
1948
  return {
1106
- absoluteBaseUrl: typeof ownBaseUrl == "string" && ownBaseUrl.length > 0 ? resolve6(dirname5(normalizedConfigPath), ownBaseUrl) : inherited.absoluteBaseUrl,
1107
- pathsBasePath: ownPaths != null && typeof ownPaths == "object" ? dirname5(normalizedConfigPath) : inherited.pathsBasePath
1949
+ absoluteBaseUrl: typeof ownBaseUrl == "string" && ownBaseUrl.length > 0 ? resolve9(dirname7(normalizedConfigPath), ownBaseUrl) : inherited.absoluteBaseUrl,
1950
+ pathsBasePath: ownPaths != null && typeof ownPaths == "object" ? dirname7(normalizedConfigPath) : inherited.pathsBasePath
1108
1951
  };
1109
1952
  }
1110
1953
  function isDirectoryPath(path) {
1111
1954
  try {
1112
- if (existsSync2(path))
1955
+ if (existsSync4(path))
1113
1956
  return statSync(path).isDirectory();
1114
1957
  } catch {
1115
1958
  }
1116
- return extname(path) === "";
1959
+ return extname2(path) === "";
1117
1960
  }
1118
1961
  function collectTsconfigEntries(configPath, seen) {
1119
- let normalizedConfigPath = resolve6(configPath);
1962
+ let normalizedConfigPath = resolve9(configPath);
1120
1963
  if (seen.has(normalizedConfigPath))
1121
1964
  return [];
1122
1965
  seen.add(normalizedConfigPath);
@@ -1129,20 +1972,20 @@ function collectTsconfigEntries(configPath, seen) {
1129
1972
  ] : [];
1130
1973
  }
1131
1974
  function getReferencedTsconfigPaths(configPath, config) {
1132
- return (Array.isArray(config.references) ? config.references : []).map((reference) => reference.path).filter((referencePath) => typeof referencePath == "string").map((referencePath) => resolve6(dirname5(configPath), referencePath)).flatMap((referencePath) => resolveReferenceConfigPaths(referencePath));
1975
+ return (Array.isArray(config.references) ? config.references : []).map((reference) => reference.path).filter((referencePath) => typeof referencePath == "string").map((referencePath) => resolve9(dirname7(configPath), referencePath)).flatMap((referencePath) => resolveReferenceConfigPaths(referencePath));
1133
1976
  }
1134
1977
  function resolveReferenceConfigPaths(referencePath) {
1135
- return referencePath.endsWith(".json") ? [referencePath] : TSCONFIG_CANDIDATES.map((candidate) => resolve6(referencePath, candidate));
1978
+ return referencePath.endsWith(".json") ? [referencePath] : TSCONFIG_CANDIDATES.map((candidate) => resolve9(referencePath, candidate));
1136
1979
  }
1137
1980
  function tsconfigIncludesFile(entry, filePath) {
1138
- let configDir = dirname5(entry.path), relativeFilePath = normalizePath2(relative2(configDir, filePath));
1981
+ let configDir = dirname7(entry.path), relativeFilePath = normalizePath3(relative3(configDir, filePath));
1139
1982
  if (relativeFilePath.startsWith("../") || relativeFilePath === ".." || isReferencesShell(entry.config))
1140
1983
  return !1;
1141
1984
  let ownership = resolveOwnershipSpec(entry.path, entry.config, /* @__PURE__ */ new Set());
1142
1985
  if (ownership.files && ownership.files.length > 0) {
1143
- let normalizedFilePath = normalizePath2(filePath);
1986
+ let normalizedFilePath = normalizePath3(filePath);
1144
1987
  return ownership.files.some(
1145
- (candidatePath) => normalizePath2(resolve6(configDir, candidatePath)) === normalizedFilePath
1988
+ (candidatePath) => normalizePath3(resolve9(configDir, candidatePath)) === normalizedFilePath
1146
1989
  );
1147
1990
  }
1148
1991
  let includePatterns = getIncludePatterns(ownership, entry.config);
@@ -1155,7 +1998,7 @@ function tsconfigIncludesFile(entry, filePath) {
1155
1998
  return matchesPatterns(relativeFilePath, excludePatterns) ? !1 : matchesPatterns(relativeFilePath, includePatterns);
1156
1999
  }
1157
2000
  function resolveOwnershipSpec(configPath, config, seen) {
1158
- let normalizedConfigPath = resolve6(configPath);
2001
+ let normalizedConfigPath = resolve9(configPath);
1159
2002
  if (seen.has(normalizedConfigPath))
1160
2003
  return {};
1161
2004
  seen.add(normalizedConfigPath);
@@ -1167,7 +2010,7 @@ function resolveOwnershipSpec(configPath, config, seen) {
1167
2010
  let baseOwnership = resolveOwnershipSpec(extendsPath, baseConfig, seen);
1168
2011
  ownership = mergeOwnershipSpec(
1169
2012
  ownership,
1170
- rebaseOwnershipSpec(baseOwnership, dirname5(extendsPath), dirname5(normalizedConfigPath))
2013
+ rebaseOwnershipSpec(baseOwnership, dirname7(extendsPath), dirname7(normalizedConfigPath))
1171
2014
  );
1172
2015
  }
1173
2016
  return mergeOwnershipSpec(ownership, ownOwnershipSpec(config));
@@ -1176,19 +2019,19 @@ function getExtendsPaths(configPath, config) {
1176
2019
  return (typeof config.extends == "string" ? [config.extends] : Array.isArray(config.extends) ? config.extends.filter((value) => typeof value == "string") : []).map((extendsPath) => resolveExtendsPath(configPath, extendsPath));
1177
2020
  }
1178
2021
  function resolveExtendsPath(configPath, extendsPath) {
1179
- let resolved = resolve6(dirname5(configPath), extendsPath);
1180
- if (existsSync2(resolved))
2022
+ let resolved = resolve9(dirname7(configPath), extendsPath);
2023
+ if (existsSync4(resolved))
1181
2024
  return resolved;
1182
2025
  if (!resolved.endsWith(".json")) {
1183
2026
  let withJson = `${resolved}.json`;
1184
- if (existsSync2(withJson))
2027
+ if (existsSync4(withJson))
1185
2028
  return withJson;
1186
2029
  }
1187
2030
  return resolved;
1188
2031
  }
1189
2032
  function ownOwnershipSpec(config) {
1190
2033
  let ownership = {};
1191
- return config.files !== void 0 && (ownership.files = asStringArray(config.files).map(normalizePath2)), config.include !== void 0 && (ownership.include = asStringArray(config.include).map(normalizePath2)), config.exclude !== void 0 && (ownership.exclude = asStringArray(config.exclude).map(normalizePath2)), ownership;
2034
+ return config.files !== void 0 && (ownership.files = asStringArray(config.files).map(normalizePath3)), config.include !== void 0 && (ownership.include = asStringArray(config.include).map(normalizePath3)), config.exclude !== void 0 && (ownership.exclude = asStringArray(config.exclude).map(normalizePath3)), ownership;
1192
2035
  }
1193
2036
  function mergeOwnershipSpec(base, overlay) {
1194
2037
  return {
@@ -1205,7 +2048,7 @@ function rebaseOwnershipSpec(ownership, fromDir, toDir) {
1205
2048
  };
1206
2049
  }
1207
2050
  function rebasePattern(pattern, fromDir, toDir) {
1208
- return normalizePath2(relative2(toDir, resolve6(fromDir, pattern)));
2051
+ return normalizePath3(relative3(toDir, resolve9(fromDir, pattern)));
1209
2052
  }
1210
2053
  function isReferencesShell(config) {
1211
2054
  if (!Array.isArray(config.references))
@@ -1214,19 +2057,19 @@ function isReferencesShell(config) {
1214
2057
  return !hasOwnFiles && !hasOwnInclude;
1215
2058
  }
1216
2059
  function getIncludePatterns(ownership, leafConfig) {
1217
- return ownership.include && ownership.include.length > 0 ? ownership.include.map(normalizeTsconfigPattern) : ownership.files && ownership.files.length > 0 ? ownership.files.map(normalizePath2) : Array.isArray(leafConfig.files) && leafConfig.files.length === 0 && !ownership.include ? [] : ["**/*"];
2060
+ return ownership.include && ownership.include.length > 0 ? ownership.include.map(normalizeTsconfigPattern) : ownership.files && ownership.files.length > 0 ? ownership.files.map(normalizePath3) : Array.isArray(leafConfig.files) && leafConfig.files.length === 0 && !ownership.include ? [] : ["**/*"];
1218
2061
  }
1219
2062
  function compareTsconfigEntries(filePath, left, right) {
1220
- let leftDir = dirname5(left.path), rightDir = dirname5(right.path), leftDepth = normalizePath2(relative2(leftDir, filePath)).split("/").length, rightDepth = normalizePath2(relative2(rightDir, filePath)).split("/").length;
2063
+ let leftDir = dirname7(left.path), rightDir = dirname7(right.path), leftDepth = normalizePath3(relative3(leftDir, filePath)).split("/").length, rightDepth = normalizePath3(relative3(rightDir, filePath)).split("/").length;
1221
2064
  if (leftDepth !== rightDepth)
1222
2065
  return leftDepth - rightDepth;
1223
- let leftIsPrimaryTsconfig = basename2(left.path) === "tsconfig.json" ? 1 : 0;
1224
- return (basename2(right.path) === "tsconfig.json" ? 1 : 0) - leftIsPrimaryTsconfig;
2066
+ let leftIsPrimaryTsconfig = basename3(left.path) === "tsconfig.json" ? 1 : 0;
2067
+ return (basename3(right.path) === "tsconfig.json" ? 1 : 0) - leftIsPrimaryTsconfig;
1225
2068
  }
1226
2069
  function readTsconfigConfig(configPath) {
1227
2070
  try {
1228
- let content = readFileSync5(configPath, "utf-8");
1229
- return JSON.parse(stripJsonComments(content, { trailingCommas: !0 }));
2071
+ let content = readFileSync7(configPath, "utf-8"), errors = [], config = parseJsonc(content, errors, { allowTrailingComma: !0 });
2072
+ return errors.length ? void 0 : config;
1230
2073
  } catch {
1231
2074
  return;
1232
2075
  }
@@ -1235,10 +2078,10 @@ function matchesPatterns(filePath, patterns) {
1235
2078
  return patterns.some((pattern) => (0, import_picomatch.default)(pattern, { dot: !0 })(filePath));
1236
2079
  }
1237
2080
  function normalizeTsconfigPattern(pattern) {
1238
- let normalizedPattern = normalizePath2(pattern);
2081
+ let normalizedPattern = normalizePath3(pattern);
1239
2082
  return normalizedPattern.endsWith("/") ? `${normalizedPattern}**/*` : !import_picomatch.default.scan(normalizedPattern).isGlob && !/\.[^/]+$/.test(normalizedPattern) ? `${normalizedPattern}/**/*` : normalizedPattern;
1240
2083
  }
1241
- function normalizePath2(value) {
2084
+ function normalizePath3(value) {
1242
2085
  return value.replaceAll("\\", "/");
1243
2086
  }
1244
2087
  function asStringArray(value) {
@@ -1270,15 +2113,15 @@ function validateFrameworkName(frameworkName) {
1270
2113
  }
1271
2114
 
1272
2115
  // src/common/utils/babel.ts
1273
- import { readFileSync as readFileSync6 } from "node:fs";
2116
+ import { readFileSync as readFileSync8 } from "node:fs";
1274
2117
  import { createRequire } from "node:module";
1275
- import { logger as logger7 } from "@aussieljk/forkbook/internal/node-logger";
2118
+ import { logger as logger10 } from "@aussieljk/forkbook/internal/node-logger";
1276
2119
  var require2 = createRequire(import.meta.url), getBabelPresetEnvMajor = () => {
1277
2120
  try {
1278
- let pkgPath = require2.resolve("@babel/preset-env/package.json"), { version } = JSON.parse(readFileSync6(pkgPath, "utf8")), parsed = Number.parseInt(version, 10);
2121
+ let pkgPath = require2.resolve("@babel/preset-env/package.json"), { version } = JSON.parse(readFileSync8(pkgPath, "utf8")), parsed = Number.parseInt(version, 10);
1279
2122
  return Number.isNaN(parsed) ? void 0 : parsed;
1280
2123
  } catch {
1281
- logger7.debug(
2124
+ logger10.debug(
1282
2125
  "Could not determine @babel/preset-env version in use. In case of runtime errors with @babel/preset-env, you may need to set the babelRemoveBugfixes feature flag in your `main.ts` file."
1283
2126
  );
1284
2127
  return;
@@ -1286,9 +2129,9 @@ var require2 = createRequire(import.meta.url), getBabelPresetEnvMajor = () => {
1286
2129
  };
1287
2130
 
1288
2131
  // src/common/utils/formatter.ts
1289
- import { readFileSync as readFileSync7 } from "node:fs";
1290
- import { dirname as dirname6 } from "node:path";
1291
- import { parse as parse2 } from "jsonc-parser";
2132
+ import { readFileSync as readFileSync9 } from "node:fs";
2133
+ import { dirname as dirname8 } from "node:path";
2134
+ import { parse as parse3 } from "jsonc-parser";
1292
2135
  import { format } from "oxfmt";
1293
2136
  var CONFIG_FILES = [".oxfmtrc.json", ".oxfmtrc.jsonc"];
1294
2137
  async function formatCode(filePath, content, options = {}) {
@@ -1300,20 +2143,20 @@ async function formatCode(filePath, content, options = {}) {
1300
2143
  }
1301
2144
  }
1302
2145
  async function formatFileContent(filePath, content) {
1303
- let configPath = any(CONFIG_FILES, { cwd: dirname6(filePath) });
2146
+ let configPath = any(CONFIG_FILES, { cwd: dirname8(filePath) });
1304
2147
  if (!configPath)
1305
2148
  return content;
1306
- let { $schema, ignorePatterns, overrides, ...options } = parse2(
1307
- readFileSync7(configPath, "utf8")
2149
+ let { $schema, ignorePatterns, overrides, ...options } = parse3(
2150
+ readFileSync9(configPath, "utf8")
1308
2151
  );
1309
2152
  return formatCode(filePath, content, options);
1310
2153
  }
1311
2154
 
1312
2155
  // src/common/utils/get-story-id.ts
1313
- import { relative as relative3 } from "node:path";
2156
+ import { relative as relative4 } from "node:path";
1314
2157
  import { normalizeStories as normalizeStories2, normalizeStoryPath as normalizeStoryPath2 } from "@aussieljk/forkbook/internal/common";
1315
2158
  import { sanitize as sanitize2, storyNameFromExport, toId } from "@aussieljk/forkbook/internal/csf/csf-utils";
1316
- import { dedent as dedent5 } from "ts-dedent";
2159
+ import { dedent as dedent8 } from "ts-dedent";
1317
2160
 
1318
2161
  // src/shared/story-index/autoTitle.ts
1319
2162
  var sanitize = (parts) => {
@@ -1341,7 +2184,7 @@ var userOrAutoTitleFromSpecifier = (fileName, entry, userTitle) => {
1341
2184
 
1342
2185
  // src/common/utils/posix.ts
1343
2186
  import { posix as posixPath, sep as sep2 } from "node:path";
1344
- var posix2 = (localPath, seperator = sep2) => localPath.split(seperator).filter(Boolean).join(posixPath.sep);
2187
+ var posix3 = (localPath, seperator = sep2) => localPath.split(seperator).filter(Boolean).join(posixPath.sep);
1345
2188
 
1346
2189
  // src/common/utils/get-story-id.ts
1347
2190
  async function getStoryId(data, options) {
@@ -1351,7 +2194,7 @@ async function getStoryId(data, options) {
1351
2194
  configDir: options.configDir
1352
2195
  });
1353
2196
  if (autoTitle === void 0)
1354
- throw new Error(dedent5`
2197
+ throw new Error(dedent8`
1355
2198
  The new story file was successfully generated, but we are unable to index it. Please ensure that the new Story file is matched by the 'stories' glob pattern in your Forkbook configuration.
1356
2199
  `);
1357
2200
  let storyName = storyNameFromExport(data.exportedStoryName), storyId = toId(autoTitle, storyName), kind = sanitize2(autoTitle);
@@ -1367,7 +2210,7 @@ function getStoryTitle({
1367
2210
  let normalizedStories = normalizeStories2(stories, {
1368
2211
  configDir,
1369
2212
  workingDir
1370
- }), relativePath = relative3(workingDir, storyFilePath), importPath = posix2(normalizeStoryPath2(relativePath));
2213
+ }), relativePath = relative4(workingDir, storyFilePath), importPath = posix3(normalizeStoryPath2(relativePath));
1371
2214
  return normalizedStories.map((normalizeStory) => userOrAutoTitleFromSpecifier(importPath, normalizeStory, userTitle)).filter(Boolean)[0];
1372
2215
  }
1373
2216
 
@@ -1391,14 +2234,14 @@ function createLazyDocgenMiddleware({
1391
2234
  }
1392
2235
 
1393
2236
  // src/common/utils/sync-main-preview-addons.ts
1394
- var import_picocolors2 = __toESM(require_picocolors(), 1);
2237
+ var import_picocolors3 = __toESM(require_picocolors(), 1);
1395
2238
  import { types as t3 } from "@aussieljk/forkbook/internal/babel";
1396
2239
  import {
1397
2240
  isCsfFactoryPreview,
1398
2241
  readConfig as readConfig2,
1399
2242
  writeConfig as writeConfig2
1400
2243
  } from "@aussieljk/forkbook/internal/csf-tools";
1401
- import { logger as logger8 } from "@aussieljk/forkbook/internal/node-logger";
2244
+ import { logger as logger11 } from "@aussieljk/forkbook/internal/node-logger";
1402
2245
 
1403
2246
  // src/common/utils/get-addon-annotations.ts
1404
2247
  import { createRequire as createRequire2 } from "node:module";
@@ -1456,9 +2299,9 @@ async function syncPreviewAddonsWithMainConfig(mainConfig, previewConfig, config
1456
2299
  )) : (previewConfig.setImport({ namespace: annotations.importName }, annotations.importPath), previewConfig.appendNodeToArray(["addons"], t3.identifier(annotations.importName))));
1457
2300
  }
1458
2301
  }
1459
- return syncedAddons.length > 0 && logger8.log(
1460
- `Synchronizing addons from main config in ${import_picocolors2.default.cyan(previewConfig.fileName)}:
1461
- ${syncedAddons.map(import_picocolors2.default.magenta).join(", ")}`
2302
+ return syncedAddons.length > 0 && logger11.log(
2303
+ `Synchronizing addons from main config in ${import_picocolors3.default.cyan(previewConfig.fileName)}:
2304
+ ${syncedAddons.map(import_picocolors3.default.magenta).join(", ")}`
1462
2305
  ), previewConfig;
1463
2306
  }
1464
2307
 
@@ -1559,9 +2402,7 @@ function wrapValueWithGetAbsolutePathWrapper(config, node) {
1559
2402
  let wrapperNode = getReferenceToGetAbsolutePathWrapper(config, n.value);
1560
2403
  Object.keys(n).forEach((k) => {
1561
2404
  delete n[k];
1562
- }), Object.keys(wrapperNode).forEach((k) => {
1563
- n[k] = wrapperNode[k];
1564
- });
2405
+ }), Object.assign(n, wrapperNode);
1565
2406
  }
1566
2407
  t4.isObjectProperty(n) && t4.isStringLiteral(n.value) && (n.value = getReferenceToGetAbsolutePathWrapper(config, n.value.value)), t4.isArrayExpression(n) && n.elements.forEach((element) => {
1567
2408
  element && isGetAbsolutePathWrapperNecessary(element) && wrapValueWithGetAbsolutePathWrapper(config, element);
@@ -1614,13 +2455,13 @@ async function setupAddonInConfig({
1614
2455
  }
1615
2456
 
1616
2457
  // src/common/js-package-manager/JsPackageManagerFactory.ts
1617
- import { existsSync as existsSync5, readFileSync as readFileSync13 } from "node:fs";
1618
- import { basename as basename3, join as join14, parse as parse3, relative as relative4 } from "node:path";
2458
+ import { existsSync as existsSync7, readFileSync as readFileSync15 } from "node:fs";
2459
+ import { basename as basename4, join as join17, parse as parse4, relative as relative5 } from "node:path";
1619
2460
 
1620
2461
  // src/common/utils/command.ts
1621
- import { logger as logger9, prompt } from "@aussieljk/forkbook/internal/node-logger";
1622
- import { existsSync as existsSync3 } from "node:fs";
1623
- import { delimiter, join as join8 } from "node:path";
2462
+ import { logger as logger12, prompt as prompt2 } from "@aussieljk/forkbook/internal/node-logger";
2463
+ import { existsSync as existsSync5 } from "node:fs";
2464
+ import { delimiter, join as join11 } from "node:path";
1624
2465
 
1625
2466
  // src/common/utils/categorize-execa-error.ts
1626
2467
  var PACKAGE_MANAGER_COMMANDS = /* @__PURE__ */ new Set(["npm", "pnpm", "yarn", "bun"]), PACKAGE_INSTALL_ARGS = /* @__PURE__ */ new Set(["install", "add", "ci", "i"]);
@@ -1695,31 +2536,30 @@ function attachCategorizedExecaFailureHandler(execaProcess, context) {
1695
2536
  throw categorize(error);
1696
2537
  }).catch(typeof onRejected == "function" ? onRejected : void 0));
1697
2538
  }
1698
- function getExecaOptions({
2539
+ function getExecOptions({
1699
2540
  stdio,
1700
2541
  cwd,
1701
2542
  env,
1702
2543
  signal,
1703
- ...execaOptions
2544
+ timeout,
2545
+ shell
1704
2546
  }) {
1705
2547
  return {
1706
2548
  cwd,
1707
- stdio: stdio ?? prompt.getPreferredStdio(),
1708
- encoding: "utf8",
1709
- cleanup: !0,
2549
+ timeout,
2550
+ shell,
2551
+ stdio: stdio ?? prompt2.getPreferredStdio(),
1710
2552
  env: {
1711
2553
  ...COMMON_ENV_VARS,
1712
2554
  ...env
1713
2555
  },
1714
- ...signal && { cancelSignal: signal },
1715
- // Map signal to cancelSignal for execa v9
1716
- ...execaOptions
2556
+ signal
1717
2557
  };
1718
2558
  }
1719
2559
  function executeCommand(options) {
1720
2560
  let { command, args = [], ignoreError = !1 } = options;
1721
- logger9.debug(`Executing command: ${command} ${args.join(" ")}`);
1722
- let commandVariations = resolveCommand(command), execaProcess = tryCommandVariations(commandVariations, args, getExecaOptions(options));
2561
+ logger12.debug(`Executing command: ${command} ${args.join(" ")}`);
2562
+ let commandVariations = resolveCommand(command), execaProcess = tryCommandVariations(commandVariations, args, getExecOptions(options));
1723
2563
  return ignoreError ? execaProcess.catch(() => {
1724
2564
  }) : attachCategorizedExecaFailureHandler(execaProcess, { command, args }), execaProcess;
1725
2565
  }
@@ -1727,11 +2567,7 @@ function executeCommandSync(options) {
1727
2567
  let { command, args = [], ignoreError = !1 } = options;
1728
2568
  try {
1729
2569
  let commandVariations = resolveCommand(command);
1730
- return tryCommandVariationsSync(
1731
- commandVariations,
1732
- args,
1733
- getExecaOptions(options)
1734
- );
2570
+ return tryCommandVariationsSync(commandVariations, args, getExecOptions(options));
1735
2571
  } catch (err) {
1736
2572
  if (!ignoreError)
1737
2573
  throw categorizeExecaError(err, { command, args });
@@ -1743,38 +2579,37 @@ function executeNodeCommand({
1743
2579
  args,
1744
2580
  options
1745
2581
  }) {
1746
- return execaNode(scriptPath, args, {
1747
- ...options
1748
- });
2582
+ return execNode(scriptPath, args, options);
1749
2583
  }
1750
2584
  function isCommandNotFoundError(error) {
1751
- return error ? (error.stderr || "").includes("is not recognized as an internal or external command") : !1;
2585
+ return typeof error != "object" || error === null || !("stderr" in error) ? !1 : String(error.stderr ?? "").includes(
2586
+ "is not recognized as an internal or external command"
2587
+ );
1752
2588
  }
1753
2589
  function shouldRetry(error, isLastVariation) {
1754
2590
  return isCommandNotFoundError(error) && !isLastVariation;
1755
2591
  }
1756
2592
  function isExecutableInPath(command) {
1757
- return (process.env.PATH || "").split(delimiter).some((dir) => existsSync3(join8(dir, command)));
2593
+ return (process.env.PATH || "").split(delimiter).some((dir) => existsSync5(join11(dir, command)));
1758
2594
  }
1759
2595
  function tryCommandVariations(commandVariations, args, options) {
1760
2596
  if (commandVariations.length <= 1)
1761
- return execa(commandVariations[0], args, options);
2597
+ return exec(commandVariations[0], args, options);
1762
2598
  for (let cmd of commandVariations.slice(0, -1))
1763
2599
  if (isExecutableInPath(cmd))
1764
- return logger9.debug(`Resolved command variation: ${cmd}`), execa(cmd, args, options);
1765
- return execa(commandVariations[commandVariations.length - 1], args, options);
2600
+ return logger12.debug(`Resolved command variation: ${cmd}`), exec(cmd, args, options);
2601
+ return exec(commandVariations[commandVariations.length - 1], args, options);
1766
2602
  }
1767
2603
  function tryCommandVariationsSync(commandVariations, args, options) {
1768
2604
  let lastError;
1769
2605
  for (let i = 0; i < commandVariations.length; i++) {
1770
2606
  let cmd = commandVariations[i];
1771
2607
  try {
1772
- let commandResult = execaCommandSync([cmd, ...args].join(" "), options);
1773
- return typeof commandResult.stdout == "string" ? commandResult.stdout : "";
2608
+ return execSync(cmd, args, options).stdout ?? "";
1774
2609
  } catch (error) {
1775
2610
  if (lastError = error, !shouldRetry(error, i === commandVariations.length - 1))
1776
2611
  throw error;
1777
- logger9.debug(`Command "${cmd}" not found, trying next variation...`);
2612
+ logger12.debug(`Command "${cmd}" not found, trying next variation...`);
1778
2613
  }
1779
2614
  }
1780
2615
  throw lastError;
@@ -1793,15 +2628,15 @@ function resolveCommand(command) {
1793
2628
  }
1794
2629
 
1795
2630
  // src/common/js-package-manager/BUNProxy.ts
1796
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync2 } from "node:fs";
1797
- import { join as join9 } from "node:path";
1798
- import { logger as logger10, prompt as prompt2 } from "@aussieljk/forkbook/internal/node-logger";
2631
+ import { readFileSync as readFileSync10, writeFileSync as writeFileSync3 } from "node:fs";
2632
+ import { join as join12 } from "node:path";
2633
+ import { logger as logger13, prompt as prompt3 } from "@aussieljk/forkbook/internal/node-logger";
1799
2634
  import {
1800
2635
  FindPackageVersionsError,
1801
2636
  MinimumReleaseAgeHandledError
1802
2637
  } from "@aussieljk/forkbook/internal/server-errors";
1803
2638
  import sort from "semver/functions/sort.js";
1804
- import { dedent as dedent6 } from "ts-dedent";
2639
+ import { dedent as dedent9 } from "ts-dedent";
1805
2640
  var BUNProxy = class extends JsPackageManager {
1806
2641
  constructor() {
1807
2642
  super(...arguments);
@@ -1817,7 +2652,7 @@ var BUNProxy = class extends JsPackageManager {
1817
2652
  return `bun add ${dev ? "-D " : ""}${deps.join(" ")}`;
1818
2653
  }
1819
2654
  getRunStorybookCommand() {
1820
- return "bun run storybook";
2655
+ return "bun run forkbook";
1821
2656
  }
1822
2657
  getRunCommand(command) {
1823
2658
  return `bun run ${command}`;
@@ -1829,11 +2664,11 @@ var BUNProxy = class extends JsPackageManager {
1829
2664
  return `bunx ${args.join(" ")}`;
1830
2665
  }
1831
2666
  async getModulePackageJSON(packageName) {
1832
- let wantedPath = join9("node_modules", packageName, "package.json"), packageJsonPath = up2(wantedPath, {
2667
+ let wantedPath = join12("node_modules", packageName, "package.json"), packageJsonPath = up2(wantedPath, {
1833
2668
  cwd: this.primaryPackageJson.operationDir,
1834
2669
  last: getProjectRoot()
1835
2670
  });
1836
- return packageJsonPath ? JSON.parse(readFileSync8(packageJsonPath, "utf-8")) : null;
2671
+ return packageJsonPath ? JSON.parse(readFileSync10(packageJsonPath, "utf-8")) : null;
1837
2672
  }
1838
2673
  getInstallArgs() {
1839
2674
  return this.installArgs || (this.installArgs = []), this.installArgs;
@@ -1853,7 +2688,7 @@ var BUNProxy = class extends JsPackageManager {
1853
2688
  });
1854
2689
  }
1855
2690
  async findInstallations(pattern, { depth = 99 } = {}) {
1856
- let exec = async ({ packageDepth }) => executeCommand({
2691
+ let exec2 = async ({ packageDepth }) => executeCommand({
1857
2692
  command: "npm",
1858
2693
  args: ["ls", "--json", `--depth=${packageDepth}`],
1859
2694
  cwd: this.cwd,
@@ -1863,14 +2698,14 @@ var BUNProxy = class extends JsPackageManager {
1863
2698
  }
1864
2699
  });
1865
2700
  try {
1866
- let result = await await exec({ packageDepth: depth }), commandResult = typeof result.stdout == "string" ? result.stdout : "", parsedOutput = JSON.parse(commandResult);
2701
+ let result = await await exec2({ packageDepth: depth }), commandResult = typeof result.stdout == "string" ? result.stdout : "", parsedOutput = JSON.parse(commandResult);
1867
2702
  return this.mapDependencies(parsedOutput, pattern);
1868
2703
  } catch {
1869
2704
  try {
1870
- let result = await await exec({ packageDepth: 0 }), commandResult = typeof result.stdout == "string" ? result.stdout : "", parsedOutput = JSON.parse(commandResult);
2705
+ let result = await await exec2({ packageDepth: 0 }), commandResult = typeof result.stdout == "string" ? result.stdout : "", parsedOutput = JSON.parse(commandResult);
1871
2706
  return this.mapDependencies(parsedOutput, pattern);
1872
2707
  } catch (err) {
1873
- logger10.debug(
2708
+ logger13.debug(
1874
2709
  `An issue occurred while trying to find dependencies metadata using npm: ${err}`
1875
2710
  );
1876
2711
  return;
@@ -1890,7 +2725,7 @@ var BUNProxy = class extends JsPackageManager {
1890
2725
  command: "bun",
1891
2726
  args: ["install", ...this.getInstallArgs(), ...options?.force ? ["--force"] : []],
1892
2727
  cwd: this.cwd,
1893
- stdio: prompt2.getPreferredStdio()
2728
+ stdio: prompt3.getPreferredStdio()
1894
2729
  });
1895
2730
  }
1896
2731
  async installDependencies(options) {
@@ -1907,7 +2742,7 @@ var BUNProxy = class extends JsPackageManager {
1907
2742
  failedPackage: this.extractMinimumReleaseAgePackage(logs),
1908
2743
  cause: error
1909
2744
  });
1910
- throw logger10.error(handledError.message), handledError;
2745
+ throw logger13.error(handledError.message), handledError;
1911
2746
  }
1912
2747
  throw error;
1913
2748
  }
@@ -1933,11 +2768,11 @@ var BUNProxy = class extends JsPackageManager {
1933
2768
  Math.ceil(minimumReleaseAgeSeconds / 60)
1934
2769
  );
1935
2770
  if (nonInteractive) {
1936
- this.updateMinimumReleaseAgeExcludes(), logger10.info(
1937
- dedent6`
2771
+ this.updateMinimumReleaseAgeExcludes(), logger13.info(
2772
+ dedent9`
1938
2773
  bun minimumReleaseAge would block storybook@${storybookVersion} from being installed because it was released within the configured minimumReleaseAge window, so Forkbook updated minimumReleaseAgeExcludes for this project automatically.
1939
2774
 
1940
- Added patterns: storybook, @storybook/*, eslint-plugin-storybook
2775
+ Added patterns: ${FORKBOOK_PACKAGE_PATTERNS.join(", ")}
1941
2776
 
1942
2777
  Read more:
1943
2778
  - https://bun.com/docs/pm/cli/install#minimum-release-age
@@ -1945,7 +2780,7 @@ var BUNProxy = class extends JsPackageManager {
1945
2780
  );
1946
2781
  return;
1947
2782
  }
1948
- logger10.warn(
2783
+ logger13.warn(
1949
2784
  `bun minimumReleaseAge will block storybook@${storybookVersion} from being installed because it was released within the disallowed immaturity window.`
1950
2785
  );
1951
2786
  let rerunError = new MinimumReleaseAgeHandledError({
@@ -1954,7 +2789,7 @@ var BUNProxy = class extends JsPackageManager {
1954
2789
  compatibleVersion
1955
2790
  })
1956
2791
  });
1957
- if (await prompt2.select(
2792
+ if (await prompt3.select(
1958
2793
  {
1959
2794
  message: "How would you like to proceed?",
1960
2795
  options: [
@@ -1970,14 +2805,14 @@ var BUNProxy = class extends JsPackageManager {
1970
2805
  },
1971
2806
  {
1972
2807
  onCancel: () => {
1973
- throw logger10.error(rerunError.message), rerunError;
2808
+ throw logger13.error(rerunError.message), rerunError;
1974
2809
  }
1975
2810
  }
1976
2811
  ) === "exclude") {
1977
2812
  this.updateMinimumReleaseAgeExcludes();
1978
2813
  return;
1979
2814
  }
1980
- throw logger10.error(rerunError.message), rerunError;
2815
+ throw logger13.error(rerunError.message), rerunError;
1981
2816
  }
1982
2817
  async getRegistryURL() {
1983
2818
  let result = await executeCommand({
@@ -2061,7 +2896,7 @@ var BUNProxy = class extends JsPackageManager {
2061
2896
  compatibleVersion
2062
2897
  }) {
2063
2898
  let rerunCommand = getStorybookRerunCommand(compatibleVersion);
2064
- return dedent6`
2899
+ return dedent9`
2065
2900
  bun minimumReleaseAge blocked storybook@${currentVersion} from being installed.
2066
2901
 
2067
2902
  ${FORKBOOK_RERUN_INSTRUCTION}
@@ -2072,7 +2907,7 @@ var BUNProxy = class extends JsPackageManager {
2072
2907
  `;
2073
2908
  }
2074
2909
  updateMinimumReleaseAgeExcludes() {
2075
- let bunfigPath = join9(this.cwd, "bunfig.toml"), currentContent = this.readBunfig() ?? "", lineEnding = currentContent.includes(`\r
2910
+ let bunfigPath = join12(this.cwd, "bunfig.toml"), currentContent = this.readBunfig() ?? "", lineEnding = currentContent.includes(`\r
2076
2911
  `) ? `\r
2077
2912
  ` : `
2078
2913
  `, replacement = [
@@ -2090,7 +2925,7 @@ var BUNProxy = class extends JsPackageManager {
2090
2925
  ),
2091
2926
  currentContent.slice(installSectionRange.end)
2092
2927
  ].join("") : this.updateMinimumReleaseAgeExcludesInContent(currentContent, replacement, lineEnding);
2093
- writeFileSync2(bunfigPath, nextContent);
2928
+ writeFileSync3(bunfigPath, nextContent);
2094
2929
  }
2095
2930
  updateMinimumReleaseAgeExcludesInContent(content, replacement, lineEnding) {
2096
2931
  return content.match(/^minimumReleaseAgeExcludes\s*=\s*\[[\s\S]*?\]/m) ? content.replace(/^minimumReleaseAgeExcludes\s*=\s*\[[\s\S]*?\]/m, replacement) : content.match(/^minimumReleaseAge\s*=\s*.+$/m) ? content.replace(
@@ -2116,7 +2951,7 @@ var BUNProxy = class extends JsPackageManager {
2116
2951
  }
2117
2952
  readBunfig() {
2118
2953
  try {
2119
- return readFileSync8(join9(this.cwd, "bunfig.toml"), "utf-8");
2954
+ return readFileSync10(join12(this.cwd, "bunfig.toml"), "utf-8");
2120
2955
  } catch {
2121
2956
  return null;
2122
2957
  }
@@ -2148,15 +2983,15 @@ var BUNProxy = class extends JsPackageManager {
2148
2983
  };
2149
2984
 
2150
2985
  // src/common/js-package-manager/NPMProxy.ts
2151
- import { readFileSync as readFileSync9 } from "node:fs";
2152
- import { dirname as dirname7, join as join10 } from "node:path";
2153
- import { logger as logger11, prompt as prompt3 } from "@aussieljk/forkbook/internal/node-logger";
2986
+ import { readFileSync as readFileSync11 } from "node:fs";
2987
+ import { dirname as dirname9, join as join13 } from "node:path";
2988
+ import { logger as logger14, prompt as prompt4 } from "@aussieljk/forkbook/internal/node-logger";
2154
2989
  import {
2155
2990
  FindPackageVersionsError as FindPackageVersionsError2,
2156
2991
  MinimumReleaseAgeHandledError as MinimumReleaseAgeHandledError2
2157
2992
  } from "@aussieljk/forkbook/internal/server-errors";
2158
2993
  import sort2 from "semver/functions/sort.js";
2159
- import { dedent as dedent7 } from "ts-dedent";
2994
+ import { dedent as dedent10 } from "ts-dedent";
2160
2995
  var NPM_CONFIG_WORKSPACE_ARGS = ["--workspaces=false", "--include-workspace-root"];
2161
2996
  var NPMProxy = class extends JsPackageManager {
2162
2997
  constructor() {
@@ -2173,11 +3008,11 @@ var NPMProxy = class extends JsPackageManager {
2173
3008
  return `npm run ${command}`;
2174
3009
  }
2175
3010
  async getModulePackageJSON(packageName) {
2176
- let wantedPath = join10("node_modules", packageName, "package.json"), packageJsonPath = up2(wantedPath, {
3011
+ let wantedPath = join13("node_modules", packageName, "package.json"), packageJsonPath = up2(wantedPath, {
2177
3012
  cwd: this.primaryPackageJson.operationDir,
2178
3013
  last: getProjectRoot()
2179
3014
  });
2180
- return packageJsonPath ? JSON.parse(readFileSync9(packageJsonPath, "utf-8")) : null;
3015
+ return packageJsonPath ? JSON.parse(readFileSync11(packageJsonPath, "utf-8")) : null;
2181
3016
  }
2182
3017
  getInstallArgs() {
2183
3018
  return this.installArgs || (this.installArgs = []), this.installArgs;
@@ -2207,7 +3042,7 @@ var NPMProxy = class extends JsPackageManager {
2207
3042
  });
2208
3043
  }
2209
3044
  async findInstallations(pattern, { depth = 99 } = {}) {
2210
- let exec = ({ packageDepth }) => executeCommand({
3045
+ let exec2 = ({ packageDepth }) => executeCommand({
2211
3046
  command: "npm",
2212
3047
  args: ["ls", "--json", `--depth=${packageDepth}`],
2213
3048
  env: {
@@ -2217,14 +3052,14 @@ var NPMProxy = class extends JsPackageManager {
2217
3052
  stdio: ["pipe", "pipe", "ignore"]
2218
3053
  });
2219
3054
  try {
2220
- let childProcess = await exec({ packageDepth: depth }), commandResult = typeof childProcess.stdout == "string" ? childProcess.stdout : "", parsedOutput = JSON.parse(commandResult);
3055
+ let childProcess = await exec2({ packageDepth: depth }), commandResult = typeof childProcess.stdout == "string" ? childProcess.stdout : "", parsedOutput = JSON.parse(commandResult);
2221
3056
  return this.mapDependencies(parsedOutput, pattern);
2222
3057
  } catch {
2223
3058
  try {
2224
- let childProcess = await exec({ packageDepth: 0 }), commandResult = typeof childProcess.stdout == "string" ? childProcess.stdout : "", parsedOutput = JSON.parse(commandResult);
3059
+ let childProcess = await exec2({ packageDepth: 0 }), commandResult = typeof childProcess.stdout == "string" ? childProcess.stdout : "", parsedOutput = JSON.parse(commandResult);
2225
3060
  return this.mapDependencies(parsedOutput, pattern);
2226
3061
  } catch (e) {
2227
- logger11.debug(`Error finding installations for ${pattern.join(", ")}: ${String(e)}`);
3062
+ logger14.debug(`Error finding installations for ${pattern.join(", ")}: ${String(e)}`);
2228
3063
  return;
2229
3064
  }
2230
3065
  }
@@ -2243,8 +3078,9 @@ var NPMProxy = class extends JsPackageManager {
2243
3078
  return packageJsonPath && patterns?.length && globSync(
2244
3079
  patterns.filter((pattern) => !pattern.startsWith("!")).map((pattern) => `${pattern}/package.json`),
2245
3080
  {
2246
- cwd: dirname7(ancestorPath),
3081
+ cwd: dirname9(ancestorPath),
2247
3082
  absolute: !0,
3083
+ expandDirectories: !1,
2248
3084
  ignore: patterns.filter((pattern) => pattern.startsWith("!")).map((pattern) => `${pattern.slice(1)}/package.json`)
2249
3085
  }
2250
3086
  ).includes(packageJsonPath);
@@ -2252,8 +3088,8 @@ var NPMProxy = class extends JsPackageManager {
2252
3088
  return executeCommand({
2253
3089
  command: "npm",
2254
3090
  args: ["install", ...this.getInstallArgs(), ...options?.force ? ["--force"] : []],
2255
- cwd: workspacePackageJsonPath ? dirname7(workspacePackageJsonPath) : this.cwd,
2256
- stdio: prompt3.getPreferredStdio()
3091
+ cwd: workspacePackageJsonPath ? dirname9(workspacePackageJsonPath) : this.cwd,
3092
+ stdio: prompt4.getPreferredStdio()
2257
3093
  });
2258
3094
  }
2259
3095
  async installDependencies(options) {
@@ -2269,7 +3105,7 @@ var NPMProxy = class extends JsPackageManager {
2269
3105
  failedPackage: this.extractMinimumReleaseAgePackage(logs),
2270
3106
  cause: error
2271
3107
  });
2272
- throw logger11.error(handledError.message), handledError;
3108
+ throw logger14.error(handledError.message), handledError;
2273
3109
  }
2274
3110
  throw error;
2275
3111
  }
@@ -2298,7 +3134,7 @@ var NPMProxy = class extends JsPackageManager {
2298
3134
  compatibleVersion
2299
3135
  })
2300
3136
  });
2301
- throw logger11.error(error.message), error;
3137
+ throw logger14.error(error.message), error;
2302
3138
  }
2303
3139
  async getRegistryURL() {
2304
3140
  let result = await executeCommand({
@@ -2314,7 +3150,7 @@ var NPMProxy = class extends JsPackageManager {
2314
3150
  return installAsDevDependencies && (args = ["-D", ...args]), executeCommand({
2315
3151
  command: "npm",
2316
3152
  args: ["install", ...args, ...this.getInstallArgs()],
2317
- stdio: prompt3.getPreferredStdio(),
3153
+ stdio: prompt4.getPreferredStdio(),
2318
3154
  cwd: this.primaryPackageJson.operationDir
2319
3155
  });
2320
3156
  }
@@ -2382,7 +3218,7 @@ var NPMProxy = class extends JsPackageManager {
2382
3218
  compatibleVersion
2383
3219
  }) {
2384
3220
  let rerunCommand = getStorybookRerunCommand(compatibleVersion);
2385
- return dedent7`
3221
+ return dedent10`
2386
3222
  npm min-release-age blocked storybook@${currentVersion} from being installed.
2387
3223
 
2388
3224
  ${FORKBOOK_RERUN_INSTRUCTION}
@@ -2409,16 +3245,16 @@ var NPMProxy = class extends JsPackageManager {
2409
3245
  };
2410
3246
 
2411
3247
  // src/common/js-package-manager/PNPMProxy.ts
2412
- import { existsSync as existsSync4, readFileSync as readFileSync10, writeFileSync as writeFileSync3 } from "node:fs";
2413
- import { join as join11 } from "node:path";
2414
- import { logger as logger12, prompt as prompt4 } from "@aussieljk/forkbook/internal/node-logger";
3248
+ import { existsSync as existsSync6, readFileSync as readFileSync12, writeFileSync as writeFileSync4 } from "node:fs";
3249
+ import { join as join14 } from "node:path";
3250
+ import { logger as logger15, prompt as prompt5 } from "@aussieljk/forkbook/internal/node-logger";
2415
3251
  import {
2416
3252
  FindPackageVersionsError as FindPackageVersionsError3,
2417
3253
  MinimumReleaseAgeHandledError as MinimumReleaseAgeHandledError3
2418
3254
  } from "@aussieljk/forkbook/internal/server-errors";
2419
3255
  var import_yaml = __toESM(require_dist(), 1);
2420
- import { coerce, gte } from "semver";
2421
- import { dedent as dedent8 } from "ts-dedent";
3256
+ import { coerce as coerce2, gte } from "semver";
3257
+ import { dedent as dedent11 } from "ts-dedent";
2422
3258
  var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageManager {
2423
3259
  constructor() {
2424
3260
  super(...arguments);
@@ -2428,7 +3264,7 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2428
3264
  #pnpmVersion;
2429
3265
  detectWorkspaceRoot() {
2430
3266
  let pnpmWorkspaceYaml = `${process.cwd()}/pnpm-workspace.yaml`;
2431
- return existsSync4(pnpmWorkspaceYaml);
3267
+ return existsSync6(pnpmWorkspaceYaml);
2432
3268
  }
2433
3269
  getCommandName() {
2434
3270
  return "pnpm";
@@ -2446,7 +3282,7 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2446
3282
  if (this.#pnpmVersion !== void 0)
2447
3283
  return this.#pnpmVersion;
2448
3284
  try {
2449
- logger12.debug("Executing command: pnpm --version");
3285
+ logger15.debug("Executing command: pnpm --version");
2450
3286
  let stdout = executeCommandSync({
2451
3287
  cwd: this.cwd,
2452
3288
  command: "pnpm",
@@ -2460,7 +3296,7 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2460
3296
  return this.#pnpmVersion;
2461
3297
  }
2462
3298
  #pnpmGte(minimum) {
2463
- let version = coerce(this.#readPnpmVersion());
3299
+ let version = coerce2(this.#readPnpmVersion());
2464
3300
  return version != null && gte(version, minimum);
2465
3301
  }
2466
3302
  /**
@@ -2521,16 +3357,16 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2521
3357
  }), commandResult = typeof childProcess.stdout == "string" ? childProcess.stdout : "", parsedOutput = JSON.parse(commandResult);
2522
3358
  return this.mapDependencies(parsedOutput, pattern);
2523
3359
  } catch (e) {
2524
- logger12.debug(`Error finding installations for ${pattern.join(", ")}: ${String(e)}`);
3360
+ logger15.debug(`Error finding installations for ${pattern.join(", ")}: ${String(e)}`);
2525
3361
  return;
2526
3362
  }
2527
3363
  }
2528
3364
  async getModulePackageJSON(packageName) {
2529
- let wantedPath = join11("node_modules", packageName, "package.json"), packageJsonPath = up2(wantedPath, {
3365
+ let wantedPath = join14("node_modules", packageName, "package.json"), packageJsonPath = up2(wantedPath, {
2530
3366
  cwd: this.primaryPackageJson.operationDir,
2531
3367
  last: getProjectRoot()
2532
3368
  });
2533
- return packageJsonPath ? JSON.parse(readFileSync10(packageJsonPath, "utf-8")) : null;
3369
+ return packageJsonPath ? JSON.parse(readFileSync12(packageJsonPath, "utf-8")) : null;
2534
3370
  }
2535
3371
  getResolutions(packageJson, versions) {
2536
3372
  return {
@@ -2580,12 +3416,12 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2580
3416
  if (!path)
2581
3417
  return null;
2582
3418
  try {
2583
- let doc = (0, import_yaml.parseDocument)(readFileSync10(path, "utf8"));
3419
+ let doc = (0, import_yaml.parseDocument)(readFileSync12(path, "utf8"));
2584
3420
  if (doc.errors.length > 0)
2585
3421
  throw doc.errors[0];
2586
3422
  return { path, doc };
2587
3423
  } catch (e) {
2588
- return logger12.debug(`Could not read pnpm workspace file ${path}: ${String(e)}`), null;
3424
+ return logger15.debug(`Could not read pnpm workspace file ${path}: ${String(e)}`), null;
2589
3425
  }
2590
3426
  }
2591
3427
  /**
@@ -2608,23 +3444,23 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2608
3444
  #registerCatalogEntries(packages, version, anchorPackage, catalogName) {
2609
3445
  let workspace = this.#readWorkspaceYaml();
2610
3446
  if (!workspace)
2611
- return logger12.warn(
3447
+ return logger15.warn(
2612
3448
  `Could not read pnpm-workspace.yaml to register catalog entries for: ${packages.join(", ")}`
2613
3449
  ), !1;
2614
3450
  try {
2615
3451
  let keyPath = this.#catalogKeyPath(workspace.doc, catalogName), anchorVersion = workspace.doc.getIn([...keyPath, anchorPackage]), entryVersion = typeof anchorVersion == "string" || typeof anchorVersion == "number" ? String(anchorVersion) : version, changed = !1;
2616
3452
  for (let pkg of packages)
2617
3453
  workspace.doc.getIn([...keyPath, pkg]) === void 0 && (workspace.doc.setIn([...keyPath, pkg], entryVersion), changed = !0);
2618
- return changed && writeFileSync3(workspace.path, workspace.doc.toString(), "utf8"), !0;
3454
+ return changed && writeFileSync4(workspace.path, workspace.doc.toString(), "utf8"), !0;
2619
3455
  } catch (e) {
2620
- return logger12.warn(`Could not update pnpm catalog in ${workspace.path}: ${String(e)}`), !1;
3456
+ return logger15.warn(`Could not update pnpm catalog in ${workspace.path}: ${String(e)}`), !1;
2621
3457
  }
2622
3458
  }
2623
3459
  runInstall(options) {
2624
3460
  return executeCommand({
2625
3461
  command: "pnpm",
2626
3462
  args: ["install", ...this.getInstallArgs("install"), ...options?.force ? ["--force"] : []],
2627
- stdio: prompt4.getPreferredStdio(),
3463
+ stdio: prompt5.getPreferredStdio(),
2628
3464
  cwd: this.cwd
2629
3465
  });
2630
3466
  }
@@ -2643,7 +3479,7 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2643
3479
  failedPackage: this.extractFailedPackage(logs),
2644
3480
  cause: error
2645
3481
  });
2646
- throw logger12.error(handledError.message), handledError;
3482
+ throw logger15.error(handledError.message), handledError;
2647
3483
  }
2648
3484
  throw error;
2649
3485
  }
@@ -2663,11 +3499,11 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2663
3499
  minimumReleaseAge
2664
3500
  );
2665
3501
  if (nonInteractive) {
2666
- await this.updateMinimumReleaseAgeExclude(), logger12.info(
2667
- dedent8`
3502
+ await this.updateMinimumReleaseAgeExclude(), logger15.info(
3503
+ dedent11`
2668
3504
  pnpm minimumReleaseAge would block storybook@${storybookVersion} from being installed because it was released within the configured minimumReleaseAge window, so Forkbook updated minimumReleaseAgeExclude for this project automatically.
2669
3505
 
2670
- Added patterns: storybook, @storybook/*, eslint-plugin-storybook
3506
+ Added patterns: ${FORKBOOK_PACKAGE_PATTERNS.join(", ")}
2671
3507
 
2672
3508
  Read more:
2673
3509
  - https://pnpm.io/settings#minimumreleaseage
@@ -2676,7 +3512,7 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2676
3512
  );
2677
3513
  return;
2678
3514
  }
2679
- logger12.warn(
3515
+ logger15.warn(
2680
3516
  `pnpm minimumReleaseAge will block storybook@${storybookVersion} from being installed because it was published within the configured minimum-release-age window.`
2681
3517
  );
2682
3518
  let rerunError = new MinimumReleaseAgeHandledError3({
@@ -2685,7 +3521,7 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2685
3521
  compatibleVersion
2686
3522
  })
2687
3523
  });
2688
- if (await prompt4.select(
3524
+ if (await prompt5.select(
2689
3525
  {
2690
3526
  message: "How would you like to proceed?",
2691
3527
  options: [
@@ -2701,14 +3537,14 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2701
3537
  },
2702
3538
  {
2703
3539
  onCancel: () => {
2704
- throw logger12.error(rerunError.message), rerunError;
3540
+ throw logger15.error(rerunError.message), rerunError;
2705
3541
  }
2706
3542
  }
2707
3543
  ) === "exclude") {
2708
3544
  await this.updateMinimumReleaseAgeExclude();
2709
3545
  return;
2710
3546
  }
2711
- throw logger12.error(rerunError.message), rerunError;
3547
+ throw logger15.error(rerunError.message), rerunError;
2712
3548
  }
2713
3549
  runAddDeps(dependencies, installAsDevDependencies) {
2714
3550
  let args = [...dependencies];
@@ -2717,7 +3553,7 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2717
3553
  return executeCommand({
2718
3554
  command: "pnpm",
2719
3555
  args: commandArgs,
2720
- stdio: prompt4.getPreferredStdio(),
3556
+ stdio: prompt5.getPreferredStdio(),
2721
3557
  cwd: this.primaryPackageJson.operationDir
2722
3558
  });
2723
3559
  }
@@ -2808,7 +3644,7 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2808
3644
  compatibleVersion
2809
3645
  }) {
2810
3646
  let rerunCommand = getStorybookRerunCommand(compatibleVersion);
2811
- return dedent8`
3647
+ return dedent11`
2812
3648
  pnpm minimumReleaseAge blocked storybook@${currentVersion} from being installed.
2813
3649
 
2814
3650
  ${FORKBOOK_RERUN_INSTRUCTION}
@@ -2822,7 +3658,7 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2822
3658
  let currentMinimumReleaseAgeExclude = await this.getMinimumReleaseAgeExclude(), nextMinimumReleaseAgeExclude = Array.from(
2823
3659
  /* @__PURE__ */ new Set([...currentMinimumReleaseAgeExclude, ...FORKBOOK_PACKAGE_PATTERNS])
2824
3660
  );
2825
- await prompt4.executeTaskWithSpinner(
3661
+ await prompt5.executeTaskWithSpinner(
2826
3662
  () => this.runInternalCommand(
2827
3663
  "config",
2828
3664
  [
@@ -2860,10 +3696,10 @@ var PNPM_ALLOW_BUILD_DLX_MIN = "10.2.0", PNPMProxy = class extends JsPackageMana
2860
3696
  };
2861
3697
 
2862
3698
  // src/common/js-package-manager/Yarn1Proxy.ts
2863
- import { readFileSync as readFileSync11 } from "node:fs";
2864
- import { join as join12 } from "node:path";
3699
+ import { readFileSync as readFileSync13 } from "node:fs";
3700
+ import { join as join15 } from "node:path";
2865
3701
  import process2 from "node:process";
2866
- import { logger as logger13, prompt as prompt5 } from "@aussieljk/forkbook/internal/node-logger";
3702
+ import { logger as logger16, prompt as prompt6 } from "@aussieljk/forkbook/internal/node-logger";
2867
3703
  import { FindPackageVersionsError as FindPackageVersionsError4 } from "@aussieljk/forkbook/internal/server-errors";
2868
3704
  var Yarn1Proxy = class extends JsPackageManager {
2869
3705
  constructor() {
@@ -2909,11 +3745,11 @@ var Yarn1Proxy = class extends JsPackageManager {
2909
3745
  });
2910
3746
  }
2911
3747
  async getModulePackageJSON(packageName) {
2912
- let wantedPath = join12("node_modules", packageName, "package.json"), packageJsonPath = up2(wantedPath, {
3748
+ let wantedPath = join15("node_modules", packageName, "package.json"), packageJsonPath = up2(wantedPath, {
2913
3749
  cwd: this.primaryPackageJson.operationDir,
2914
3750
  last: getProjectRoot()
2915
3751
  });
2916
- return packageJsonPath ? JSON.parse(readFileSync11(packageJsonPath, "utf-8")) : null;
3752
+ return packageJsonPath ? JSON.parse(readFileSync13(packageJsonPath, "utf-8")) : null;
2917
3753
  }
2918
3754
  async getRegistryURL() {
2919
3755
  let childProcess = await executeCommand({
@@ -2937,7 +3773,7 @@ var Yarn1Proxy = class extends JsPackageManager {
2937
3773
  }), commandResult = typeof result.stdout == "string" ? result.stdout : "", parsedOutput = JSON.parse(commandResult);
2938
3774
  return this.mapDependencies(parsedOutput, pattern);
2939
3775
  } catch (e) {
2940
- logger13.debug(`Error finding installations for ${pattern.join(", ")}: ${String(e)}`);
3776
+ logger16.debug(`Error finding installations for ${pattern.join(", ")}: ${String(e)}`);
2941
3777
  return;
2942
3778
  }
2943
3779
  }
@@ -2953,7 +3789,7 @@ var Yarn1Proxy = class extends JsPackageManager {
2953
3789
  return executeCommand({
2954
3790
  command: "yarn",
2955
3791
  args: ["install", ...this.getInstallArgs(), ...options?.force ? ["--force"] : []],
2956
- stdio: prompt5.getPreferredStdio(),
3792
+ stdio: prompt6.getPreferredStdio(),
2957
3793
  cwd: this.cwd
2958
3794
  });
2959
3795
  }
@@ -2962,7 +3798,7 @@ var Yarn1Proxy = class extends JsPackageManager {
2962
3798
  return installAsDevDependencies && (args = ["-D", ...args]), executeCommand({
2963
3799
  command: "yarn",
2964
3800
  args: ["add", ...this.getInstallArgs(), ...args],
2965
- stdio: prompt5.getPreferredStdio(),
3801
+ stdio: prompt6.getPreferredStdio(),
2966
3802
  cwd: this.primaryPackageJson.operationDir
2967
3803
  });
2968
3804
  }
@@ -3012,14 +3848,14 @@ var Yarn1Proxy = class extends JsPackageManager {
3012
3848
  };
3013
3849
 
3014
3850
  // src/common/js-package-manager/Yarn2Proxy.ts
3015
- import { readFileSync as readFileSync12 } from "node:fs";
3016
- import { join as join13 } from "node:path";
3017
- import { prompt as prompt6 } from "@aussieljk/forkbook/internal/node-logger";
3851
+ import { readFileSync as readFileSync14 } from "node:fs";
3852
+ import { join as join16 } from "node:path";
3853
+ import { prompt as prompt7 } from "@aussieljk/forkbook/internal/node-logger";
3018
3854
  import {
3019
3855
  FindPackageVersionsError as FindPackageVersionsError5,
3020
3856
  MinimumReleaseAgeHandledError as MinimumReleaseAgeHandledError4
3021
3857
  } from "@aussieljk/forkbook/internal/server-errors";
3022
- import { dedent as dedent9 } from "ts-dedent";
3858
+ import { dedent as dedent12 } from "ts-dedent";
3023
3859
  var Yarn2Proxy = class extends JsPackageManager {
3024
3860
  constructor() {
3025
3861
  super(...arguments);
@@ -3081,11 +3917,11 @@ var Yarn2Proxy = class extends JsPackageManager {
3081
3917
  }
3082
3918
  }
3083
3919
  async getModulePackageJSON(packageName) {
3084
- let wantedPath = join13("node_modules", packageName, "package.json"), packageJsonPath = up2(wantedPath, {
3920
+ let wantedPath = join16("node_modules", packageName, "package.json"), packageJsonPath = up2(wantedPath, {
3085
3921
  cwd: this.primaryPackageJson.operationDir,
3086
3922
  last: getProjectRoot()
3087
3923
  });
3088
- return packageJsonPath ? JSON.parse(readFileSync12(packageJsonPath, "utf-8")) : null;
3924
+ return packageJsonPath ? JSON.parse(readFileSync14(packageJsonPath, "utf-8")) : null;
3089
3925
  }
3090
3926
  getResolutions(packageJson, versions) {
3091
3927
  return {
@@ -3100,7 +3936,7 @@ var Yarn2Proxy = class extends JsPackageManager {
3100
3936
  command: "yarn",
3101
3937
  args: ["install", ...this.getInstallArgs()],
3102
3938
  cwd: this.cwd,
3103
- stdio: prompt6.getPreferredStdio()
3939
+ stdio: prompt7.getPreferredStdio()
3104
3940
  });
3105
3941
  }
3106
3942
  async installDependencies(options) {
@@ -3145,10 +3981,10 @@ var Yarn2Proxy = class extends JsPackageManager {
3145
3981
  );
3146
3982
  if (nonInteractive) {
3147
3983
  await this.updatePreapprovedPackages(), logger.info(
3148
- dedent9`
3984
+ dedent12`
3149
3985
  yarn npmMinimalAgeGate would block storybook@${storybookVersion} from being installed because it was released within the configured npmMinimalAgeGate window, so Forkbook updated npmPreapprovedPackages for this project automatically.
3150
3986
 
3151
- Added patterns: storybook, @storybook/*, eslint-plugin-storybook
3987
+ Added patterns: ${FORKBOOK_PACKAGE_PATTERNS.join(", ")}
3152
3988
 
3153
3989
  Read more:
3154
3990
  - https://yarnpkg.com/configuration/yarnrc#npmMinimalAgeGate
@@ -3166,7 +4002,7 @@ var Yarn2Proxy = class extends JsPackageManager {
3166
4002
  compatibleVersion
3167
4003
  })
3168
4004
  });
3169
- if (await prompt6.select(
4005
+ if (await prompt7.select(
3170
4006
  {
3171
4007
  message: "How would you like to proceed?",
3172
4008
  options: [
@@ -3196,7 +4032,7 @@ var Yarn2Proxy = class extends JsPackageManager {
3196
4032
  return installAsDevDependencies && (args = ["-D", ...args]), executeCommand({
3197
4033
  command: "yarn",
3198
4034
  args: ["add", ...this.getInstallArgs(), ...args],
3199
- stdio: prompt6.getPreferredStdio(),
4035
+ stdio: prompt7.getPreferredStdio(),
3200
4036
  cwd: this.primaryPackageJson.operationDir
3201
4037
  });
3202
4038
  }
@@ -3276,7 +4112,7 @@ var Yarn2Proxy = class extends JsPackageManager {
3276
4112
  compatibleVersion
3277
4113
  }) {
3278
4114
  let rerunCommand = getStorybookRerunCommand(compatibleVersion);
3279
- return dedent9`
4115
+ return dedent12`
3280
4116
  yarn npmMinimalAgeGate blocked storybook@${currentVersion} from being installed.
3281
4117
 
3282
4118
  ${FORKBOOK_RERUN_INSTRUCTION}
@@ -3290,7 +4126,7 @@ var Yarn2Proxy = class extends JsPackageManager {
3290
4126
  let currentPreapprovedPackages = await this.getPreapprovedPackages(), nextPreapprovedPackages = Array.from(
3291
4127
  /* @__PURE__ */ new Set([...currentPreapprovedPackages, ...FORKBOOK_PACKAGE_PATTERNS])
3292
4128
  );
3293
- await prompt6.executeTaskWithSpinner(
4129
+ await prompt7.executeTaskWithSpinner(
3294
4130
  () => this.runInternalCommand(
3295
4131
  "config",
3296
4132
  ["set", "npmPreapprovedPackages", "--json", JSON.stringify(nextPreapprovedPackages)],
@@ -3359,9 +4195,9 @@ var JsPackageManagerFactory = class {
3359
4195
  up2(BUN_LOCKFILE, { cwd, last: root }),
3360
4196
  up2(BUN_LOCKFILE_BINARY, { cwd, last: root })
3361
4197
  ].filter(Boolean).sort((a, b) => {
3362
- let dirA = parse3(a).dir, dirB = parse3(b).dir, compare = relative4(dirA, dirB);
4198
+ let dirA = parse4(a).dir, dirB = parse4(b).dir, compare = relative5(dirA, dirB);
3363
4199
  return dirA === dirB ? 0 : compare.startsWith("..") ? -1 : 1;
3364
- })[0], closestLockfile = closestLockfilePath && basename3(closestLockfilePath), yarnVersion = getYarnVersion(cwd);
4200
+ })[0], closestLockfile = closestLockfilePath && basename4(closestLockfilePath), yarnVersion = getYarnVersion(cwd);
3365
4201
  if (yarnVersion && closestLockfile === YARN_LOCKFILE)
3366
4202
  return yarnVersion === 1 ? "yarn1" /* YARN1 */ : "yarn2" /* YARN2 */;
3367
4203
  if (hasPNPM(cwd) && closestLockfile === PNPM_LOCKFILE)
@@ -3471,10 +4307,10 @@ function hasPNPM(cwd) {
3471
4307
  function getYarnVersionFromPackageJson(cwd, root) {
3472
4308
  let effectiveRoot = root ?? getProjectRoot(), directories = up(cwd ?? process.cwd(), { last: effectiveRoot });
3473
4309
  for (let dir of directories) {
3474
- let packageJsonPath = join14(dir, "package.json");
3475
- if (existsSync5(packageJsonPath))
4310
+ let packageJsonPath = join17(dir, "package.json");
4311
+ if (existsSync7(packageJsonPath))
3476
4312
  try {
3477
- let packageManager = JSON.parse(readFileSync13(packageJsonPath, "utf-8")).packageManager;
4313
+ let packageManager = JSON.parse(readFileSync15(packageJsonPath, "utf-8")).packageManager;
3478
4314
  if (typeof packageManager == "string") {
3479
4315
  let match = packageManager.match(/^yarn@(\d+)\./);
3480
4316
  if (match)
@@ -3508,12 +4344,12 @@ function getYarnVersion(cwd) {
3508
4344
  }
3509
4345
 
3510
4346
  // src/common/js-package-manager/warnOnYarn1.ts
3511
- import { once } from "@aussieljk/forkbook/internal/node-logger";
3512
- var PACKAGE_MANAGER_INSTALL_DOCS_URL = "https://storybook.js.org/docs/get-started/install";
4347
+ import { once as once2 } from "@aussieljk/forkbook/internal/node-logger";
4348
+ var PACKAGE_MANAGER_INSTALL_DOCS_URL = "https://forkbook.ljk.dev/docs/get-started/install";
3513
4349
  function warnOnYarn1(packageManagerType) {
3514
4350
  if (packageManagerType === "yarn1" /* YARN1 */)
3515
4351
  try {
3516
- once.warn(
4352
+ once2.warn(
3517
4353
  `${getPrettyPackageManagerName(packageManagerType)} is supported on a best-effort basis. Forkbook works best with npm, pnpm, or Yarn Berry. For more information, see: ${PACKAGE_MANAGER_INSTALL_DOCS_URL}`
3518
4354
  );
3519
4355
  } catch {
@@ -3521,7 +4357,7 @@ function warnOnYarn1(packageManagerType) {
3521
4357
  }
3522
4358
 
3523
4359
  // src/common/utils/scan-and-transform-files.ts
3524
- import { logger as logger14, prompt as prompt7 } from "@aussieljk/forkbook/internal/node-logger";
4360
+ import { logger as logger17, prompt as prompt8 } from "@aussieljk/forkbook/internal/node-logger";
3525
4361
  async function scanAndTransformFiles({
3526
4362
  promptMessage = "Enter a custom glob pattern to scan (or press enter to use default):",
3527
4363
  defaultGlob = "**/*.{mjs,cjs,js,jsx,ts,tsx,mdx}",
@@ -3530,19 +4366,20 @@ async function scanAndTransformFiles({
3530
4366
  transformFn,
3531
4367
  transformOptions
3532
4368
  }) {
3533
- let glob = force ? defaultGlob : await prompt7.text({
4369
+ let glob2 = force ? defaultGlob : await prompt8.text({
3534
4370
  message: promptMessage,
3535
4371
  initialValue: defaultGlob
3536
4372
  });
3537
- logger14.log("Scanning for affected files...");
3538
- let globby = (await import("./globby-OEMHPBFY.js")).globby, sourceFiles = await globby([glob], {
4373
+ logger17.log("Scanning for affected files...");
4374
+ let { glob: globFiles } = await import("./dist-XPLJ5T4W.js"), sourceFiles = await globFiles([glob2], {
4375
+ expandDirectories: !1,
3539
4376
  ...commonGlobOptions(""),
3540
4377
  ignore: ["**/node_modules/**"],
3541
4378
  dot: !0,
3542
4379
  cwd: getProjectRoot(),
3543
4380
  absolute: !0
3544
4381
  });
3545
- return logger14.log(`Scanning ${sourceFiles.length} files...`), transformFn(sourceFiles, transformOptions, dryRun);
4382
+ return logger17.log(`Scanning ${sourceFiles.length} files...`), transformFn(sourceFiles, transformOptions, dryRun);
3546
4383
  }
3547
4384
 
3548
4385
  // src/common/utils/transform-imports.ts
@@ -3556,12 +4393,12 @@ function transformImports(source, renamedImports) {
3556
4393
  }
3557
4394
 
3558
4395
  // src/common/utils/file-lock.ts
3559
- import { logger as logger15 } from "@aussieljk/forkbook/internal/node-logger";
3560
- import { randomUUID } from "node:crypto";
3561
- import { readFileSync as readFileSync14, rmSync as rmSync2 } from "node:fs";
3562
- import { mkdir as mkdir2, open, readFile as readFile6, rm as rm3, stat, utimes } from "node:fs/promises";
3563
- import { dirname as dirname8 } from "node:path";
3564
- var POLL_INTERVAL_MS = 50, DEFAULT_STALE_AFTER_MS = 3e4, DEFAULT_WAIT_BUDGET_MS = 2e4, MALFORMED_LOCK_GRACE_MS = 5e3, errorCode = (error) => typeof error == "object" && error !== null && "code" in error ? error.code : void 0, delay = (ms) => new Promise((resolve7) => setTimeout(resolve7, ms)), isProcessAlive = (pid) => {
4396
+ import { logger as logger18 } from "@aussieljk/forkbook/internal/node-logger";
4397
+ import { randomUUID as randomUUID2 } from "node:crypto";
4398
+ import { readFileSync as readFileSync16, rmSync as rmSync2 } from "node:fs";
4399
+ import { mkdir as mkdir2, open, readFile as readFile7, rm as rm4, stat, utimes } from "node:fs/promises";
4400
+ import { dirname as dirname10 } from "node:path";
4401
+ var POLL_INTERVAL_MS = 50, DEFAULT_STALE_AFTER_MS = 3e4, DEFAULT_WAIT_BUDGET_MS = 2e4, MALFORMED_LOCK_GRACE_MS = 5e3, errorCode = (error) => typeof error == "object" && error !== null && "code" in error ? error.code : void 0, delay = (ms) => new Promise((resolve10) => setTimeout(resolve10, ms)), isProcessAlive = (pid) => {
3565
4402
  try {
3566
4403
  return process.kill(pid, 0), !0;
3567
4404
  } catch (error) {
@@ -3569,12 +4406,12 @@ var POLL_INTERVAL_MS = 50, DEFAULT_STALE_AFTER_MS = 3e4, DEFAULT_WAIT_BUDGET_MS
3569
4406
  }
3570
4407
  }, readPayload = async (lockPath) => {
3571
4408
  try {
3572
- return JSON.parse(await readFile6(lockPath, "utf8"));
4409
+ return JSON.parse(await readFile7(lockPath, "utf8"));
3573
4410
  } catch {
3574
4411
  return;
3575
4412
  }
3576
4413
  }, tryAcquire = async (lockPath) => {
3577
- await mkdir2(dirname8(lockPath), { recursive: !0 });
4414
+ await mkdir2(dirname10(lockPath), { recursive: !0 });
3578
4415
  let handle;
3579
4416
  try {
3580
4417
  handle = await open(lockPath, "wx");
@@ -3583,11 +4420,11 @@ var POLL_INTERVAL_MS = 50, DEFAULT_STALE_AFTER_MS = 3e4, DEFAULT_WAIT_BUDGET_MS
3583
4420
  return;
3584
4421
  throw error;
3585
4422
  }
3586
- let payload = { token: randomUUID(), pid: process.pid };
4423
+ let payload = { token: randomUUID2(), pid: process.pid };
3587
4424
  try {
3588
4425
  await handle.writeFile(JSON.stringify(payload));
3589
4426
  } catch (error) {
3590
- throw await handle.close(), await rm3(lockPath, { force: !0 }).catch(() => {
4427
+ throw await handle.close(), await rm4(lockPath, { force: !0 }).catch(() => {
3591
4428
  }), error;
3592
4429
  }
3593
4430
  return await handle.close(), payload.token;
@@ -3599,10 +4436,10 @@ var POLL_INTERVAL_MS = 50, DEFAULT_STALE_AFTER_MS = 3e4, DEFAULT_WAIT_BUDGET_MS
3599
4436
  return errorCode(error) === "ENOENT";
3600
4437
  }
3601
4438
  let payload = await readPayload(lockPath), holderPid = typeof payload?.pid == "number" ? payload.pid : void 0, age = Date.now() - stats.mtimeMs;
3602
- return (holderPid !== void 0 ? !isProcessAlive(holderPid) || age > staleAfterMs : age > MALFORMED_LOCK_GRACE_MS) ? ((await readPayload(lockPath))?.token !== payload?.token || (await rm3(lockPath, { force: !0 }), logger15.debug(`Cleared an abandoned lock at ${lockPath} (holder pid ${holderPid ?? "unknown"})`)), !0) : !1;
4439
+ return (holderPid !== void 0 ? !isProcessAlive(holderPid) || age > staleAfterMs : age > MALFORMED_LOCK_GRACE_MS) ? ((await readPayload(lockPath))?.token !== payload?.token || (await rm4(lockPath, { force: !0 }), logger18.debug(`Cleared an abandoned lock at ${lockPath} (holder pid ${holderPid ?? "unknown"})`)), !0) : !1;
3603
4440
  }, releaseIfOurs = (lockPath, token) => {
3604
4441
  try {
3605
- JSON.parse(readFileSync14(lockPath, "utf8"))?.token === token && rmSync2(lockPath, { force: !0 });
4442
+ JSON.parse(readFileSync16(lockPath, "utf8"))?.token === token && rmSync2(lockPath, { force: !0 });
3606
4443
  } catch {
3607
4444
  }
3608
4445
  }, holdLock = (lockPath, token, staleAfterMs) => {
@@ -3642,12 +4479,12 @@ var POLL_INTERVAL_MS = 50, DEFAULT_STALE_AFTER_MS = 3e4, DEFAULT_WAIT_BUDGET_MS
3642
4479
  };
3643
4480
 
3644
4481
  // src/common/utils/process-ancestry.ts
3645
- import { execSync } from "node:child_process";
4482
+ import { execSync as execSync2 } from "node:child_process";
3646
4483
  import os2 from "node:os";
3647
4484
  var UNIX_TIMEOUT = 5e3, WINDOWS_TIMEOUT = 1e4, MAX_DEPTH = 1e3, EXEC_STDIO = ["ignore", "pipe", "ignore"];
3648
4485
  function getProcessInfoUnix(pid) {
3649
4486
  try {
3650
- let output = execSync(`ps -p ${pid} -o pid=,ppid=,command=`, {
4487
+ let output = execSync2(`ps -p ${pid} -o pid=,ppid=,command=`, {
3651
4488
  encoding: "utf8",
3652
4489
  timeout: UNIX_TIMEOUT,
3653
4490
  stdio: EXEC_STDIO
@@ -3666,7 +4503,7 @@ function getProcessInfoUnix(pid) {
3666
4503
  }
3667
4504
  function getProcessInfoWindows(pid) {
3668
4505
  try {
3669
- let output = execSync(
4506
+ let output = execSync2(
3670
4507
  `wmic process where (ProcessId=${pid}) get ProcessId,ParentProcessId,CommandLine /format:csv`,
3671
4508
  {
3672
4509
  encoding: "utf8",
@@ -3708,13 +4545,18 @@ function getProcessAncestry(pid = process.pid) {
3708
4545
  }
3709
4546
 
3710
4547
  export {
4548
+ versions_default,
4549
+ supportedExtensions,
4550
+ getInterpretedFile,
4551
+ resolveImport,
4552
+ validateConfigurationFiles,
3711
4553
  resolveAddonName,
3712
4554
  loadPreset,
3713
4555
  getPresets,
3714
4556
  loadAllPresets,
3715
4557
  FileSystemCache,
3716
4558
  createFileSystemCache,
3717
- resolvePathInStorybookCache,
4559
+ resolvePathInForkbookCache,
3718
4560
  cache2 as cache,
3719
4561
  temporaryDirectory,
3720
4562
  temporaryFile,
@@ -3727,10 +4569,51 @@ export {
3727
4569
  findStorybookPackageRoot,
3728
4570
  commonGlobOptions,
3729
4571
  deepMerge,
4572
+ defaultConfigDir,
4573
+ frameworkToRenderer,
4574
+ frameworkToBuilder,
3730
4575
  getBuilderOptions,
4576
+ isPkgPrNewVersionSpecifier,
4577
+ getPkgPrNewPackageSpecifier,
3731
4578
  getStorybookVersionSpecifierFromAncestry,
3732
4579
  FORKBOOK_VERSION_SPECIFIER_ENV,
3733
4580
  resolveStorybookVersionSpecifier,
4581
+ HandledError,
4582
+ FORKBOOK_PACKAGE_PATTERNS,
4583
+ hasStorybookMinimumAgeExclusions,
4584
+ parsePackageData,
4585
+ parsePositiveIntegerConfigValue,
4586
+ parseReleaseTime,
4587
+ parsePackageTimeMap,
4588
+ getAgeInMinutes,
4589
+ getLatestStableVersionAdheringToMinimumAgeGate,
4590
+ getVitestStorybookRunCommand,
4591
+ getMswInitCommand,
4592
+ FORKBOOK_RERUN_INSTRUCTION,
4593
+ getStorybookRerunCommand,
4594
+ getErrorLogs,
4595
+ INSTALL_ERROR_TAIL_LINES,
4596
+ getInstallErrorTail,
4597
+ getVitePlusVersions,
4598
+ clearVitePlusCache,
4599
+ PackageManagerName,
4600
+ getPrettyPackageManagerName,
4601
+ getPackageDetails,
4602
+ JsPackageManager,
4603
+ normalizeAddonName,
4604
+ getAddonNames,
4605
+ getRendererName,
4606
+ extractRenderer,
4607
+ getStorybookConfiguration,
4608
+ loadMainConfig,
4609
+ rendererPackages,
4610
+ frameworkPackages,
4611
+ builderPackages,
4612
+ findConfigFile,
4613
+ getConfigInfo,
4614
+ getStorybookInfo,
4615
+ getFrameworkName,
4616
+ extractFrameworkPackageName,
3734
4617
  readDependencyManifest,
3735
4618
  getAutoRefs,
3736
4619
  checkRef,
@@ -3761,7 +4644,7 @@ export {
3761
4644
  formatCode,
3762
4645
  formatFileContent,
3763
4646
  userOrAutoTitleFromSpecifier,
3764
- posix2 as posix,
4647
+ posix3 as posix,
3765
4648
  getStoryId,
3766
4649
  getStoryTitle,
3767
4650
  createLazyDocgenMiddleware,