@aussieljk/forkbook 0.0.1-11 → 0.0.1-12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/create/rendererAssets/common/button.css +6 -6
- package/assets/create/rendererAssets/common/header.css +5 -5
- package/assets/create/rendererAssets/common/page.css +10 -10
- package/dist/_browser-chunks/{Color-QLZNXLSV.js → Color-TA43572R.js} +2 -2
- package/dist/_browser-chunks/{DocsRenderer-JXND3PVQ.js → DocsRenderer-DKXSW2OY.js} +2 -2
- package/dist/_browser-chunks/{WithTooltip-GNLRTZDF.js → WithTooltip-66AWY4VQ.js} +5 -4
- package/dist/_browser-chunks/{chunk-RBCHTR7C.js → chunk-2ELGJRFZ.js} +1 -1
- package/dist/_browser-chunks/{chunk-DYNTDJ3O.js → chunk-2UKY4NXZ.js} +1 -1
- package/dist/_browser-chunks/{chunk-I4ATZPNZ.js → chunk-2WMECYEY.js} +3 -3
- package/dist/_browser-chunks/{chunk-6ELMKWKX.js → chunk-2WZWS7GJ.js} +1 -1
- package/dist/_browser-chunks/{chunk-N3NRW5XX.js → chunk-2YWS25WY.js} +1 -1
- package/dist/_browser-chunks/{chunk-NGMQJMCY.js → chunk-3O4QUF3D.js} +1 -1
- package/dist/_browser-chunks/{chunk-GNZY6LOW.js → chunk-5MRMYSUN.js} +4 -4
- package/dist/_browser-chunks/{chunk-RMYQ3QN3.js → chunk-5XGERZHU.js} +15 -12
- package/dist/_browser-chunks/{chunk-5WMXI5GW.js → chunk-AQVUHXWY.js} +6 -4
- package/dist/_browser-chunks/{chunk-ZHKZKFY4.js → chunk-ARZTIHZK.js} +6 -10
- package/dist/_browser-chunks/{chunk-DS2WQZGO.js → chunk-D2Z5KXPS.js} +12 -41
- package/dist/_browser-chunks/{chunk-EQKMUQF3.js → chunk-DT7BB545.js} +3 -2
- package/dist/_browser-chunks/{chunk-76222HQR.js → chunk-E6QKKKLO.js} +20 -5
- package/dist/_browser-chunks/{chunk-QU4RB2WU.js → chunk-F22A5EGD.js} +4 -4
- package/dist/_browser-chunks/{chunk-3M5T7BW4.js → chunk-GGALYEQS.js} +1 -1
- package/dist/_browser-chunks/{chunk-TTBPZQ24.js → chunk-HGIW4I4J.js} +11 -18
- package/dist/_browser-chunks/{chunk-46Z7NGAS.js → chunk-HX443LKV.js} +1 -1
- package/dist/_browser-chunks/{chunk-KYSD26D6.js → chunk-IGD46SQI.js} +90 -83
- package/dist/_browser-chunks/{chunk-WBLVFDJT.js → chunk-QSYOMLRG.js} +665 -622
- package/dist/_browser-chunks/{chunk-2JT76G3E.js → chunk-SBOQ4QPY.js} +15 -15
- package/dist/_browser-chunks/{chunk-O24AZJZ7.js → chunk-UDR26TXA.js} +2 -2
- package/dist/_browser-chunks/{chunk-5I7E4GMO.js → chunk-WY2LUGOH.js} +1 -1
- package/dist/_browser-chunks/{chunk-7DQREF4S.js → chunk-XV3AEPJW.js} +1 -1
- package/dist/_browser-chunks/{matchers-YLBYSYAF.js → matchers-2HVLNCVO.js} +4 -4
- package/dist/_browser-chunks/{react-dom-client-4OHE3QDV.js → react-dom-client-SLBUX3U3.js} +1 -1
- package/dist/_node-chunks/{attached-runtime-J2AKT5WI.js → attached-runtime-AU2RZM4Y.js} +28 -29
- package/dist/_node-chunks/{builder-manager-Z4RWF4ZH.js → builder-manager-UPXA2KKT.js} +39 -28
- package/dist/_node-chunks/{chunk-NIQSBBT2.js → chunk-22A63J7O.js} +7 -7
- package/dist/_node-chunks/{chunk-5P4N734V.js → chunk-22TWJGGQ.js} +28 -43
- package/dist/_node-chunks/{chunk-T6P2EJD2.js → chunk-2GJBHF56.js} +6 -6
- package/dist/_node-chunks/{chunk-GGCOG7OV.js → chunk-2MGPZNKV.js} +280 -306
- package/dist/_node-chunks/{chunk-36LPBTLF.js → chunk-2Q3YWQSK.js} +6 -6
- package/dist/_node-chunks/{chunk-OXT6T4AS.js → chunk-2W525A4I.js} +7 -7
- package/dist/_node-chunks/{chunk-55S3GGGC.js → chunk-2X3WAH7V.js} +7 -7
- package/dist/_node-chunks/{chunk-XH5CXH53.js → chunk-34DNGOCZ.js} +8 -8
- package/dist/_node-chunks/{chunk-A7GEBS3Q.js → chunk-3MJZ5GI2.js} +6 -6
- package/dist/_node-chunks/{chunk-46Y5H6X5.js → chunk-3X67K6EI.js} +136 -114
- package/dist/_node-chunks/{chunk-GMKLTDKN.js → chunk-5KMW5XXM.js} +6 -6
- package/dist/_node-chunks/{chunk-AVL7GUOZ.js → chunk-5MYXWAKD.js} +515 -1040
- package/dist/_node-chunks/{chunk-MI7WBXWX.js → chunk-5N7YRHXJ.js} +6 -6
- package/dist/_node-chunks/{chunk-LKITAODU.js → chunk-6772LYNF.js} +7 -7
- package/dist/_node-chunks/{chunk-IRPQQARO.js → chunk-76M6JG5T.js} +7 -7
- package/dist/_node-chunks/{chunk-YBG7HVP7.js → chunk-7F6TIY4T.js} +8 -8
- package/dist/_node-chunks/{chunk-IFAV3CER.js → chunk-7SBWGNA7.js} +10 -10
- package/dist/_node-chunks/{chunk-LHNHFYK3.js → chunk-ABCEMTIP.js} +6 -6
- package/dist/_node-chunks/{chunk-OPT5A55S.js → chunk-AHNN3TQH.js} +8 -8
- package/dist/_node-chunks/{chunk-76KKKLEE.js → chunk-BDATIKVV.js} +7 -7
- package/dist/_node-chunks/{chunk-SJXLINHV.js → chunk-BMM74ZQW.js} +6 -6
- package/dist/_node-chunks/{chunk-XSVOMORJ.js → chunk-BOWRRVJM.js} +6 -6
- package/dist/_node-chunks/{chunk-FB2BOL6I.js → chunk-BTDLJXAT.js} +6 -6
- package/dist/_node-chunks/{chunk-W7HY3ELZ.js → chunk-C2HVGXLD.js} +224 -181
- package/dist/_node-chunks/chunk-CWIJ2D5F.js +18 -0
- package/dist/_node-chunks/{chunk-BKND5XP2.js → chunk-DNX4BLMS.js} +7 -7
- package/dist/_node-chunks/{chunk-FTYDKQCO.js → chunk-DXR3YGRT.js} +6 -6
- package/dist/_node-chunks/{chunk-6E34W4UX.js → chunk-EFZAYIPN.js} +6 -6
- package/dist/_node-chunks/{chunk-54EHKXV7.js → chunk-FAR3NIPG.js} +8 -8
- package/dist/_node-chunks/{chunk-3EBGFRAH.js → chunk-FFUIQJRI.js} +32 -40
- package/dist/_node-chunks/{chunk-2WVLC5M2.js → chunk-FKI7K3GE.js} +6 -6
- package/dist/_node-chunks/{chunk-TAMTPVYZ.js → chunk-FR67COFW.js} +7 -7
- package/dist/_node-chunks/{chunk-IVAOJWPF.js → chunk-FUDG3QKB.js} +7 -7
- package/dist/_node-chunks/{chunk-XVOIYGTJ.js → chunk-G6GOV7H7.js} +6 -6
- package/dist/_node-chunks/{chunk-MW4OAPPD.js → chunk-H7UVQBCQ.js} +8 -8
- package/dist/_node-chunks/{chunk-PYVGF5F2.js → chunk-HMQUTLMS.js} +6 -6
- package/dist/_node-chunks/{chunk-NLNAIU4I.js → chunk-HPXM4SGT.js} +9 -9
- package/dist/_node-chunks/{chunk-APPFF22V.js → chunk-HW4T3OXA.js} +7 -7
- package/dist/_node-chunks/{chunk-FUG5LYKS.js → chunk-HW7RCOV4.js} +8 -8
- package/dist/_node-chunks/{chunk-PXOD36TR.js → chunk-IFHNMS7I.js} +19 -19
- package/dist/_node-chunks/{chunk-W3KFVTWV.js → chunk-IKUSSZJ3.js} +10 -10
- package/dist/_node-chunks/{chunk-C5OFHB3N.js → chunk-IOXDHKFF.js} +7 -7
- package/dist/_node-chunks/chunk-J3CNNXKQ.js +11 -0
- package/dist/_node-chunks/{chunk-2U5J7YTA.js → chunk-JB4457FJ.js} +6 -6
- package/dist/_node-chunks/{chunk-VZG3OKFO.js → chunk-JHX35YKT.js} +6 -6
- package/dist/_node-chunks/{chunk-LAIED5XU.js → chunk-JKPKEYSH.js} +6 -6
- package/dist/_node-chunks/{chunk-NLLM4MDK.js → chunk-JMFTALJW.js} +6 -6
- package/dist/_node-chunks/{chunk-AKMPPLT5.js → chunk-JXS4P2RM.js} +7 -7
- package/dist/_node-chunks/{chunk-6UASHVMR.js → chunk-K2K6KTBC.js} +8 -8
- package/dist/_node-chunks/{chunk-S3NDLFYL.js → chunk-KMC5WWQS.js} +7 -7
- package/dist/_node-chunks/{chunk-BBU2FUPC.js → chunk-KQTFSKC6.js} +8 -8
- package/dist/_node-chunks/{chunk-3IIQSDCO.js → chunk-KZPWZM2E.js} +37 -34
- package/dist/_node-chunks/{chunk-7YQTID2W.js → chunk-LTJ4AYDM.js} +6 -6
- package/dist/_node-chunks/{chunk-32FLWHUC.js → chunk-MNNESU33.js} +497 -475
- package/dist/_node-chunks/{chunk-WBCKO5LP.js → chunk-MNQVVJZN.js} +6 -6
- package/dist/_node-chunks/{chunk-MBIVTOJK.js → chunk-NO7MF6VR.js} +6 -6
- package/dist/_node-chunks/{chunk-BSQB5B57.js → chunk-NPSIAK46.js} +6 -6
- package/dist/_node-chunks/{chunk-DGWKJQ6G.js → chunk-NUSHY22I.js} +62 -7
- package/dist/_node-chunks/{chunk-OJWUUSA4.js → chunk-NXRZL2PR.js} +6 -6
- package/dist/_node-chunks/{chunk-FEC5PGJO.js → chunk-O2CCUB5T.js} +7 -7
- package/dist/_node-chunks/{chunk-6UAJLEIO.js → chunk-ORSH2FXG.js} +6 -6
- package/dist/_node-chunks/{chunk-GYFR2JLS.js → chunk-OSNOV4EH.js} +7 -7
- package/dist/_node-chunks/{chunk-GTXZNA2L.js → chunk-PHB6QBHM.js} +10 -10
- package/dist/_node-chunks/{chunk-WO4UEQI6.js → chunk-POA32M7F.js} +21 -21
- package/dist/_node-chunks/{chunk-GO3YSBPE.js → chunk-Q64ESHBN.js} +8 -8
- package/dist/_node-chunks/{chunk-RNRGXAFV.js → chunk-QBWGJYHY.js} +6 -6
- package/dist/_node-chunks/{chunk-ZEYODVQT.js → chunk-QSKVNZCF.js} +7 -7
- package/dist/_node-chunks/{chunk-D5ADPGA4.js → chunk-QX6RXAEU.js} +6 -6
- package/dist/_node-chunks/{chunk-PQTEFQIJ.js → chunk-R73PEGQU.js} +9 -9
- package/dist/_node-chunks/{chunk-Z2ZTDQDY.js → chunk-RHH7VDIY.js} +8 -8
- package/dist/_node-chunks/{chunk-R7VDUSKY.js → chunk-RMJNWFPV.js} +9 -9
- package/dist/_node-chunks/{chunk-5GOXN5M4.js → chunk-RT2LVWTC.js} +7 -7
- package/dist/_node-chunks/{chunk-XCJ2ZIQ4.js → chunk-SPCPGRYF.js} +7 -7
- package/dist/_node-chunks/{chunk-Y4W4B3E7.js → chunk-SUHBBHKR.js} +6 -6
- package/dist/_node-chunks/{chunk-VKRGTLQJ.js → chunk-TXZTC6LA.js} +22 -22
- package/dist/_node-chunks/{chunk-XO54HM4P.js → chunk-U5HVQTHI.js} +6 -6
- package/dist/_node-chunks/{chunk-XICRXTTE.js → chunk-UFZUSE3Y.js} +6 -6
- package/dist/_node-chunks/{chunk-ALGQMFMN.js → chunk-UGQFYYBC.js} +6 -6
- package/dist/_node-chunks/{chunk-ER3X3AQ7.js → chunk-UKLCYEZU.js} +7 -7
- package/dist/_node-chunks/{chunk-J3SM62J3.js → chunk-VJEN2JM3.js} +8 -8
- package/dist/_node-chunks/{chunk-7IOSIYW2.js → chunk-W5ZAUN5R.js} +7 -7
- package/dist/_node-chunks/{chunk-MXLHIEXC.js → chunk-WNEWL2PL.js} +6 -6
- package/dist/_node-chunks/{chunk-CEYSYQLV.js → chunk-WUVQ465T.js} +6 -6
- package/dist/_node-chunks/{chunk-REIDJUVJ.js → chunk-XCNYQV2M.js} +19 -15
- package/dist/_node-chunks/{chunk-TKMXEHM4.js → chunk-XOAWAXUH.js} +7 -7
- package/dist/_node-chunks/chunk-Y472MP5U.js +281 -0
- package/dist/_node-chunks/{chunk-NFDQT7UW.js → chunk-ZCKTYMZT.js} +320 -316
- package/dist/_node-chunks/{chunk-5JLVSH44.js → chunk-ZUK5ZLPP.js} +8 -8
- package/dist/_node-chunks/dist-2DPC664Y.js +27 -0
- package/dist/_node-chunks/dist-XBFUDMFQ.js +16 -0
- package/dist/_node-chunks/{local-runtime-YDAW5RJV.js → local-runtime-Z667YPXR.js} +19 -20
- package/dist/_node-chunks/{mdx-plugin-XLDET5LV.js → mdx-plugin-BPRPTZNP.js} +13 -13
- package/dist/_node-chunks/{monorepo-NWMAHGOM.js → monorepo-GO54BY34.js} +11 -11
- package/dist/_node-chunks/{monorepo-optimized-tests-relaxed-limits-no-story-deletion-4B6IZ7JD.js → monorepo-optimized-tests-relaxed-limits-no-story-deletion-PEHFNJQ5.js} +11 -11
- package/dist/_node-chunks/optimized-tests-W7U4ZRWX.js +22 -0
- package/dist/_node-chunks/{pattern-copy-play-PJC4PO6A.js → pattern-copy-play-64HQIVWK.js} +9 -9
- package/dist/_node-chunks/postinstallAddon-XM2BHKDN.js +20 -0
- package/dist/_node-chunks/{rehype-external-links-4CWXZ35U.js → rehype-external-links-2BSEZ7AC.js} +9 -9
- package/dist/_node-chunks/{rehype-slug-QZ2PWSJH.js → rehype-slug-6253EA36.js} +9 -9
- package/dist/_node-chunks/{relaxed-limits-ZQR4ER7L.js → relaxed-limits-4PAAPG3J.js} +11 -11
- package/dist/_node-chunks/{run-BMXB2BW2.js → run-3SQW3FRF.js} +18 -18
- package/dist/_node-chunks/{run-U63AXEKZ.js → run-XJT3YVMZ.js} +16 -16
- package/dist/_node-chunks/{setup-NCUTUBNN.js → setup-JIYCTADZ.js} +8 -8
- package/dist/_node-chunks/{vitest.config.4.template-4XHF7XPS.js → vitest.config.4.template-W74SGWHT.js} +7 -7
- package/dist/actions/decorator.js +12 -20
- package/dist/addon-a11y/index.js +2 -2
- package/dist/addon-a11y/manager.js +11 -11
- package/dist/addon-a11y/preset.js +7 -7
- package/dist/addon-a11y/preview.js +2 -2
- package/dist/addon-docs/blocks.d.ts +10 -6
- package/dist/addon-docs/blocks.js +29 -31
- package/dist/addon-docs/index.js +3 -3
- package/dist/addon-docs/manager.js +3 -3
- package/dist/addon-docs/preset.js +10 -10
- package/dist/addon-docs/preview.js +1 -1
- package/dist/addon-links/preview.d.ts +1 -1
- package/dist/addon-mcp/preset.js +9 -9
- package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +15 -15
- package/dist/addon-ondevice-controls/index.js +1 -1
- package/dist/addon-ondevice-controls/register.js +1 -1
- package/dist/addon-pseudo-states/index.js +1 -1
- package/dist/addon-pseudo-states/preview.js +1 -1
- package/dist/addon-themes/postinstall.js +7 -7
- package/dist/addon-vitest/constants.js +8 -8
- package/dist/addon-vitest/manager.js +18 -9
- package/dist/addon-vitest/node/coverage-reporter.js +11 -11
- package/dist/addon-vitest/node/vitest.js +28 -28
- package/dist/addon-vitest/postinstall.js +10 -10
- package/dist/addon-vitest/preset.js +15 -15
- package/dist/addon-vitest/vitest-plugin/global-setup.js +21 -21
- package/dist/addon-vitest/vitest-plugin/index.js +68 -58
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +106 -88
- package/dist/bin/dispatcher.js +10 -10
- package/dist/bin/loader.js +8 -8
- package/dist/builder-vite/index.js +18 -18
- package/dist/builder-vite/preset.js +13 -13
- package/dist/channels/index.d.ts +1 -1
- package/dist/channels/index.js +1 -1
- package/dist/{chunk-Dr3R0DXk.d.ts → chunk-B-NVyPqN.d.ts} +2 -2
- package/dist/{chunk-Fg1Fm__9.d.ts → chunk-BmCH-L7_.d.ts} +393 -383
- package/dist/{chunk-CNqjcOmK.d.ts → chunk-Bn1RoGAP.d.ts} +1 -1
- package/dist/{chunk-BXLImeLy.d.ts → chunk-CfEntHiI.d.ts} +18 -3
- package/dist/{chunk-D0NUmzXp.d.ts → chunk-IMedIHPn.d.ts} +3 -3
- package/dist/{chunk-CYuvV2sR.d.ts → chunk-evfhuBNU.d.ts} +1 -1
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +25 -30
- package/dist/cli/tools/sdk/child-host.d.ts +1 -1
- package/dist/cli/tools/sdk/child-host.js +17 -17
- package/dist/cli/tools/sdk/index.d.ts +2 -2
- package/dist/cli/tools/sdk/index.js +18 -18
- package/dist/cli-commands/bin/index.js +7 -7
- package/dist/client-logger/index.js +2 -1
- package/dist/common/index.d.ts +5 -5
- package/dist/common/index.js +34 -35
- package/dist/components/index.d.ts +6 -6
- package/dist/components/index.js +154 -164
- package/dist/core-server/index.d.ts +5 -5
- package/dist/core-server/index.js +685 -152
- package/dist/core-server/presets/common-manager.js +229 -318
- package/dist/core-server/presets/common-override-preset.js +10 -10
- package/dist/core-server/presets/common-preset.js +73 -268
- package/dist/create/bin/index.js +7 -7
- package/dist/create/index.js +15 -15
- package/dist/csf/csf-utils.d.ts +1 -1
- package/dist/csf/index.d.ts +1 -1
- package/dist/csf/index.js +10 -10
- package/dist/csf-tools/index.d.ts +41 -37
- package/dist/csf-tools/index.js +13 -13
- package/dist/instrumenter/index.d.ts +1 -1
- package/dist/instrumenter/index.js +1 -1
- package/dist/manager/_manager-chunks/{globals-runtime-CHjExYMv.js → globals-runtime--RDllwDw.js} +629 -436
- package/dist/manager/_manager-chunks/{globals-runtime-DvV_TF3-.js → globals-runtime-B4NRbNSS.js} +2 -2
- package/dist/manager/_manager-chunks/{globals-runtime-wjkxyMn0.js → globals-runtime-BC43T1rL.js} +4150 -50
- package/dist/manager/_manager-chunks/{globals-runtime-C5gK7HhH.js → globals-runtime-BFVFUcji.js} +2 -2
- package/dist/manager/_manager-chunks/{globals-runtime-BSj0mCjE.js → globals-runtime-BWciJpaD.js} +94 -92
- package/dist/manager/_manager-chunks/{globals-runtime-CA8AuIRT.js → globals-runtime-BnQ7i5wq.js} +232 -228
- package/dist/manager/_manager-chunks/globals-runtime-BtduS2C2.js +10601 -0
- package/dist/manager/_manager-chunks/globals-runtime-BzuYs3dZ.js +1971 -0
- package/dist/manager/_manager-chunks/{globals-runtime-BY3epqww.js → globals-runtime-CS41oTca.js} +2 -1
- package/dist/manager/_manager-chunks/{globals-runtime-Bu9eGDTe.js → globals-runtime-CdLHkSK1.js} +260 -401
- package/dist/manager/_manager-chunks/globals-runtime-CoTrrHG3.js +1163 -0
- package/dist/manager/_manager-chunks/{globals-runtime-BweHuXkK.js → globals-runtime-DCmvKMN5.js} +2 -2
- package/dist/manager/_manager-chunks/globals-runtime-DgO0hT2p.js +32 -0
- package/dist/manager/_manager-chunks/{globals-runtime-C92M_Vnq.js → globals-runtime-DhygDQ09.js} +5 -5
- package/dist/manager/_manager-chunks/{globals-runtime-CCTA-XPa.js → globals-runtime-DweLlyBa.js} +5 -4
- package/dist/manager/_manager-chunks/globals-runtime-Me9Bl-sx.js +156 -0
- package/dist/manager/_manager-chunks/globals-runtime-nQMRiA0J.js +19 -0
- package/dist/manager/_manager-chunks/{globals-runtime-Bj5KDUJi.js → globals-runtime-oRjPg2jY.js} +1 -1
- package/dist/manager/_manager-chunks/{runtime-CJQZFUUj.js → runtime-1BcYUf7-.js} +26 -44
- package/dist/manager/_manager-chunks/{runtime-Dem2xJbS.js → runtime-B2VQIT0n.js} +739 -554
- package/dist/manager/_manager-chunks/runtime-BBaBlpAS.js +552 -0
- package/dist/manager/_manager-chunks/{runtime-DvB1axgp.js → runtime-BFgSyEE6.js} +13 -13
- package/dist/manager/_manager-chunks/{runtime-B6NL14pz.js → runtime-CE_oqcpl.js} +6 -6
- package/dist/manager/_manager-chunks/{runtime-BAsOe1C_.js → runtime-CRqm7NXD.js} +49 -49
- package/dist/manager/_manager-chunks/{runtime-EPerAEAs.js → runtime-CZtDJIYj.js} +3 -3
- package/dist/manager/_manager-chunks/{runtime-CgRqs_SK.js → runtime-D3Gk2bTl.js} +852 -841
- package/dist/manager/_manager-chunks/{runtime-Dtbhxq5m.js → runtime-Db8fJ2MP.js} +67 -500
- package/dist/manager/_manager-chunks/{runtime--hR2NZFd.js → runtime-Dj8tizGo.js} +103 -103
- package/dist/manager/globals-runtime.js +1 -1
- package/dist/manager/runtime.js +1 -1
- package/dist/manager-api/index.d.ts +1 -1
- package/dist/manager-api/index.js +444 -428
- package/dist/manager-errors.d.ts +1 -1
- package/dist/mcp/index.js +9 -9
- package/dist/mocking-utils/index.js +15 -19
- package/dist/nextjs-vite/export-mocks/router/index.js +1 -1
- package/dist/nextjs-vite/index.d.ts +1 -1
- package/dist/nextjs-vite/index.js +4 -4
- package/dist/nextjs-vite/node/index.js +7 -7
- package/dist/nextjs-vite/preset.js +12 -12
- package/dist/nextjs-vite/preview.js +1 -1
- package/dist/nextjs-vite/vite-plugin/index.d.ts +2 -2
- package/dist/nextjs-vite/vite-plugin/index.js +9 -9
- package/dist/nextjs-vite-plugin/index.js +15 -15
- package/dist/nextjs-vite-plugin/mocks/storybook.global.js +8 -8
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +1 -1
- package/dist/node-logger/index.d.ts +16 -16
- package/dist/node-logger/index.js +9 -9
- package/dist/oxc-parser/index.js +14 -11
- package/dist/oxc-parser/worker.js +10 -10
- package/dist/preview/_chunks/{runtime-BJwGQok8.js → runtime-4BNaFIif.js} +180 -21
- package/dist/preview/_chunks/{runtime-BUnOhg9h.js → runtime-BSJ0Ov_b.js} +2 -2
- package/dist/preview/_chunks/{runtime-BhSZ1Mwt.js → runtime-Bjm1gBLN.js} +6 -19
- package/dist/preview/_chunks/{runtime-Bcv1hJky.js → runtime-CBKlMZg2.js} +4148 -48
- package/dist/preview/_chunks/{runtime-BPwAnlRx.js → runtime-CElbz0uN.js} +1 -1
- package/dist/preview/_chunks/{runtime-BZ4pNS3g.js → runtime-C_nyb8QT.js} +3 -3
- package/dist/preview/_chunks/{runtime-BgPhfM5P.js → runtime-CzTPeFXg.js} +676 -376
- package/dist/preview/_chunks/{runtime-WapFVPAh.js → runtime-DZ7fvh0y.js} +1 -1
- package/dist/preview/runtime.js +1 -1
- package/dist/preview-api/index.d.ts +2 -2
- package/dist/preview-api/index.js +5 -5
- package/dist/preview-errors.d.ts +1 -1
- package/dist/react/docgen/docgen-worker.js +11 -11
- package/dist/react/entry-preview-argtypes.js +1 -1
- package/dist/react/entry-preview-docs.js +1 -1
- package/dist/react/entry-preview.js +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +5 -5
- package/dist/react/preset.js +13 -13
- package/dist/react/preview.js +4 -4
- package/dist/react-native/bin/get-stories.js +8 -8
- package/dist/react-native/index.d.ts +37 -36
- package/dist/react-native/index.js +30 -34
- package/dist/react-native/metro/node.d.ts +1 -1
- package/dist/react-native/metro/node.js +10 -10
- package/dist/react-native/metro/withForkbook.d.ts +7 -7
- package/dist/react-native/metro/withForkbook.js +14 -14
- package/dist/react-native/preview.js +4 -1
- package/dist/react-native/scripts/generate.js +8 -8
- package/dist/react-native/stub.js +1 -1
- package/dist/react-native-ui/index.d.ts +4 -3
- package/dist/react-native-ui/index.js +1 -8
- package/dist/react-native-ui-common/index.d.ts +7 -6
- package/dist/react-native-ui-common/index.js +6 -6
- package/dist/react-vite/node/index.js +7 -7
- package/dist/react-vite/preset.js +7 -7
- package/dist/server-errors.d.ts +1 -1
- package/dist/server-errors.js +9 -9
- package/dist/shared/open-service/index.d.ts +1 -1
- package/dist/shared/open-service/index.js +1 -1
- package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +9 -9
- package/dist/shared/open-service/toolsets/docs/public.d.ts +2 -2
- package/dist/telemetry/index.d.ts +38 -274
- package/dist/telemetry/index.js +11 -66
- package/dist/test/index.js +125 -112
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +2 -2
- package/package.json +15 -15
- package/template/nextjs-vite/cli/js/Button.jsx +2 -2
- package/template/nextjs-vite/cli/js/Header.jsx +1 -1
- package/template/nextjs-vite/cli/js/Page.jsx +1 -1
- package/template/nextjs-vite/cli/ts/Button.tsx +2 -2
- package/template/nextjs-vite/cli/ts/Header.tsx +1 -1
- package/template/nextjs-vite/cli/ts/Page.tsx +1 -1
- package/template/react/cli/js/Button.jsx +2 -2
- package/template/react/cli/js/Header.jsx +1 -1
- package/template/react/cli/js/Page.jsx +1 -1
- package/template/react/cli/ts/Button.tsx +2 -2
- package/template/react/cli/ts/Header.tsx +1 -1
- package/template/react/cli/ts/Page.tsx +1 -1
- package/template/react-vite/cli/js/Button.jsx +2 -2
- package/template/react-vite/cli/js/Header.jsx +1 -1
- package/template/react-vite/cli/js/Page.jsx +1 -1
- package/template/react-vite/cli/ts/Button.tsx +2 -2
- package/template/react-vite/cli/ts/Header.tsx +1 -1
- package/template/react-vite/cli/ts/Page.tsx +1 -1
- package/dist/_node-chunks/chunk-2YNXKY72.js +0 -40
- package/dist/_node-chunks/chunk-3NST2GUZ.js +0 -33
- package/dist/_node-chunks/chunk-4D325SMT.js +0 -1359
- package/dist/_node-chunks/chunk-APXRPW7A.js +0 -11
- package/dist/_node-chunks/chunk-QHBQRPDP.js +0 -155
- package/dist/_node-chunks/chunk-SMBAR4G6.js +0 -18
- package/dist/_node-chunks/chunk-SRDKK3SG.js +0 -33
- package/dist/_node-chunks/chunk-V5IMPC3J.js +0 -33
- package/dist/_node-chunks/chunk-YIAUHGY2.js +0 -69
- package/dist/_node-chunks/dist-C5QIQD3G.js +0 -27
- package/dist/_node-chunks/dist-NBRPZCHX.js +0 -16
- package/dist/_node-chunks/optimized-tests-EIPJR7HA.js +0 -22
- package/dist/_node-chunks/postinstallAddon-EOAAURMG.js +0 -20
- package/dist/_node-chunks/session-id-HEW5JUNB.js +0 -23
- package/dist/manager/_manager-chunks/globals-runtime-Bs75QQ_I.js +0 -9987
- package/dist/manager/_manager-chunks/globals-runtime-WZKaeKm9.js +0 -4091
- package/dist/manager/_manager-chunks/runtime-5o_11Jae.js +0 -78
- package/dist/preview/_chunks/runtime-BsMjBzuq.js +0 -53
- package/dist/preview/_chunks/runtime-C1jgT6tJ.js +0 -4091
- package/dist/preview/_chunks/runtime-CkOhMcXf.js +0 -387
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_enqaafxxjgh from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_enqaafxxjgh from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_enqaafxxjgh from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_enqaafxxjgh.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_enqaafxxjgh.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_enqaafxxjgh.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Forkbook's esbuild configuration
|
|
@@ -12,67 +12,61 @@ var require = CJS_COMPAT_NODE_MODULE_i135z88drol.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
UniversalStore,
|
|
14
14
|
instances
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6772LYNF.js";
|
|
16
16
|
import {
|
|
17
17
|
buildStoryPathMap,
|
|
18
18
|
toUrlPath
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BMM74ZQW.js";
|
|
20
20
|
import {
|
|
21
21
|
require_build
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
isI18nPackage,
|
|
25
|
-
isRouterPackage,
|
|
26
|
-
isStateManagementPackage,
|
|
27
|
-
isStylingPackage
|
|
28
|
-
} from "./chunk-QHBQRPDP.js";
|
|
22
|
+
} from "./chunk-KMC5WWQS.js";
|
|
29
23
|
import {
|
|
30
24
|
leven
|
|
31
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-FKI7K3GE.js";
|
|
32
26
|
import {
|
|
33
27
|
defineToolset
|
|
34
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-RT2LVWTC.js";
|
|
35
29
|
import {
|
|
36
30
|
getToolName,
|
|
37
31
|
toMcpToolName
|
|
38
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-OSNOV4EH.js";
|
|
39
33
|
import {
|
|
40
34
|
exec,
|
|
41
35
|
getComponentIdFromEntry,
|
|
42
36
|
optionalEnvToBoolean,
|
|
43
37
|
selectComponentEntriesByComponentId
|
|
44
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-KQTFSKC6.js";
|
|
45
39
|
import {
|
|
46
40
|
getService as getService2,
|
|
47
41
|
registerService
|
|
48
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-PHB6QBHM.js";
|
|
49
43
|
import {
|
|
50
44
|
getRegisteredServices,
|
|
51
45
|
getService
|
|
52
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-3X67K6EI.js";
|
|
53
47
|
import {
|
|
54
48
|
isEqual,
|
|
55
49
|
isPlainObject
|
|
56
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-SPCPGRYF.js";
|
|
57
51
|
import {
|
|
58
52
|
Tag
|
|
59
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-QBWGJYHY.js";
|
|
60
54
|
import {
|
|
61
55
|
CHANGE_DETECTION_STATUS_TYPE_ID,
|
|
62
56
|
UNIVERSAL_STATUS_STORE_OPTIONS,
|
|
63
57
|
createStatusStore
|
|
64
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-FAR3NIPG.js";
|
|
65
59
|
import {
|
|
66
60
|
invariant
|
|
67
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-JKPKEYSH.js";
|
|
68
62
|
import {
|
|
69
63
|
importModule,
|
|
70
64
|
resolveModulePath,
|
|
71
65
|
resolvePackageDir
|
|
72
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-XOAWAXUH.js";
|
|
73
67
|
import {
|
|
74
68
|
jsTsSourceExtensions
|
|
75
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-JHX35YKT.js";
|
|
76
70
|
import {
|
|
77
71
|
OpenServiceDocgenMissingComponentError,
|
|
78
72
|
OpenServiceMissingOriginError,
|
|
@@ -81,22 +75,19 @@ import {
|
|
|
81
75
|
OpenServiceUnknownStoryIdsError,
|
|
82
76
|
StorybookError,
|
|
83
77
|
describeUnknownStoryIds
|
|
84
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-MNNESU33.js";
|
|
85
79
|
import {
|
|
86
80
|
require_picocolors
|
|
87
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-O2CCUB5T.js";
|
|
88
82
|
import {
|
|
89
83
|
errorToErrorLike,
|
|
90
84
|
reverseIndexToStoriesByFile,
|
|
91
85
|
toStoryIndexPath
|
|
92
|
-
} from "./chunk-
|
|
93
|
-
import {
|
|
94
|
-
glob
|
|
95
|
-
} from "./chunk-6UASHVMR.js";
|
|
86
|
+
} from "./chunk-UKLCYEZU.js";
|
|
96
87
|
import {
|
|
97
88
|
__commonJS,
|
|
98
89
|
__toESM
|
|
99
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-MNQVVJZN.js";
|
|
100
91
|
|
|
101
92
|
// ../../node_modules/map-or-similar/src/similar.js
|
|
102
93
|
var require_similar = __commonJS({
|
|
@@ -161,10 +152,10 @@ var require_memoizerific = __commonJS({
|
|
|
161
152
|
"../../node_modules/memoizerific/src/memoizerific.js"(exports, module) {
|
|
162
153
|
var MapOrSimilar = require_map_or_similar();
|
|
163
154
|
module.exports = function(limit) {
|
|
164
|
-
var
|
|
155
|
+
var cache4 = new MapOrSimilar(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP === "true"), lru = [];
|
|
165
156
|
return function(fn) {
|
|
166
157
|
var memoizerific = function() {
|
|
167
|
-
var currentCache =
|
|
158
|
+
var currentCache = cache4, newMap, fnResult, argsLengthMinusOne = arguments.length - 1, lruPath = Array(argsLengthMinusOne + 1), isMemoized = !0, i;
|
|
168
159
|
if ((memoizerific.numArgs || memoizerific.numArgs === 0) && memoizerific.numArgs !== argsLengthMinusOne + 1)
|
|
169
160
|
throw new Error("Memoizerific functions should always be called with the same number of arguments");
|
|
170
161
|
for (i = 0; i < argsLengthMinusOne; i++) {
|
|
@@ -182,7 +173,7 @@ var require_memoizerific = __commonJS({
|
|
|
182
173
|
arg: arguments[argsLengthMinusOne]
|
|
183
174
|
}, isMemoized ? moveToMostRecentLru(lru, lruPath) : lru.push(lruPath), lru.length > limit && removeCachedResult(lru.shift())), memoizerific.wasMemoized = isMemoized, memoizerific.numArgs = argsLengthMinusOne + 1, fnResult;
|
|
184
175
|
};
|
|
185
|
-
return memoizerific.limit = limit, memoizerific.wasMemoized = !1, memoizerific.cache =
|
|
176
|
+
return memoizerific.limit = limit, memoizerific.wasMemoized = !1, memoizerific.cache = cache4, memoizerific.lru = lru, memoizerific;
|
|
186
177
|
};
|
|
187
178
|
};
|
|
188
179
|
function moveToMostRecentLru(lru, lruPath) {
|
|
@@ -312,7 +303,7 @@ import { isAbsolute as isAbsolute2, join as join2 } from "node:path";
|
|
|
312
303
|
import { pathToFileURL } from "node:url";
|
|
313
304
|
import { MissingBuilderError } from "@aussieljk/forkbook/internal/server-errors";
|
|
314
305
|
async function getManagerBuilder() {
|
|
315
|
-
return await import("./builder-manager-
|
|
306
|
+
return await import("./builder-manager-UPXA2KKT.js");
|
|
316
307
|
}
|
|
317
308
|
async function getPreviewBuilder(resolvedPreviewBuilder) {
|
|
318
309
|
let packageJson = join2(resolvedPreviewBuilder, "package.json");
|
|
@@ -466,12 +457,12 @@ function hasMdxRef(entry) {
|
|
|
466
457
|
return typeof entry?.mdx?.$ref == "string";
|
|
467
458
|
}
|
|
468
459
|
function createDiskLoader(outputDir) {
|
|
469
|
-
let
|
|
460
|
+
let cache4 = /* @__PURE__ */ new Map();
|
|
470
461
|
return (relativePath) => {
|
|
471
|
-
let pending =
|
|
462
|
+
let pending = cache4.get(relativePath);
|
|
472
463
|
return pending || (pending = readFile3(join4(outputDir, "manifests", relativePath), "utf8").then(
|
|
473
464
|
(raw) => JSON.parse(raw)
|
|
474
|
-
),
|
|
465
|
+
), cache4.set(relativePath, pending)), pending;
|
|
475
466
|
};
|
|
476
467
|
}
|
|
477
468
|
function createServiceLoader(mdxPayloads) {
|
|
@@ -553,133 +544,389 @@ async function loadMdxPayloadsFromServiceIfNeeded(manifests, docsManifest) {
|
|
|
553
544
|
}
|
|
554
545
|
|
|
555
546
|
// src/core-server/utils/manifests/render-components-manifest.ts
|
|
556
|
-
import path from "node:path";
|
|
557
547
|
import { groupBy } from "@aussieljk/forkbook/internal/common";
|
|
548
|
+
|
|
549
|
+
// src/core-server/utils/manifests/components-manifest-cards.ts
|
|
550
|
+
import path from "node:path";
|
|
558
551
|
function storyEntries(stories) {
|
|
559
552
|
return Array.isArray(stories) ? stories : Object.values(stories ?? {});
|
|
560
553
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
)
|
|
565
|
-
|
|
566
|
-
)
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
--chip: #1f2330;
|
|
614
|
-
--border: #2b2f3a;
|
|
615
|
-
--link: #8ab4f8;
|
|
616
|
-
--active-ring: 1px; /* 1px active ring for pills and toggles */
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
* {
|
|
620
|
-
box-sizing: border-box;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
html,
|
|
624
|
-
body {
|
|
625
|
-
margin: 0;
|
|
626
|
-
background: var(--bg);
|
|
627
|
-
color: var(--fg);
|
|
628
|
-
font: 14px/1.5 system-ui,
|
|
629
|
-
-apple-system,
|
|
630
|
-
Segoe UI,
|
|
631
|
-
Roboto,
|
|
632
|
-
Ubuntu,
|
|
633
|
-
Cantarell,
|
|
634
|
-
'Helvetica Neue',
|
|
635
|
-
Arial,
|
|
636
|
-
'Noto Sans';
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
.wrap {
|
|
640
|
-
max-width: 1100px;
|
|
641
|
-
margin: 0 auto;
|
|
642
|
-
padding: 16px 20px;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
header {
|
|
646
|
-
position: sticky;
|
|
647
|
-
top: 0;
|
|
648
|
-
backdrop-filter: blur(6px);
|
|
649
|
-
background: color-mix(in srgb, var(--bg) 84%, transparent);
|
|
650
|
-
border-bottom: 1px solid var(--border);
|
|
651
|
-
z-index: 10;
|
|
652
|
-
}
|
|
554
|
+
var esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c] ?? c), plural = (n, one, many = `${one}s`) => n === 1 ? one : many;
|
|
555
|
+
function analyzeComponent(c) {
|
|
556
|
+
let api = resolveComponentApi(c), hasApiError = api.kind === "error", warns = [];
|
|
557
|
+
c.description?.trim() || warns.push("No description found. Write a jsdoc comment such as /** Component description */."), c.import?.trim() || warns.push(
|
|
558
|
+
`Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
|
|
559
|
+
);
|
|
560
|
+
let allStories = storyEntries(c.stories), totalStories = allStories.length, storyErrors = allStories.filter((e) => !!e?.error).length, storyWarnings = allStories.filter((e) => !!e?.warning).length, storyOk = totalStories - storyErrors, docsEntries = c.docs ? Object.values(c.docs) : [], totalDocs = docsEntries.length, docsErrors = docsEntries.filter((d) => !!d?.error).length, docsOk = totalDocs - docsErrors, hasAnyError = hasApiError || storyErrors > 0 || docsErrors > 0;
|
|
561
|
+
return {
|
|
562
|
+
api,
|
|
563
|
+
hasApiError,
|
|
564
|
+
hasAnyError,
|
|
565
|
+
hasWarns: warns.length > 0,
|
|
566
|
+
warns,
|
|
567
|
+
totalStories,
|
|
568
|
+
storyErrors,
|
|
569
|
+
storyWarnings,
|
|
570
|
+
storyOk,
|
|
571
|
+
totalDocs,
|
|
572
|
+
docsErrors,
|
|
573
|
+
docsOk
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
function analyzeDoc(d) {
|
|
577
|
+
return {
|
|
578
|
+
hasError: !!d.error
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
function note(title, bodyHTML, kind) {
|
|
582
|
+
return `
|
|
583
|
+
<div class="note ${kind}">
|
|
584
|
+
<div class="note-title">${esc(title)}</div>
|
|
585
|
+
<div class="note-body">${bodyHTML}</div>
|
|
586
|
+
</div>`;
|
|
587
|
+
}
|
|
588
|
+
function renderDocCard(key, d, id) {
|
|
589
|
+
let a = analyzeDoc(d), statusDot = a.hasError ? "dot-err" : "dot-ok", slug = `${id}-${(d.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, errorBadge = a.hasError ? `<label for="${slug}-err" class="badge err as-toggle">error</label>` : "", contentBadge = d.content ? `<label for="${slug}-content" class="badge ok as-toggle">view content</label>` : "";
|
|
590
|
+
return `
|
|
591
|
+
<article
|
|
592
|
+
class="card is-doc ${a.hasError ? "has-doc-error" : "no-doc-error"}"
|
|
593
|
+
role="listitem"
|
|
594
|
+
aria-label="${esc(d.name || key)}">
|
|
595
|
+
<div class="head">
|
|
596
|
+
<div class="title">
|
|
597
|
+
<h2><span class="status-dot ${statusDot}"></span> ${esc(d.title || d.name || key)}</h2>
|
|
598
|
+
<div class="badges">
|
|
599
|
+
${errorBadge}
|
|
600
|
+
${contentBadge}
|
|
601
|
+
</div>
|
|
602
|
+
</div>
|
|
603
|
+
<div class="meta" title="${esc(d.path ?? d.id)}">${d.path ? `${esc(d.id)} \xB7 ${esc(d.path)}` : esc(d.id)}</div>
|
|
604
|
+
${d.summary ? `<div>${esc(d.summary)}</div>` : ""}
|
|
605
|
+
</div>
|
|
653
606
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
}
|
|
607
|
+
<!-- Hidden toggles must be siblings BEFORE .panels -->
|
|
608
|
+
${a.hasError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
|
|
609
|
+
${d.content ? `<input id="${slug}-content" class="tg tg-content" type="checkbox" hidden />` : ""}
|
|
658
610
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
611
|
+
<div class="panels">
|
|
612
|
+
${a.hasError ? `
|
|
613
|
+
<div class="panel panel-err">
|
|
614
|
+
<div class="note err">
|
|
615
|
+
<div class="note-title">${esc(d.error?.name || "Error")}</div>
|
|
616
|
+
<div class="note-body"><pre><code>${esc(d.error?.message || "Unknown error")}</code></pre></div>
|
|
617
|
+
</div>
|
|
618
|
+
</div>` : ""}
|
|
619
|
+
${d.content ? `
|
|
620
|
+
<div class="panel panel-content">
|
|
621
|
+
<div class="mdx-content">
|
|
622
|
+
<pre><code>${esc(d.content)}</code></pre>
|
|
623
|
+
</div>
|
|
624
|
+
</div>` : ""}
|
|
625
|
+
</div>
|
|
626
|
+
</article>`;
|
|
627
|
+
}
|
|
628
|
+
function renderComponentCard(key, c, id, anchorId) {
|
|
629
|
+
let a = analyzeComponent(c), statusDot = a.hasAnyError ? "dot-err" : "dot-ok", allStories = storyEntries(c.stories), errorStories = allStories.filter((ex) => !!ex?.error), okStories = allStories.filter((ex) => !ex?.error), subcomponentEntries = Object.entries(c.subcomponents ?? {}), allDocs = c.docs ? Object.values(c.docs) : [], errorDocs = allDocs.filter((d) => !!d?.error), okDocs = allDocs.filter((d) => !d?.error), slug = `c-${id}-${(c.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, { api } = a, primaryBadge = api.kind === "error" ? `<label for="${slug}-err" class="badge err as-toggle">API error</label>` : api.kind === "markdown" ? `<label for="${slug}-props" class="badge ok as-toggle">API description</label>` : api.kind === "props" ? `<label for="${slug}-props" class="badge ok as-toggle">${api.entries.length} ${plural(api.entries.length, "prop type")}</label>` : '<span class="badge">no API description</span>', infosBadge = a.hasWarns ? `<label for="${slug}-info" class="badge info as-toggle">${a.warns.length} ${plural(a.warns.length, "info", "infos")}</label>` : "", storiesBadge = a.totalStories > 0 ? `<label for="${slug}-stories" class="badge ${a.storyErrors > 0 ? "err" : "ok"} as-toggle">${a.storyErrors > 0 ? `${a.storyErrors}/${a.totalStories} story errors` : `${a.totalStories} ${plural(a.totalStories, "story", "stories")}`}${a.storyWarnings > 0 ? ` \xB7 ${a.storyWarnings} incomplete` : ""}</label>` : "", docsBadge = a.totalDocs > 0 ? `<label for="${slug}-docs" class="badge ${a.docsErrors > 0 ? "err" : "ok"} as-toggle">${a.docsErrors > 0 ? `${a.docsErrors}/${a.totalDocs} doc errors` : `${a.totalDocs} ${plural(a.totalDocs, "doc")}`}</label>` : "", subcomponentsBadge = subcomponentEntries.length > 0 ? `<label for="${slug}-subcomponents" class="badge ok as-toggle">${subcomponentEntries.length} ${plural(subcomponentEntries.length, "subcomponent")}</label>` : "", apiPanel = api.kind === "markdown" ? `
|
|
630
|
+
<div class="panel panel-props">
|
|
631
|
+
<div class="note ok">
|
|
632
|
+
<div class="row">
|
|
633
|
+
<span class="ex-name">API description</span>
|
|
634
|
+
${c.renderer ? `<span class="badge ok">${esc(c.renderer)}</span>` : ""}
|
|
635
|
+
</div>
|
|
636
|
+
<pre><code>${esc(api.markdown)}</code></pre>
|
|
637
|
+
</div>
|
|
638
|
+
</div>` : api.kind === "props" ? `
|
|
639
|
+
<div class="panel panel-props">
|
|
640
|
+
<div class="note ok">
|
|
641
|
+
<div class="row">
|
|
642
|
+
<span class="ex-name">Prop types <small>(${api.engine})</small></span>
|
|
643
|
+
<span class="badge ok">${api.entries.length} ${plural(api.entries.length, "prop type")}</span>
|
|
644
|
+
</div>
|
|
645
|
+
<pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}</code></pre>
|
|
646
|
+
<pre><code>Props:</code></pre>
|
|
647
|
+
<pre><code>${esc(renderPropsCode(api.entries))}</code></pre>
|
|
648
|
+
</div>
|
|
649
|
+
</div>` : "", tags = c.jsDocTags && typeof c.jsDocTags == "object" ? Object.entries(c.jsDocTags).flatMap(
|
|
650
|
+
([k, v10]) => (Array.isArray(v10) ? v10 : [v10]).map(
|
|
651
|
+
(val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
|
|
652
|
+
)
|
|
653
|
+
).join("") : "";
|
|
654
|
+
return `
|
|
655
|
+
<article
|
|
656
|
+
${anchorId ? `id="${esc(anchorId)}"` : ""}
|
|
657
|
+
class="card
|
|
658
|
+
${a.hasApiError ? "has-error" : "no-error"}
|
|
659
|
+
${a.hasWarns ? "has-info" : "no-info"}
|
|
660
|
+
${a.storyErrors ? "has-story-error" : "no-story-error"}
|
|
661
|
+
${a.storyWarnings ? "has-story-warning" : "no-story-warning"}
|
|
662
|
+
${api.kind === "none" ? "missing-api" : ""}
|
|
663
|
+
${a.docsErrors ? "has-doc-error" : "no-doc-error"}"
|
|
664
|
+
role="listitem"
|
|
665
|
+
aria-label="${esc(c.name || key)}">
|
|
666
|
+
<div class="head">
|
|
667
|
+
<div class="title">
|
|
668
|
+
<h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
|
|
669
|
+
<div class="badges">
|
|
670
|
+
${primaryBadge}
|
|
671
|
+
${infosBadge}
|
|
672
|
+
${storiesBadge}
|
|
673
|
+
${docsBadge}
|
|
674
|
+
${subcomponentsBadge}
|
|
675
|
+
</div>
|
|
676
|
+
</div>
|
|
677
|
+
<div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
|
|
678
|
+
${c.summary ? `<div>${esc(c.summary)}</div>` : ""}
|
|
679
|
+
${c.description ? `<div class="hint">${esc(c.description)}</div>` : ""}
|
|
680
|
+
${tags ? `<div class="kv">${tags}</div>` : ""}
|
|
681
|
+
</div>
|
|
665
682
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
border-radius: 999px;
|
|
674
|
-
background: var(--panel);
|
|
675
|
-
text-decoration: none;
|
|
676
|
-
cursor: pointer;
|
|
677
|
-
user-select: none;
|
|
678
|
-
color: var(--fg);
|
|
679
|
-
}
|
|
683
|
+
<!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
|
|
684
|
+
${api.kind === "error" ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
|
|
685
|
+
${a.hasWarns ? `<input id="${slug}-info" class="tg tg-info" type="checkbox" hidden />` : ""}
|
|
686
|
+
${a.totalStories > 0 ? `<input id="${slug}-stories" class="tg tg-stories" type="checkbox" hidden />` : ""}
|
|
687
|
+
${a.totalDocs > 0 ? `<input id="${slug}-docs" class="tg tg-docs" type="checkbox" hidden />` : ""}
|
|
688
|
+
${subcomponentEntries.length > 0 ? `<input id="${slug}-subcomponents" class="tg tg-subcomponents" type="checkbox" hidden />` : ""}
|
|
689
|
+
${apiPanel ? `<input id="${slug}-props" class="tg tg-props" type="checkbox" hidden />` : ""}
|
|
680
690
|
|
|
681
|
-
|
|
682
|
-
|
|
691
|
+
<div class="panels">
|
|
692
|
+
${api.kind === "error" ? `
|
|
693
|
+
<div class="panel panel-err">
|
|
694
|
+
${note("API error", `<pre><code>${esc(api.message)}</code></pre>`, "err")}
|
|
695
|
+
</div>` : ""}
|
|
696
|
+
${a.hasWarns ? `
|
|
697
|
+
<div class="panel panel-info">
|
|
698
|
+
${a.warns.map((w) => note("Info", esc(w), "info")).join("")}
|
|
699
|
+
</div>` : ""}
|
|
700
|
+
${apiPanel}
|
|
701
|
+
${a.totalStories > 0 ? `
|
|
702
|
+
<div class="panel panel-stories">
|
|
703
|
+
${errorStories.map(
|
|
704
|
+
(ex) => `
|
|
705
|
+
<div class="note err">
|
|
706
|
+
<div class="row">
|
|
707
|
+
<span class="ex-name">${esc(ex.name)}</span>
|
|
708
|
+
<span class="badge err">story error</span>
|
|
709
|
+
${ex?.warning ? '<span class="badge info">incomplete example</span>' : ""}
|
|
710
|
+
</div>
|
|
711
|
+
${ex?.summary ? `<div class="hint">Summary: ${esc(ex.summary)}</div>` : ""}
|
|
712
|
+
${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
|
|
713
|
+
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
714
|
+
${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
|
|
715
|
+
${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
|
|
716
|
+
</div>`
|
|
717
|
+
).join("")}
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
${c.import ? `<div class="note ok">
|
|
721
|
+
<div class="row">
|
|
722
|
+
<span class="ex-name">Imports</span>
|
|
723
|
+
</div>
|
|
724
|
+
<pre><code>${c.import}</code></pre>
|
|
725
|
+
</div>` : ""}
|
|
726
|
+
|
|
727
|
+
${okStories.map(
|
|
728
|
+
(ex) => `
|
|
729
|
+
<div class="note ok">
|
|
730
|
+
<div class="row">
|
|
731
|
+
<span class="ex-name">${esc(ex.name)}</span>
|
|
732
|
+
<span class="badge ${ex?.warning ? "info" : "ok"}">${ex?.warning ? "incomplete example" : "story ok"}</span>
|
|
733
|
+
</div>
|
|
734
|
+
${ex?.summary ? `<div>${esc(ex.summary)}</div>` : ""}
|
|
735
|
+
${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
|
|
736
|
+
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
737
|
+
${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
|
|
738
|
+
</div>`
|
|
739
|
+
).join("")}
|
|
740
|
+
</div>` : ""}
|
|
741
|
+
${a.totalDocs > 0 ? `
|
|
742
|
+
<div class="panel panel-docs">
|
|
743
|
+
${errorDocs.map(
|
|
744
|
+
(doc) => `
|
|
745
|
+
<div class="note err">
|
|
746
|
+
<div class="row">
|
|
747
|
+
<span class="ex-name">${esc(doc.name)}</span>
|
|
748
|
+
<span class="badge err">doc error</span>
|
|
749
|
+
</div>
|
|
750
|
+
${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
|
|
751
|
+
${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
|
|
752
|
+
${doc?.error?.message ? `<pre><code>${esc(doc.error.message)}</code></pre>` : ""}
|
|
753
|
+
</div>`
|
|
754
|
+
).join("")}
|
|
755
|
+
${okDocs.map(
|
|
756
|
+
(doc) => `
|
|
757
|
+
<div class="note ok">
|
|
758
|
+
<div class="row">
|
|
759
|
+
<span class="ex-name">${esc(doc.name)}</span>
|
|
760
|
+
<span class="badge ok">doc ok</span>
|
|
761
|
+
</div>
|
|
762
|
+
${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
|
|
763
|
+
${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
|
|
764
|
+
${doc?.content ? `<div class="mdx-content"><pre><code>${esc(doc.content)}</code></pre></div>` : ""}
|
|
765
|
+
</div>`
|
|
766
|
+
).join("")}
|
|
767
|
+
</div>` : ""}
|
|
768
|
+
${subcomponentEntries.length > 0 ? `
|
|
769
|
+
<div class="panel panel-subcomponents">
|
|
770
|
+
${subcomponentEntries.map(
|
|
771
|
+
([subcomponentName, subcomponent]) => renderSubcomponentNote(subcomponentName, subcomponent)
|
|
772
|
+
).join("")}
|
|
773
|
+
</div>` : ""}
|
|
774
|
+
</div>
|
|
775
|
+
</article>`;
|
|
776
|
+
}
|
|
777
|
+
var docgenRenderData = (component) => component.reactComponentMeta ? {
|
|
778
|
+
parsed: parseReactComponentMeta(component.reactComponentMeta),
|
|
779
|
+
engine: "react-component-meta",
|
|
780
|
+
filePath: component.reactComponentMeta.filePath,
|
|
781
|
+
exportName: component.reactComponentMeta.exportName
|
|
782
|
+
} : {};
|
|
783
|
+
function resolveComponentApi(component) {
|
|
784
|
+
if (component.error)
|
|
785
|
+
return { kind: "error", message: component.error.message || "Unknown error" };
|
|
786
|
+
let markdown = component.apiDescription?.trim();
|
|
787
|
+
if (markdown)
|
|
788
|
+
return { kind: "markdown", markdown };
|
|
789
|
+
let { parsed, ...source } = docgenRenderData(component), entries = Object.entries(parsed?.props ?? {}).sort(([a], [b]) => a.localeCompare(b));
|
|
790
|
+
return entries.length > 0 ? { kind: "props", entries, ...source } : { kind: "none" };
|
|
791
|
+
}
|
|
792
|
+
function renderPropsCode(entries) {
|
|
793
|
+
return entries.map(([propName, info]) => {
|
|
794
|
+
let description8 = (info?.description ?? "").trim(), type = (info?.type ?? "any").trim(), optional7 = info?.required ? "" : "?", defaultValue = (info?.defaultValue ?? "").trim(), fallback = defaultValue ? ` = ${defaultValue}` : "", doc = ["/**", ...description8.split(`
|
|
795
|
+
`).map((line) => ` * ${line}`), " */"].join(`
|
|
796
|
+
`) + `
|
|
797
|
+
`;
|
|
798
|
+
return `${description8 ? doc : ""}${propName}${optional7}: ${type}${fallback}`;
|
|
799
|
+
}).join(`
|
|
800
|
+
|
|
801
|
+
`);
|
|
802
|
+
}
|
|
803
|
+
function renderSubcomponentNote(subcomponentName, subcomponent) {
|
|
804
|
+
let api = resolveComponentApi(subcomponent), tags = subcomponent.jsDocTags && typeof subcomponent.jsDocTags == "object" ? Object.entries(subcomponent.jsDocTags).flatMap(
|
|
805
|
+
([key, value]) => (Array.isArray(value) ? value : [value]).map(
|
|
806
|
+
(tagValue) => `<span class="chip">${esc(key)}: ${esc(tagValue)}</span>`
|
|
807
|
+
)
|
|
808
|
+
).join("") : "", badgeLabel = api.kind === "error" ? "API error" : api.kind === "markdown" ? "API description" : api.kind === "props" ? `${api.entries.length} ${plural(api.entries.length, "prop type")}` : "no API description";
|
|
809
|
+
return `
|
|
810
|
+
<div class="note ${api.kind === "error" ? "err" : "ok"}">
|
|
811
|
+
<div class="row">
|
|
812
|
+
<span class="ex-name">${esc(subcomponentName)}</span>
|
|
813
|
+
<span class="badge ${api.kind === "error" ? "err" : api.kind === "none" ? "" : "ok"}">
|
|
814
|
+
${badgeLabel}
|
|
815
|
+
</span>
|
|
816
|
+
</div>
|
|
817
|
+
<div class="hint">${esc(subcomponent.path)}</div>
|
|
818
|
+
${subcomponent.summary ? `<div>${esc(subcomponent.summary)}</div>` : ""}
|
|
819
|
+
${subcomponent.description ? `<div class="hint">${esc(subcomponent.description)}</div>` : ""}
|
|
820
|
+
${tags ? `<div class="kv">${tags}</div>` : ""}
|
|
821
|
+
${subcomponent.import ? `<pre><code>${esc(subcomponent.import)}</code></pre>` : ""}
|
|
822
|
+
${api.kind === "error" ? `<pre><code>${esc(api.message)}</code></pre>` : ""}
|
|
823
|
+
${api.kind === "markdown" ? `<pre><code>${esc(api.markdown)}</code></pre>` : ""}
|
|
824
|
+
${api.kind === "props" ? `
|
|
825
|
+
<pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}${api.engine ? ` (${esc(api.engine)})` : ""}</code></pre>
|
|
826
|
+
<pre><code>${esc(renderPropsCode(api.entries))}</code></pre>` : ""}
|
|
827
|
+
</div>
|
|
828
|
+
`;
|
|
829
|
+
}
|
|
830
|
+
var parseReactComponentMeta = (reactComponentMeta) => {
|
|
831
|
+
let props = reactComponentMeta.props ?? {};
|
|
832
|
+
return {
|
|
833
|
+
props: Object.fromEntries(
|
|
834
|
+
Object.entries(props).map(([propName, prop]) => [
|
|
835
|
+
propName,
|
|
836
|
+
{
|
|
837
|
+
description: prop.description,
|
|
838
|
+
type: prop.type?.raw ?? prop.type?.name,
|
|
839
|
+
defaultValue: prop.defaultValue?.value,
|
|
840
|
+
required: prop.required
|
|
841
|
+
}
|
|
842
|
+
])
|
|
843
|
+
)
|
|
844
|
+
};
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
// src/core-server/utils/manifests/components-manifest-styles.ts
|
|
848
|
+
var componentsManifestCss = `
|
|
849
|
+
:root {
|
|
850
|
+
--bg: #0b0c10;
|
|
851
|
+
--panel: #121318;
|
|
852
|
+
--muted: #9aa0a6;
|
|
853
|
+
--fg: #e8eaed;
|
|
854
|
+
--ok: #22c55e;
|
|
855
|
+
--info: #1e88e5;
|
|
856
|
+
--err: #c62828;
|
|
857
|
+
--ok-bg: #0c1a13;
|
|
858
|
+
--info-bg: #0c1624;
|
|
859
|
+
--err-bg: #1a0e0e;
|
|
860
|
+
--chip: #1f2330;
|
|
861
|
+
--border: #2b2f3a;
|
|
862
|
+
--link: #8ab4f8;
|
|
863
|
+
--active-ring: 1px; /* 1px active ring for pills and toggles */
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
* {
|
|
867
|
+
box-sizing: border-box;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
html,
|
|
871
|
+
body {
|
|
872
|
+
margin: 0;
|
|
873
|
+
background: var(--bg);
|
|
874
|
+
color: var(--fg);
|
|
875
|
+
font: 14px/1.5 system-ui,
|
|
876
|
+
-apple-system,
|
|
877
|
+
Segoe UI,
|
|
878
|
+
Roboto,
|
|
879
|
+
Ubuntu,
|
|
880
|
+
Cantarell,
|
|
881
|
+
'Helvetica Neue',
|
|
882
|
+
Arial,
|
|
883
|
+
'Noto Sans';
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
.wrap {
|
|
887
|
+
max-width: 1100px;
|
|
888
|
+
margin: 0 auto;
|
|
889
|
+
padding: 16px 20px;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
header {
|
|
893
|
+
position: sticky;
|
|
894
|
+
top: 0;
|
|
895
|
+
backdrop-filter: blur(6px);
|
|
896
|
+
background: color-mix(in srgb, var(--bg) 84%, transparent);
|
|
897
|
+
border-bottom: 1px solid var(--border);
|
|
898
|
+
z-index: 10;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
h1 {
|
|
902
|
+
font-size: 20px;
|
|
903
|
+
margin: 0 0 6px;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
.summary {
|
|
907
|
+
display: flex;
|
|
908
|
+
gap: 12px;
|
|
909
|
+
flex-wrap: wrap;
|
|
910
|
+
align-items: center;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/* Top filter pills */
|
|
914
|
+
.filter-pill {
|
|
915
|
+
display: inline-flex;
|
|
916
|
+
align-items: center;
|
|
917
|
+
gap: 6px;
|
|
918
|
+
padding: 6px 12px;
|
|
919
|
+
border: 1px solid var(--border);
|
|
920
|
+
border-radius: 999px;
|
|
921
|
+
background: var(--panel);
|
|
922
|
+
text-decoration: none;
|
|
923
|
+
cursor: pointer;
|
|
924
|
+
user-select: none;
|
|
925
|
+
color: var(--fg);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
.filter-pill.ok {
|
|
929
|
+
color: #b9f6ca;
|
|
683
930
|
border-color: color-mix(in srgb, var(--ok) 55%, var(--border));
|
|
684
931
|
background: color-mix(in srgb, var(--ok) 18%, #000);
|
|
685
932
|
}
|
|
@@ -1199,336 +1446,89 @@ function renderComponentsManifest(manifest, docsManifest) {
|
|
|
1199
1446
|
overflow-y: auto;
|
|
1200
1447
|
margin-top: 8px;
|
|
1201
1448
|
}
|
|
1202
|
-
</style>
|
|
1203
|
-
</head>
|
|
1204
|
-
<body>
|
|
1205
|
-
<!-- Hidden targets for the top-level filters -->
|
|
1206
|
-
<span id="filter-all"></span>
|
|
1207
|
-
<span id="filter-errors"></span>
|
|
1208
|
-
<span id="filter-infos"></span>
|
|
1209
|
-
<span id="filter-story-errors"></span>
|
|
1210
|
-
<span id="filter-story-warnings"></span>
|
|
1211
|
-
<span id="filter-no-api"></span>
|
|
1212
|
-
<span id="filter-doc-errors"></span>
|
|
1213
|
-
<span id="filter-docs"></span>
|
|
1214
|
-
<header>
|
|
1215
|
-
<div class="wrap">
|
|
1216
|
-
<h1>Manifest Debugger</h1>
|
|
1217
|
-
<div class="summary">${allPill}${compErrorsPill}${compInfosPill}${noApiPill}${storiesPill}${snippetWarningsPill}${docsPill}</div>
|
|
1218
|
-
</div>
|
|
1219
|
-
</header>
|
|
1220
|
-
<main>
|
|
1221
|
-
<div class="wrap">
|
|
1222
|
-
<div class="note ok" style="margin-bottom: 16px;">
|
|
1223
|
-
Using <code>${esc(activeEngine)}</code>. Generation took <strong>${(durationMs / 1e3).toFixed(1)}s</strong>.
|
|
1224
|
-
</div>
|
|
1225
|
-
${grid ? `<h2 class="section-title">Components</h2>
|
|
1226
|
-
<div class="grid" role="list">
|
|
1227
|
-
${grid}
|
|
1228
|
-
</div>` : ""}
|
|
1229
|
-
${errorGroups.length ? `<div class="error-groups" role="region" aria-label="API error groups">${errorGroupsHTML}</div>` : ""}
|
|
1230
|
-
${docsGrid ? `<h2 class="section-title">Unattached Docs</h2>
|
|
1231
|
-
<div class="grid" role="list">
|
|
1232
|
-
${docsGrid}
|
|
1233
|
-
</div>` : ""}
|
|
1234
|
-
${!grid && !docsGrid ? '<div class="card"><div class="head"><div class="hint">No components or docs.</div></div></div>' : ""}
|
|
1235
|
-
</div>
|
|
1236
|
-
</main>
|
|
1237
|
-
</body>
|
|
1238
|
-
</html> `;
|
|
1239
|
-
}
|
|
1240
|
-
var esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c] ?? c), plural = (n, one, many = `${one}s`) => n === 1 ? one : many;
|
|
1241
|
-
function analyzeComponent(c) {
|
|
1242
|
-
let api = resolveComponentApi(c), hasApiError = api.kind === "error", warns = [];
|
|
1243
|
-
c.description?.trim() || warns.push("No description found. Write a jsdoc comment such as /** Component description */."), c.import?.trim() || warns.push(
|
|
1244
|
-
`Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
|
|
1245
|
-
);
|
|
1246
|
-
let allStories = storyEntries(c.stories), totalStories = allStories.length, storyErrors = allStories.filter((e) => !!e?.error).length, storyWarnings = allStories.filter((e) => !!e?.warning).length, storyOk = totalStories - storyErrors, docsEntries = c.docs ? Object.values(c.docs) : [], totalDocs = docsEntries.length, docsErrors = docsEntries.filter((d) => !!d?.error).length, docsOk = totalDocs - docsErrors, hasAnyError = hasApiError || storyErrors > 0 || docsErrors > 0;
|
|
1247
|
-
return {
|
|
1248
|
-
api,
|
|
1249
|
-
hasApiError,
|
|
1250
|
-
hasAnyError,
|
|
1251
|
-
hasWarns: warns.length > 0,
|
|
1252
|
-
warns,
|
|
1253
|
-
totalStories,
|
|
1254
|
-
storyErrors,
|
|
1255
|
-
storyWarnings,
|
|
1256
|
-
storyOk,
|
|
1257
|
-
totalDocs,
|
|
1258
|
-
docsErrors,
|
|
1259
|
-
docsOk
|
|
1260
|
-
};
|
|
1261
|
-
}
|
|
1262
|
-
function analyzeDoc(d) {
|
|
1263
|
-
return {
|
|
1264
|
-
hasError: !!d.error
|
|
1265
|
-
};
|
|
1266
|
-
}
|
|
1267
|
-
function note(title, bodyHTML, kind) {
|
|
1268
|
-
return `
|
|
1269
|
-
<div class="note ${kind}">
|
|
1270
|
-
<div class="note-title">${esc(title)}</div>
|
|
1271
|
-
<div class="note-body">${bodyHTML}</div>
|
|
1272
|
-
</div>`;
|
|
1273
|
-
}
|
|
1274
|
-
function renderDocCard(key, d, id) {
|
|
1275
|
-
let a = analyzeDoc(d), statusDot = a.hasError ? "dot-err" : "dot-ok", slug = `${id}-${(d.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, errorBadge = a.hasError ? `<label for="${slug}-err" class="badge err as-toggle">error</label>` : "", contentBadge = d.content ? `<label for="${slug}-content" class="badge ok as-toggle">view content</label>` : "";
|
|
1276
|
-
return `
|
|
1277
|
-
<article
|
|
1278
|
-
class="card is-doc ${a.hasError ? "has-doc-error" : "no-doc-error"}"
|
|
1279
|
-
role="listitem"
|
|
1280
|
-
aria-label="${esc(d.name || key)}">
|
|
1281
|
-
<div class="head">
|
|
1282
|
-
<div class="title">
|
|
1283
|
-
<h2><span class="status-dot ${statusDot}"></span> ${esc(d.title || d.name || key)}</h2>
|
|
1284
|
-
<div class="badges">
|
|
1285
|
-
${errorBadge}
|
|
1286
|
-
${contentBadge}
|
|
1287
|
-
</div>
|
|
1288
|
-
</div>
|
|
1289
|
-
<div class="meta" title="${esc(d.path ?? d.id)}">${d.path ? `${esc(d.id)} \xB7 ${esc(d.path)}` : esc(d.id)}</div>
|
|
1290
|
-
${d.summary ? `<div>${esc(d.summary)}</div>` : ""}
|
|
1291
|
-
</div>
|
|
1292
|
-
|
|
1293
|
-
<!-- Hidden toggles must be siblings BEFORE .panels -->
|
|
1294
|
-
${a.hasError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
|
|
1295
|
-
${d.content ? `<input id="${slug}-content" class="tg tg-content" type="checkbox" hidden />` : ""}
|
|
1296
|
-
|
|
1297
|
-
<div class="panels">
|
|
1298
|
-
${a.hasError ? `
|
|
1299
|
-
<div class="panel panel-err">
|
|
1300
|
-
<div class="note err">
|
|
1301
|
-
<div class="note-title">${esc(d.error?.name || "Error")}</div>
|
|
1302
|
-
<div class="note-body"><pre><code>${esc(d.error?.message || "Unknown error")}</code></pre></div>
|
|
1303
|
-
</div>
|
|
1304
|
-
</div>` : ""}
|
|
1305
|
-
${d.content ? `
|
|
1306
|
-
<div class="panel panel-content">
|
|
1307
|
-
<div class="mdx-content">
|
|
1308
|
-
<pre><code>${esc(d.content)}</code></pre>
|
|
1309
|
-
</div>
|
|
1310
|
-
</div>` : ""}
|
|
1311
|
-
</div>
|
|
1312
|
-
</article>`;
|
|
1313
|
-
}
|
|
1314
|
-
function renderComponentCard(key, c, id, anchorId) {
|
|
1315
|
-
let a = analyzeComponent(c), statusDot = a.hasAnyError ? "dot-err" : "dot-ok", allStories = storyEntries(c.stories), errorStories = allStories.filter((ex) => !!ex?.error), okStories = allStories.filter((ex) => !ex?.error), subcomponentEntries = Object.entries(c.subcomponents ?? {}), allDocs = c.docs ? Object.values(c.docs) : [], errorDocs = allDocs.filter((d) => !!d?.error), okDocs = allDocs.filter((d) => !d?.error), slug = `c-${id}-${(c.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`, { api } = a, primaryBadge = api.kind === "error" ? `<label for="${slug}-err" class="badge err as-toggle">API error</label>` : api.kind === "markdown" ? `<label for="${slug}-props" class="badge ok as-toggle">API description</label>` : api.kind === "props" ? `<label for="${slug}-props" class="badge ok as-toggle">${api.entries.length} ${plural(api.entries.length, "prop type")}</label>` : '<span class="badge">no API description</span>', infosBadge = a.hasWarns ? `<label for="${slug}-info" class="badge info as-toggle">${a.warns.length} ${plural(a.warns.length, "info", "infos")}</label>` : "", storiesBadge = a.totalStories > 0 ? `<label for="${slug}-stories" class="badge ${a.storyErrors > 0 ? "err" : "ok"} as-toggle">${a.storyErrors > 0 ? `${a.storyErrors}/${a.totalStories} story errors` : `${a.totalStories} ${plural(a.totalStories, "story", "stories")}`}${a.storyWarnings > 0 ? ` \xB7 ${a.storyWarnings} incomplete` : ""}</label>` : "", docsBadge = a.totalDocs > 0 ? `<label for="${slug}-docs" class="badge ${a.docsErrors > 0 ? "err" : "ok"} as-toggle">${a.docsErrors > 0 ? `${a.docsErrors}/${a.totalDocs} doc errors` : `${a.totalDocs} ${plural(a.totalDocs, "doc")}`}</label>` : "", subcomponentsBadge = subcomponentEntries.length > 0 ? `<label for="${slug}-subcomponents" class="badge ok as-toggle">${subcomponentEntries.length} ${plural(subcomponentEntries.length, "subcomponent")}</label>` : "", apiPanel = api.kind === "markdown" ? `
|
|
1316
|
-
<div class="panel panel-props">
|
|
1317
|
-
<div class="note ok">
|
|
1318
|
-
<div class="row">
|
|
1319
|
-
<span class="ex-name">API description</span>
|
|
1320
|
-
${c.renderer ? `<span class="badge ok">${esc(c.renderer)}</span>` : ""}
|
|
1321
|
-
</div>
|
|
1322
|
-
<pre><code>${esc(api.markdown)}</code></pre>
|
|
1323
|
-
</div>
|
|
1324
|
-
</div>` : api.kind === "props" ? `
|
|
1325
|
-
<div class="panel panel-props">
|
|
1326
|
-
<div class="note ok">
|
|
1327
|
-
<div class="row">
|
|
1328
|
-
<span class="ex-name">Prop types <small>(${api.engine})</small></span>
|
|
1329
|
-
<span class="badge ok">${api.entries.length} ${plural(api.entries.length, "prop type")}</span>
|
|
1330
|
-
</div>
|
|
1331
|
-
<pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}</code></pre>
|
|
1332
|
-
<pre><code>Props:</code></pre>
|
|
1333
|
-
<pre><code>${esc(renderPropsCode(api.entries))}</code></pre>
|
|
1334
|
-
</div>
|
|
1335
|
-
</div>` : "", tags = c.jsDocTags && typeof c.jsDocTags == "object" ? Object.entries(c.jsDocTags).flatMap(
|
|
1336
|
-
([k, v10]) => (Array.isArray(v10) ? v10 : [v10]).map(
|
|
1337
|
-
(val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
|
|
1338
|
-
)
|
|
1339
|
-
).join("") : "";
|
|
1340
|
-
return `
|
|
1341
|
-
<article
|
|
1342
|
-
${anchorId ? `id="${esc(anchorId)}"` : ""}
|
|
1343
|
-
class="card
|
|
1344
|
-
${a.hasApiError ? "has-error" : "no-error"}
|
|
1345
|
-
${a.hasWarns ? "has-info" : "no-info"}
|
|
1346
|
-
${a.storyErrors ? "has-story-error" : "no-story-error"}
|
|
1347
|
-
${a.storyWarnings ? "has-story-warning" : "no-story-warning"}
|
|
1348
|
-
${api.kind === "none" ? "missing-api" : ""}
|
|
1349
|
-
${a.docsErrors ? "has-doc-error" : "no-doc-error"}"
|
|
1350
|
-
role="listitem"
|
|
1351
|
-
aria-label="${esc(c.name || key)}">
|
|
1352
|
-
<div class="head">
|
|
1353
|
-
<div class="title">
|
|
1354
|
-
<h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
|
|
1355
|
-
<div class="badges">
|
|
1356
|
-
${primaryBadge}
|
|
1357
|
-
${infosBadge}
|
|
1358
|
-
${storiesBadge}
|
|
1359
|
-
${docsBadge}
|
|
1360
|
-
${subcomponentsBadge}
|
|
1361
|
-
</div>
|
|
1362
|
-
</div>
|
|
1363
|
-
<div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
|
|
1364
|
-
${c.summary ? `<div>${esc(c.summary)}</div>` : ""}
|
|
1365
|
-
${c.description ? `<div class="hint">${esc(c.description)}</div>` : ""}
|
|
1366
|
-
${tags ? `<div class="kv">${tags}</div>` : ""}
|
|
1367
|
-
</div>
|
|
1368
|
-
|
|
1369
|
-
<!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
|
|
1370
|
-
${api.kind === "error" ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
|
|
1371
|
-
${a.hasWarns ? `<input id="${slug}-info" class="tg tg-info" type="checkbox" hidden />` : ""}
|
|
1372
|
-
${a.totalStories > 0 ? `<input id="${slug}-stories" class="tg tg-stories" type="checkbox" hidden />` : ""}
|
|
1373
|
-
${a.totalDocs > 0 ? `<input id="${slug}-docs" class="tg tg-docs" type="checkbox" hidden />` : ""}
|
|
1374
|
-
${subcomponentEntries.length > 0 ? `<input id="${slug}-subcomponents" class="tg tg-subcomponents" type="checkbox" hidden />` : ""}
|
|
1375
|
-
${apiPanel ? `<input id="${slug}-props" class="tg tg-props" type="checkbox" hidden />` : ""}
|
|
1376
|
-
|
|
1377
|
-
<div class="panels">
|
|
1378
|
-
${api.kind === "error" ? `
|
|
1379
|
-
<div class="panel panel-err">
|
|
1380
|
-
${note("API error", `<pre><code>${esc(api.message)}</code></pre>`, "err")}
|
|
1381
|
-
</div>` : ""}
|
|
1382
|
-
${a.hasWarns ? `
|
|
1383
|
-
<div class="panel panel-info">
|
|
1384
|
-
${a.warns.map((w) => note("Info", esc(w), "info")).join("")}
|
|
1385
|
-
</div>` : ""}
|
|
1386
|
-
${apiPanel}
|
|
1387
|
-
${a.totalStories > 0 ? `
|
|
1388
|
-
<div class="panel panel-stories">
|
|
1389
|
-
${errorStories.map(
|
|
1390
|
-
(ex) => `
|
|
1391
|
-
<div class="note err">
|
|
1392
|
-
<div class="row">
|
|
1393
|
-
<span class="ex-name">${esc(ex.name)}</span>
|
|
1394
|
-
<span class="badge err">story error</span>
|
|
1395
|
-
${ex?.warning ? '<span class="badge info">incomplete example</span>' : ""}
|
|
1396
|
-
</div>
|
|
1397
|
-
${ex?.summary ? `<div class="hint">Summary: ${esc(ex.summary)}</div>` : ""}
|
|
1398
|
-
${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
|
|
1399
|
-
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
1400
|
-
${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
|
|
1401
|
-
${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
|
|
1402
|
-
</div>`
|
|
1403
|
-
).join("")}
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
${c.import ? `<div class="note ok">
|
|
1407
|
-
<div class="row">
|
|
1408
|
-
<span class="ex-name">Imports</span>
|
|
1409
|
-
</div>
|
|
1410
|
-
<pre><code>${c.import}</code></pre>
|
|
1411
|
-
</div>` : ""}
|
|
1412
|
-
|
|
1413
|
-
${okStories.map(
|
|
1414
|
-
(ex) => `
|
|
1415
|
-
<div class="note ok">
|
|
1416
|
-
<div class="row">
|
|
1417
|
-
<span class="ex-name">${esc(ex.name)}</span>
|
|
1418
|
-
<span class="badge ${ex?.warning ? "info" : "ok"}">${ex?.warning ? "incomplete example" : "story ok"}</span>
|
|
1419
|
-
</div>
|
|
1420
|
-
${ex?.summary ? `<div>${esc(ex.summary)}</div>` : ""}
|
|
1421
|
-
${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
|
|
1422
|
-
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
1423
|
-
${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
|
|
1424
|
-
</div>`
|
|
1425
|
-
).join("")}
|
|
1426
|
-
</div>` : ""}
|
|
1427
|
-
${a.totalDocs > 0 ? `
|
|
1428
|
-
<div class="panel panel-docs">
|
|
1429
|
-
${errorDocs.map(
|
|
1430
|
-
(doc) => `
|
|
1431
|
-
<div class="note err">
|
|
1432
|
-
<div class="row">
|
|
1433
|
-
<span class="ex-name">${esc(doc.name)}</span>
|
|
1434
|
-
<span class="badge err">doc error</span>
|
|
1435
|
-
</div>
|
|
1436
|
-
${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
|
|
1437
|
-
${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
|
|
1438
|
-
${doc?.error?.message ? `<pre><code>${esc(doc.error.message)}</code></pre>` : ""}
|
|
1439
|
-
</div>`
|
|
1440
|
-
).join("")}
|
|
1441
|
-
${okDocs.map(
|
|
1442
|
-
(doc) => `
|
|
1443
|
-
<div class="note ok">
|
|
1444
|
-
<div class="row">
|
|
1445
|
-
<span class="ex-name">${esc(doc.name)}</span>
|
|
1446
|
-
<span class="badge ok">doc ok</span>
|
|
1447
|
-
</div>
|
|
1448
|
-
${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
|
|
1449
|
-
${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
|
|
1450
|
-
${doc?.content ? `<div class="mdx-content"><pre><code>${esc(doc.content)}</code></pre></div>` : ""}
|
|
1451
|
-
</div>`
|
|
1452
|
-
).join("")}
|
|
1453
|
-
</div>` : ""}
|
|
1454
|
-
${subcomponentEntries.length > 0 ? `
|
|
1455
|
-
<div class="panel panel-subcomponents">
|
|
1456
|
-
${subcomponentEntries.map(
|
|
1457
|
-
([subcomponentName, subcomponent]) => renderSubcomponentNote(subcomponentName, subcomponent)
|
|
1458
|
-
).join("")}
|
|
1459
|
-
</div>` : ""}
|
|
1460
|
-
</div>
|
|
1461
|
-
</article>`;
|
|
1462
|
-
}
|
|
1463
|
-
var docgenRenderData = (component) => component.reactComponentMeta ? {
|
|
1464
|
-
parsed: parseReactComponentMeta(component.reactComponentMeta),
|
|
1465
|
-
engine: "react-component-meta",
|
|
1466
|
-
filePath: component.reactComponentMeta.filePath,
|
|
1467
|
-
exportName: component.reactComponentMeta.exportName
|
|
1468
|
-
} : {};
|
|
1469
|
-
function resolveComponentApi(component) {
|
|
1470
|
-
if (component.error)
|
|
1471
|
-
return { kind: "error", message: component.error.message || "Unknown error" };
|
|
1472
|
-
let markdown = component.apiDescription?.trim();
|
|
1473
|
-
if (markdown)
|
|
1474
|
-
return { kind: "markdown", markdown };
|
|
1475
|
-
let { parsed, ...source } = docgenRenderData(component), entries = Object.entries(parsed?.props ?? {}).sort(([a], [b]) => a.localeCompare(b));
|
|
1476
|
-
return entries.length > 0 ? { kind: "props", entries, ...source } : { kind: "none" };
|
|
1477
|
-
}
|
|
1478
|
-
function renderPropsCode(entries) {
|
|
1479
|
-
return entries.map(([propName, info]) => {
|
|
1480
|
-
let description8 = (info?.description ?? "").trim(), type = (info?.type ?? "any").trim(), optional7 = info?.required ? "" : "?", defaultValue = (info?.defaultValue ?? "").trim(), fallback = defaultValue ? ` = ${defaultValue}` : "", doc = ["/**", ...description8.split(`
|
|
1481
|
-
`).map((line) => ` * ${line}`), " */"].join(`
|
|
1482
|
-
`) + `
|
|
1483
1449
|
`;
|
|
1484
|
-
return `${description8 ? doc : ""}${propName}${optional7}: ${type}${fallback}`;
|
|
1485
|
-
}).join(`
|
|
1486
1450
|
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1451
|
+
// src/core-server/utils/manifests/render-components-manifest.ts
|
|
1452
|
+
function renderComponentsManifest(manifest, docsManifest) {
|
|
1453
|
+
let entries = Object.entries(manifest?.components ?? {}).sort(
|
|
1454
|
+
(a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
|
|
1455
|
+
), docsEntries = Object.entries(docsManifest?.docs ?? {}).sort(
|
|
1456
|
+
(a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
|
|
1457
|
+
), analyses = entries.map(([, c]) => analyzeComponent(c)), docsAnalyses = docsEntries.map(([, d]) => analyzeDoc(d)), attachedDocs = analyses.reduce((sum, a) => sum + a.totalDocs, 0), attachedDocsWithError = analyses.reduce((sum, a) => sum + a.docsErrors, 0), unattachedDocsWithError = docsAnalyses.filter((a) => a.hasError).length, totals = {
|
|
1458
|
+
components: entries.length,
|
|
1459
|
+
componentsWithApiError: analyses.filter((a) => a.hasApiError).length,
|
|
1460
|
+
infos: analyses.filter((a) => a.hasWarns).length,
|
|
1461
|
+
stories: analyses.reduce((sum, a) => sum + a.totalStories, 0),
|
|
1462
|
+
storyErrors: analyses.reduce((sum, a) => sum + a.storyErrors, 0),
|
|
1463
|
+
storyWarnings: analyses.reduce((sum, a) => sum + a.storyWarnings, 0),
|
|
1464
|
+
componentsWithoutApi: analyses.filter((a) => a.api.kind === "none").length,
|
|
1465
|
+
docs: docsEntries.length + attachedDocs,
|
|
1466
|
+
docsWithError: unattachedDocsWithError + attachedDocsWithError
|
|
1467
|
+
}, activeEngine = manifest?.meta?.docgen ?? "react-component-meta", durationMs = manifest?.meta?.durationMs ?? 0, allPill = '<a class="filter-pill all" data-k="all" href="#filter-all">All</a>', compErrorsPill = totals.componentsWithApiError > 0 ? `<a class="filter-pill err" data-k="errors" href="#filter-errors">${totals.componentsWithApiError}/${totals.components} API ${plural(totals.componentsWithApiError, "error")}</a>` : totals.components > 0 ? `<span class="filter-pill ok" aria-disabled="true">${totals.components} components ok</span>` : "", compInfosPill = totals.infos > 0 ? `<a class="filter-pill info" data-k="infos" href="#filter-infos">${totals.infos}/${totals.components} ${plural(totals.infos, "info", "infos")}</a>` : "", storiesPill = totals.storyErrors > 0 ? `<a class="filter-pill err" data-k="story-errors" href="#filter-story-errors">${totals.storyErrors}/${totals.stories} story errors</a>` : totals.stories > 0 ? `<span class="filter-pill ok" aria-disabled="true">${totals.stories} ${plural(totals.stories, "story", "stories")} ok</span>` : "", snippetWarningsPill = totals.storyWarnings > 0 ? `<a class="filter-pill info" data-k="story-warnings" href="#filter-story-warnings">${totals.storyWarnings}/${totals.stories} incomplete snippets</a>` : "", noApiPill = totals.componentsWithoutApi > 0 ? `<a class="filter-pill" data-k="no-api" href="#filter-no-api">${totals.componentsWithoutApi}/${totals.components} without API description</a>` : "", docsPill = totals.docs > 0 ? totals.docsWithError > 0 ? `<a class="filter-pill info" data-k="docs" href="#filter-docs">${totals.docsWithError}/${totals.docs} doc ${plural(totals.docsWithError, "error")}</a>` : `<a class="filter-pill ok" data-k="docs" href="#filter-docs">${totals.docs} ${plural(totals.docs, "doc")} ok</a>` : "", grid = entries.map(([key, c], idx) => renderComponentCard(key, c, `${idx}`, key)).join(""), docsGrid = docsEntries.map(([key, d], idx) => renderDocCard(key, d, `doc-${idx}`)).join(""), errorGroups = Object.entries(
|
|
1468
|
+
groupBy(
|
|
1469
|
+
entries.map(([, it]) => it).filter((it) => it.error),
|
|
1470
|
+
(manifest2) => manifest2.error?.name ?? "Error"
|
|
1493
1471
|
)
|
|
1494
|
-
).
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1472
|
+
).sort(([, a], [, b]) => b.length - a.length), errorGroupsHTML = errorGroups.map(([error, grouped]) => {
|
|
1473
|
+
let id = error.toLowerCase().replace(/[^a-z0-9]+/g, "-"), headerText = `${esc(error)}`, cards = grouped.map((manifest2, id2) => renderComponentCard(manifest2.id, manifest2, `error-${id2}`)).join("");
|
|
1474
|
+
return `
|
|
1475
|
+
<section class="group">
|
|
1476
|
+
<input id="${id}-toggle" class="group-tg" type="checkbox" hidden />
|
|
1477
|
+
<label for="${id}-toggle" class="group-header">
|
|
1478
|
+
<span class="caret">\u25B8</span>
|
|
1479
|
+
<span class="group-title">${headerText}</span>
|
|
1480
|
+
<span class="group-count">${grouped.length}</span>
|
|
1481
|
+
</label>
|
|
1482
|
+
<div class="group-cards">${cards}</div>
|
|
1483
|
+
</section>
|
|
1484
|
+
`;
|
|
1485
|
+
}).join("");
|
|
1486
|
+
return `<!doctype html>
|
|
1487
|
+
<html lang="en">
|
|
1488
|
+
<head>
|
|
1489
|
+
<meta charset="utf-8" />
|
|
1490
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
1491
|
+
<title>Components Manifest</title>
|
|
1492
|
+
<style>
|
|
1493
|
+
${componentsManifestCss}
|
|
1494
|
+
</style>
|
|
1495
|
+
</head>
|
|
1496
|
+
<body>
|
|
1497
|
+
<!-- Hidden targets for the top-level filters -->
|
|
1498
|
+
<span id="filter-all"></span>
|
|
1499
|
+
<span id="filter-errors"></span>
|
|
1500
|
+
<span id="filter-infos"></span>
|
|
1501
|
+
<span id="filter-story-errors"></span>
|
|
1502
|
+
<span id="filter-story-warnings"></span>
|
|
1503
|
+
<span id="filter-no-api"></span>
|
|
1504
|
+
<span id="filter-doc-errors"></span>
|
|
1505
|
+
<span id="filter-docs"></span>
|
|
1506
|
+
<header>
|
|
1507
|
+
<div class="wrap">
|
|
1508
|
+
<h1>Manifest Debugger</h1>
|
|
1509
|
+
<div class="summary">${allPill}${compErrorsPill}${compInfosPill}${noApiPill}${storiesPill}${snippetWarningsPill}${docsPill}</div>
|
|
1510
|
+
</div>
|
|
1511
|
+
</header>
|
|
1512
|
+
<main>
|
|
1513
|
+
<div class="wrap">
|
|
1514
|
+
<div class="note ok" style="margin-bottom: 16px;">
|
|
1515
|
+
Using <code>${esc(activeEngine)}</code>. Generation took <strong>${(durationMs / 1e3).toFixed(1)}s</strong>.
|
|
1513
1516
|
</div>
|
|
1514
|
-
|
|
1517
|
+
${grid ? `<h2 class="section-title">Components</h2>
|
|
1518
|
+
<div class="grid" role="list">
|
|
1519
|
+
${grid}
|
|
1520
|
+
</div>` : ""}
|
|
1521
|
+
${errorGroups.length ? `<div class="error-groups" role="region" aria-label="API error groups">${errorGroupsHTML}</div>` : ""}
|
|
1522
|
+
${docsGrid ? `<h2 class="section-title">Unattached Docs</h2>
|
|
1523
|
+
<div class="grid" role="list">
|
|
1524
|
+
${docsGrid}
|
|
1525
|
+
</div>` : ""}
|
|
1526
|
+
${!grid && !docsGrid ? '<div class="card"><div class="head"><div class="hint">No components or docs.</div></div></div>' : ""}
|
|
1527
|
+
</div>
|
|
1528
|
+
</main>
|
|
1529
|
+
</body>
|
|
1530
|
+
</html> `;
|
|
1515
1531
|
}
|
|
1516
|
-
var parseReactComponentMeta = (reactComponentMeta) => {
|
|
1517
|
-
let props = reactComponentMeta.props ?? {};
|
|
1518
|
-
return {
|
|
1519
|
-
props: Object.fromEntries(
|
|
1520
|
-
Object.entries(props).map(([propName, prop]) => [
|
|
1521
|
-
propName,
|
|
1522
|
-
{
|
|
1523
|
-
description: prop.description,
|
|
1524
|
-
type: prop.type?.raw ?? prop.type?.name,
|
|
1525
|
-
defaultValue: prop.defaultValue?.value,
|
|
1526
|
-
required: prop.required
|
|
1527
|
-
}
|
|
1528
|
-
])
|
|
1529
|
-
)
|
|
1530
|
-
};
|
|
1531
|
-
};
|
|
1532
1532
|
|
|
1533
1533
|
// src/core-server/utils/manifests/manifests.ts
|
|
1534
1534
|
function buildComponentsManifest(components, meta) {
|
|
@@ -2494,7 +2494,7 @@ var ReverseIndexImpl = class {
|
|
|
2494
2494
|
async function walkFromStory({
|
|
2495
2495
|
storyRoot,
|
|
2496
2496
|
registry,
|
|
2497
|
-
cache:
|
|
2497
|
+
cache: cache4,
|
|
2498
2498
|
reverseIndex,
|
|
2499
2499
|
recordEdges
|
|
2500
2500
|
}) {
|
|
@@ -2506,7 +2506,7 @@ async function walkFromStory({
|
|
|
2506
2506
|
let { file, depth } = queue[head++];
|
|
2507
2507
|
if (registry.parserFor(file) === void 0)
|
|
2508
2508
|
continue;
|
|
2509
|
-
let resolvedDeps = await
|
|
2509
|
+
let resolvedDeps = await cache4.resolveOnce(file);
|
|
2510
2510
|
recordEdges(file, resolvedDeps);
|
|
2511
2511
|
let nextDepth = depth + 1;
|
|
2512
2512
|
for (let normalised of resolvedDeps) {
|
|
@@ -2877,7 +2877,7 @@ var ModuleGraphEngine = class {
|
|
|
2877
2877
|
pluginParsers
|
|
2878
2878
|
}), resolver = new ChangeDetectionResolverFactory(resolveConfig), workspaceRoots = /* @__PURE__ */ new Set([normalize5(getProjectRoot2())]), storyIndex = await this.options.getIndex(), storyIdsByFile = getStoryIdsByAbsolutePath(storyIndex, this.workingDir);
|
|
2879
2879
|
this.storyFiles = new Set(storyIdsByFile.keys());
|
|
2880
|
-
let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG,
|
|
2880
|
+
let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG, cache4 = new ParseResolveCache({
|
|
2881
2881
|
registry,
|
|
2882
2882
|
resolver,
|
|
2883
2883
|
workspaceRoots,
|
|
@@ -2890,19 +2890,19 @@ var ModuleGraphEngine = class {
|
|
|
2890
2890
|
resolver,
|
|
2891
2891
|
workspaceRoots,
|
|
2892
2892
|
projectRoot,
|
|
2893
|
-
cache:
|
|
2893
|
+
cache: cache4
|
|
2894
2894
|
});
|
|
2895
2895
|
let eventBuffer = [], unsubscribeBuffer = adapter.onFileChange((event) => {
|
|
2896
2896
|
eventBuffer.push({ event, receivedAt: Date.now() });
|
|
2897
2897
|
}), { reverseIndex, graph } = await this.dependencyGraphBuilder.build(this.storyFiles);
|
|
2898
|
-
this.reverseIndex = reverseIndex, this.dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots,
|
|
2898
|
+
this.reverseIndex = reverseIndex, this.dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache4), this.incrementalPatcher = new IncrementalPatcher({
|
|
2899
2899
|
reverseIndex,
|
|
2900
2900
|
graph,
|
|
2901
2901
|
registry,
|
|
2902
2902
|
resolver,
|
|
2903
2903
|
workspaceRoots,
|
|
2904
2904
|
projectRoot,
|
|
2905
|
-
cache:
|
|
2905
|
+
cache: cache4,
|
|
2906
2906
|
isStoryFile: (path3) => this.storyFiles.has(normalize5(path3))
|
|
2907
2907
|
}), unsubscribeBuffer();
|
|
2908
2908
|
for (let { event, receivedAt } of eventBuffer)
|
|
@@ -2948,7 +2948,7 @@ var ModuleGraphEngine = class {
|
|
|
2948
2948
|
});
|
|
2949
2949
|
}
|
|
2950
2950
|
}
|
|
2951
|
-
async dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots,
|
|
2951
|
+
async dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache4) {
|
|
2952
2952
|
let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG;
|
|
2953
2953
|
if (!debugEnv)
|
|
2954
2954
|
return;
|
|
@@ -2975,7 +2975,7 @@ var ModuleGraphEngine = class {
|
|
|
2975
2975
|
// Each entry records one named-import barrel lookup: which names were requested,
|
|
2976
2976
|
// which source files they resolved to, and whether the barrel itself was also
|
|
2977
2977
|
// included (needBarrel: true means at least one name fell back to the barrel).
|
|
2978
|
-
barrelResolutions:
|
|
2978
|
+
barrelResolutions: cache4.getBarrelTrace() ?? []
|
|
2979
2979
|
};
|
|
2980
2980
|
try {
|
|
2981
2981
|
await writeFile2(outPath, JSON.stringify(snapshot, null, 2), "utf8"), logger5.debug(`Change detection: graph debug snapshot written to ${outPath}`);
|
|
@@ -3355,9 +3355,9 @@ function resetChangeDetectionReadiness() {
|
|
|
3355
3355
|
function isServerStoreLeader() {
|
|
3356
3356
|
return !optionalEnvToBoolean(process.env.VITEST_CHILD_PROCESS) && !optionalEnvToBoolean(process.env.FORKBOOK_ATTACHED_TOOLS) && UniversalStore.preparedEnvironment !== UniversalStore.Environment.UNKNOWN;
|
|
3357
3357
|
}
|
|
3358
|
-
function getOrRecreateStore(id,
|
|
3358
|
+
function getOrRecreateStore(id, cache4, create) {
|
|
3359
3359
|
let leader = isServerStoreLeader();
|
|
3360
|
-
return
|
|
3360
|
+
return cache4.store !== void 0 && cache4.leader === leader || (cache4.store !== void 0 && instances.delete(id), cache4.leader = leader, cache4.store = create(leader)), cache4.store;
|
|
3361
3361
|
}
|
|
3362
3362
|
|
|
3363
3363
|
// src/core-server/stores/status.ts
|
|
@@ -3402,106 +3402,6 @@ var fullStatusStore = new Proxy(
|
|
|
3402
3402
|
}
|
|
3403
3403
|
);
|
|
3404
3404
|
|
|
3405
|
-
// src/shared/test-provider-store/index.ts
|
|
3406
|
-
var UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS = {
|
|
3407
|
-
id: "@aussieljk/forkbook/test-provider",
|
|
3408
|
-
leader: !0,
|
|
3409
|
-
initialState: {}
|
|
3410
|
-
};
|
|
3411
|
-
function createTestProviderStore({
|
|
3412
|
-
universalTestProviderStore: universalTestProviderStore2,
|
|
3413
|
-
useUniversalStore
|
|
3414
|
-
}) {
|
|
3415
|
-
let baseStore = {
|
|
3416
|
-
settingsChanged: () => {
|
|
3417
|
-
universalTestProviderStore2.untilReady().then(() => {
|
|
3418
|
-
universalTestProviderStore2.send({ type: "settings-changed" });
|
|
3419
|
-
});
|
|
3420
|
-
},
|
|
3421
|
-
onRunAll: (listener) => universalTestProviderStore2.subscribe("run-all", listener),
|
|
3422
|
-
onClearAll: (listener) => universalTestProviderStore2.subscribe("clear-all", listener)
|
|
3423
|
-
}, fullTestProviderStore2 = {
|
|
3424
|
-
...baseStore,
|
|
3425
|
-
getFullState: universalTestProviderStore2.getState,
|
|
3426
|
-
setFullState: universalTestProviderStore2.setState,
|
|
3427
|
-
onSettingsChanged: (listener) => universalTestProviderStore2.subscribe("settings-changed", listener),
|
|
3428
|
-
runAll: async () => {
|
|
3429
|
-
await universalTestProviderStore2.untilReady(), universalTestProviderStore2.send({ type: "run-all" });
|
|
3430
|
-
},
|
|
3431
|
-
clearAll: async () => {
|
|
3432
|
-
await universalTestProviderStore2.untilReady(), universalTestProviderStore2.send({ type: "clear-all" });
|
|
3433
|
-
}
|
|
3434
|
-
}, getTestProviderStoreById2 = (testProviderId) => {
|
|
3435
|
-
let getStateForTestProvider = () => universalTestProviderStore2.getState()[testProviderId] ?? "test-provider-state:pending", setStateForTestProvider = (state) => {
|
|
3436
|
-
universalTestProviderStore2.untilReady().then(() => {
|
|
3437
|
-
universalTestProviderStore2.setState((currentState) => ({
|
|
3438
|
-
...currentState,
|
|
3439
|
-
[testProviderId]: state
|
|
3440
|
-
}));
|
|
3441
|
-
});
|
|
3442
|
-
};
|
|
3443
|
-
return {
|
|
3444
|
-
...baseStore,
|
|
3445
|
-
testProviderId,
|
|
3446
|
-
getState: getStateForTestProvider,
|
|
3447
|
-
setState: setStateForTestProvider,
|
|
3448
|
-
runWithState: async (callback) => {
|
|
3449
|
-
setStateForTestProvider("test-provider-state:running");
|
|
3450
|
-
try {
|
|
3451
|
-
await callback(), setStateForTestProvider("test-provider-state:succeeded");
|
|
3452
|
-
} catch {
|
|
3453
|
-
setStateForTestProvider("test-provider-state:crashed");
|
|
3454
|
-
}
|
|
3455
|
-
}
|
|
3456
|
-
};
|
|
3457
|
-
};
|
|
3458
|
-
return useUniversalStore ? {
|
|
3459
|
-
getTestProviderStoreById: getTestProviderStoreById2,
|
|
3460
|
-
fullTestProviderStore: fullTestProviderStore2,
|
|
3461
|
-
universalTestProviderStore: universalTestProviderStore2,
|
|
3462
|
-
useTestProviderStore: (selector) => useUniversalStore(universalTestProviderStore2, selector)[0]
|
|
3463
|
-
} : {
|
|
3464
|
-
getTestProviderStoreById: getTestProviderStoreById2,
|
|
3465
|
-
fullTestProviderStore: fullTestProviderStore2,
|
|
3466
|
-
universalTestProviderStore: universalTestProviderStore2
|
|
3467
|
-
};
|
|
3468
|
-
}
|
|
3469
|
-
|
|
3470
|
-
// src/core-server/stores/test-provider.ts
|
|
3471
|
-
function createServerTestProviderStore(leader) {
|
|
3472
|
-
return createTestProviderStore({
|
|
3473
|
-
universalTestProviderStore: UniversalStore.create({
|
|
3474
|
-
...UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS,
|
|
3475
|
-
leader
|
|
3476
|
-
})
|
|
3477
|
-
});
|
|
3478
|
-
}
|
|
3479
|
-
var cache3 = {};
|
|
3480
|
-
function getTestProviderStoreBundle() {
|
|
3481
|
-
return getOrRecreateStore(
|
|
3482
|
-
UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS.id,
|
|
3483
|
-
cache3,
|
|
3484
|
-
createServerTestProviderStore
|
|
3485
|
-
);
|
|
3486
|
-
}
|
|
3487
|
-
function startTestProviderStore() {
|
|
3488
|
-
getTestProviderStoreBundle();
|
|
3489
|
-
}
|
|
3490
|
-
var getTestProviderStoreById = (id) => getTestProviderStoreBundle().getTestProviderStoreById(id), fullTestProviderStore = new Proxy(
|
|
3491
|
-
{},
|
|
3492
|
-
{
|
|
3493
|
-
get(_target, prop) {
|
|
3494
|
-
let store = getTestProviderStoreBundle().fullTestProviderStore, value = Reflect.get(store, prop, store);
|
|
3495
|
-
return typeof value == "function" ? value.bind(store) : value;
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
), universalTestProviderStore = new Proxy({}, {
|
|
3499
|
-
get(_target, prop) {
|
|
3500
|
-
let store = getTestProviderStoreBundle().universalTestProviderStore, value = Reflect.get(store, prop, store);
|
|
3501
|
-
return typeof value == "function" ? value.bind(store) : value;
|
|
3502
|
-
}
|
|
3503
|
-
});
|
|
3504
|
-
|
|
3505
3405
|
// src/core-server/presets/wsToken.ts
|
|
3506
3406
|
import { randomUUID } from "crypto";
|
|
3507
3407
|
var getWsToken = () => (globalThis.FORKBOOK_WEBSOCKET_TOKEN || (globalThis.FORKBOOK_WEBSOCKET_TOKEN = randomUUID()), globalThis.FORKBOOK_WEBSOCKET_TOKEN);
|
|
@@ -3509,7 +3409,7 @@ var getWsToken = () => (globalThis.FORKBOOK_WEBSOCKET_TOKEN || (globalThis.FORKB
|
|
|
3509
3409
|
// src/core-server/withTelemetry.ts
|
|
3510
3410
|
import {
|
|
3511
3411
|
HandledError,
|
|
3512
|
-
cache as
|
|
3412
|
+
cache as cache3,
|
|
3513
3413
|
defaultConfigDir,
|
|
3514
3414
|
loadMainConfig,
|
|
3515
3415
|
isCI,
|
|
@@ -3518,10 +3418,8 @@ import {
|
|
|
3518
3418
|
import { logger as logger7, prompt } from "@aussieljk/forkbook/internal/node-logger";
|
|
3519
3419
|
import {
|
|
3520
3420
|
ErrorCollector,
|
|
3521
|
-
getPrecedingUpgrade,
|
|
3522
3421
|
isTelemetryStateResolved,
|
|
3523
3422
|
oneWayHash,
|
|
3524
|
-
onPayloadError,
|
|
3525
3423
|
setTelemetryEnabled,
|
|
3526
3424
|
telemetry,
|
|
3527
3425
|
withSpan
|
|
@@ -3533,7 +3431,7 @@ var promptCrashReports = async () => {
|
|
|
3533
3431
|
message: "Would you like to send anonymous crash reports to improve Forkbook and fix bugs faster?",
|
|
3534
3432
|
initialValue: !0
|
|
3535
3433
|
});
|
|
3536
|
-
return await
|
|
3434
|
+
return await cache3.set("enableCrashReports", enableCrashReports), enableCrashReports;
|
|
3537
3435
|
};
|
|
3538
3436
|
async function getErrorLevel({
|
|
3539
3437
|
cliOptions,
|
|
@@ -3552,7 +3450,7 @@ async function getErrorLevel({
|
|
|
3552
3450
|
if (core?.disableTelemetry)
|
|
3553
3451
|
return "none";
|
|
3554
3452
|
}
|
|
3555
|
-
let valueFromCache = await
|
|
3453
|
+
let valueFromCache = await cache3.get("enableCrashReports") ?? await cache3.get("enableCrashreports");
|
|
3556
3454
|
if (valueFromCache !== void 0)
|
|
3557
3455
|
return valueFromCache ? "full" : "error";
|
|
3558
3456
|
if (skipPrompt)
|
|
@@ -3572,7 +3470,7 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
|
|
|
3572
3470
|
} catch {
|
|
3573
3471
|
}
|
|
3574
3472
|
if (errorLevel !== "none") {
|
|
3575
|
-
let
|
|
3473
|
+
let error = _error, errorHash;
|
|
3576
3474
|
"message" in error ? errorHash = error.message ? oneWayHash(error.message) : "EMPTY_MESSAGE" : errorHash = "NO_MESSAGE";
|
|
3577
3475
|
let { code, name, category } = error;
|
|
3578
3476
|
if (await telemetry(
|
|
@@ -3583,7 +3481,6 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
|
|
|
3583
3481
|
category,
|
|
3584
3482
|
eventType,
|
|
3585
3483
|
blocking,
|
|
3586
|
-
precedingUpgrade,
|
|
3587
3484
|
error: errorLevel === "full" ? error : void 0,
|
|
3588
3485
|
errorHash,
|
|
3589
3486
|
// if we ever end up sending a non-error instance, we'd like to know
|
|
@@ -3591,12 +3488,7 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
|
|
|
3591
3488
|
// Include parent error information if this is a sub-error
|
|
3592
3489
|
...parent ? { parent: parent.fullErrorCode } : {}
|
|
3593
3490
|
},
|
|
3594
|
-
{
|
|
3595
|
-
immediate: !0,
|
|
3596
|
-
configDir: options.cliOptions.configDir || options.presetOptions?.configDir,
|
|
3597
|
-
enableCrashReports: errorLevel === "full",
|
|
3598
|
-
force: !0
|
|
3599
|
-
}
|
|
3491
|
+
{ force: !0 }
|
|
3600
3492
|
), error && "subErrors" in error && error.subErrors.length > 0)
|
|
3601
3493
|
for (let subError of error.subErrors)
|
|
3602
3494
|
await sendTelemetryError(subError, eventType, options, blocking, error);
|
|
@@ -3605,16 +3497,20 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
|
|
|
3605
3497
|
}
|
|
3606
3498
|
}
|
|
3607
3499
|
async function resolveTelemetryState(options) {
|
|
3608
|
-
if (options.cliOptions.disableTelemetry !== void 0)
|
|
3609
|
-
|
|
3500
|
+
if (options.cliOptions.disableTelemetry !== void 0) {
|
|
3501
|
+
setTelemetryEnabled(!options.cliOptions.disableTelemetry);
|
|
3502
|
+
return;
|
|
3503
|
+
}
|
|
3610
3504
|
let mainConfig, configDir = options.cliOptions.configDir ?? options.presetOptions?.configDir ?? defaultConfigDir();
|
|
3611
3505
|
try {
|
|
3612
3506
|
mainConfig = await loadMainConfig({ configDir });
|
|
3613
3507
|
} catch {
|
|
3614
3508
|
}
|
|
3615
|
-
if (mainConfig)
|
|
3616
|
-
|
|
3617
|
-
|
|
3509
|
+
if (mainConfig) {
|
|
3510
|
+
setTelemetryEnabled(!mainConfig?.core?.disableTelemetry);
|
|
3511
|
+
return;
|
|
3512
|
+
}
|
|
3513
|
+
setTelemetryEnabled(options.fallbackTelemetryState ?? !1);
|
|
3618
3514
|
}
|
|
3619
3515
|
function isInterruptionError(error) {
|
|
3620
3516
|
if (!error || typeof error != "object")
|
|
@@ -3627,12 +3523,10 @@ async function withTelemetry(eventType, options, run) {
|
|
|
3627
3523
|
isTelemetryStateResolved() || await resolveTelemetryState(options);
|
|
3628
3524
|
let canceled = !1;
|
|
3629
3525
|
async function cancelTelemetry() {
|
|
3630
|
-
canceled = !0, await telemetry("canceled", { eventType }
|
|
3526
|
+
canceled = !0, await telemetry("canceled", { eventType }), process.exit(0);
|
|
3631
3527
|
}
|
|
3632
3528
|
let trackCancellation = CANCELLATION_TRACKED_EVENTS.includes(eventType);
|
|
3633
|
-
trackCancellation && process.on("SIGINT", cancelTelemetry),
|
|
3634
|
-
await sendTelemetryError(error, evtType, options);
|
|
3635
|
-
}), telemetry("boot", { eventType }, { stripMetadata: !0 });
|
|
3529
|
+
trackCancellation && process.on("SIGINT", cancelTelemetry), telemetry("boot", { eventType });
|
|
3636
3530
|
try {
|
|
3637
3531
|
return await withSpan(`forkbook ${eventType}`, { "forkbook.command": eventType }, run);
|
|
3638
3532
|
} catch (error) {
|
|
@@ -3651,7 +3545,7 @@ async function withTelemetry(eventType, options, run) {
|
|
|
3651
3545
|
let errors = ErrorCollector.getErrors();
|
|
3652
3546
|
for (let error of errors)
|
|
3653
3547
|
await sendTelemetryError(error, eventType, options, !1);
|
|
3654
|
-
process.off("SIGINT", cancelTelemetry)
|
|
3548
|
+
process.off("SIGINT", cancelTelemetry);
|
|
3655
3549
|
}
|
|
3656
3550
|
}
|
|
3657
3551
|
|
|
@@ -4947,7 +4841,7 @@ async function getRefsFromConfig(options) {
|
|
|
4947
4841
|
refs = await options.presets.apply("refs", {}) ?? {};
|
|
4948
4842
|
} catch (error) {
|
|
4949
4843
|
return logger8.warn(
|
|
4950
|
-
`Composed
|
|
4844
|
+
`Composed Forkbooks are left out of the docs toolset: reading "refs" failed. ${error instanceof Error ? error.message : String(error)}`
|
|
4951
4845
|
), [];
|
|
4952
4846
|
}
|
|
4953
4847
|
return Object.entries(refs).filter(([, ref]) => typeof ref?.url == "string" && ref.url.length > 0 && !ref.disable).map(([key, ref]) => ({
|
|
@@ -6567,418 +6461,6 @@ var reviewToolset = defineToolset({
|
|
|
6567
6461
|
}
|
|
6568
6462
|
});
|
|
6569
6463
|
|
|
6570
|
-
// src/core-server/utils/ghost-stories/get-candidates.ts
|
|
6571
|
-
import { readFile as readFile6 } from "node:fs/promises";
|
|
6572
|
-
import { babelParse, traverse } from "@aussieljk/forkbook/internal/babel";
|
|
6573
|
-
|
|
6574
|
-
// src/core-server/utils/ghost-stories/component-analyzer.ts
|
|
6575
|
-
var COMPLEXITY_CONFIG = {
|
|
6576
|
-
/** Weight applied to non-empty lines */
|
|
6577
|
-
locWeight: 1,
|
|
6578
|
-
/** Imports can be cheap, so they get a lower weight */
|
|
6579
|
-
importWeight: 0.5,
|
|
6580
|
-
/**
|
|
6581
|
-
* Defines what raw complexity value should map to the upper bound of a "simple" file For instance
|
|
6582
|
-
* 30 LOC + 4 imports = 32. This would result in a score of 0.3
|
|
6583
|
-
*/
|
|
6584
|
-
simpleBaseline: 32,
|
|
6585
|
-
simpleScore: 0.3
|
|
6586
|
-
}, getComponentComplexity = (fileContent) => {
|
|
6587
|
-
let lines = fileContent.split(`
|
|
6588
|
-
`), nonEmptyLines = lines.filter((line) => line.trim() !== "").length, importCount = lines.filter((line) => line.trim().startsWith("import")).length, normalizedScore = (nonEmptyLines * COMPLEXITY_CONFIG.locWeight + importCount * COMPLEXITY_CONFIG.importWeight) / (COMPLEXITY_CONFIG.simpleBaseline / COMPLEXITY_CONFIG.simpleScore);
|
|
6589
|
-
return Math.min(normalizedScore, 1);
|
|
6590
|
-
};
|
|
6591
|
-
|
|
6592
|
-
// src/core-server/utils/ghost-stories/get-candidates.ts
|
|
6593
|
-
function isValidCandidate(source) {
|
|
6594
|
-
let ast = babelParse(source), hasJSX = !1, hasExport = !1;
|
|
6595
|
-
return traverse(ast, {
|
|
6596
|
-
JSXElement(path3) {
|
|
6597
|
-
hasJSX = !0, hasExport && path3.stop();
|
|
6598
|
-
},
|
|
6599
|
-
JSXFragment(path3) {
|
|
6600
|
-
hasJSX = !0, hasExport && path3.stop();
|
|
6601
|
-
},
|
|
6602
|
-
ExportNamedDeclaration(path3) {
|
|
6603
|
-
hasExport = !0, hasJSX && path3.stop();
|
|
6604
|
-
},
|
|
6605
|
-
ExportDefaultDeclaration(path3) {
|
|
6606
|
-
hasExport = !0, hasJSX && path3.stop();
|
|
6607
|
-
},
|
|
6608
|
-
ExportAllDeclaration(path3) {
|
|
6609
|
-
hasExport = !0, hasJSX && path3.stop();
|
|
6610
|
-
}
|
|
6611
|
-
}), hasJSX && hasExport;
|
|
6612
|
-
}
|
|
6613
|
-
async function getCandidatesForStorybook(files2, sampleCount) {
|
|
6614
|
-
let simpleCandidates = [], analyzedCandidates = [];
|
|
6615
|
-
for (let file of files2) {
|
|
6616
|
-
let source;
|
|
6617
|
-
try {
|
|
6618
|
-
if (source = await readFile6(file, "utf-8"), !isValidCandidate(source))
|
|
6619
|
-
continue;
|
|
6620
|
-
} catch {
|
|
6621
|
-
continue;
|
|
6622
|
-
}
|
|
6623
|
-
let complexity = getComponentComplexity(source);
|
|
6624
|
-
if (analyzedCandidates.push({ file, complexity }), complexity < 0.3 && (simpleCandidates.push({ file, complexity }), simpleCandidates.length >= sampleCount))
|
|
6625
|
-
break;
|
|
6626
|
-
}
|
|
6627
|
-
let selectedCandidates = [];
|
|
6628
|
-
simpleCandidates.length >= sampleCount ? selectedCandidates = simpleCandidates.sort((a, b) => a.complexity - b.complexity).slice(0, sampleCount) : selectedCandidates = analyzedCandidates.sort((a, b) => a.complexity - b.complexity).slice(0, sampleCount);
|
|
6629
|
-
let avgComplexity = selectedCandidates.length > 0 ? Number(
|
|
6630
|
-
(selectedCandidates.reduce((acc, curr) => acc + curr.complexity, 0) / selectedCandidates.length).toFixed(2)
|
|
6631
|
-
) : 0;
|
|
6632
|
-
return {
|
|
6633
|
-
candidates: selectedCandidates.map(({ file }) => file),
|
|
6634
|
-
analyzedCount: analyzedCandidates.length,
|
|
6635
|
-
avgComplexity
|
|
6636
|
-
};
|
|
6637
|
-
}
|
|
6638
|
-
async function getComponentCandidates({
|
|
6639
|
-
sampleSize = 20,
|
|
6640
|
-
globPattern = "**/*.{tsx,jsx}",
|
|
6641
|
-
cwd = process.cwd()
|
|
6642
|
-
} = {}) {
|
|
6643
|
-
let globMatchCount = 0;
|
|
6644
|
-
try {
|
|
6645
|
-
let files2 = [];
|
|
6646
|
-
if (files2 = await glob(globPattern, {
|
|
6647
|
-
cwd,
|
|
6648
|
-
absolute: !0,
|
|
6649
|
-
expandDirectories: !1,
|
|
6650
|
-
ignore: [
|
|
6651
|
-
"**/node_modules/**",
|
|
6652
|
-
"**/.git/**",
|
|
6653
|
-
"**/dist/**",
|
|
6654
|
-
"**/__mocks__/**",
|
|
6655
|
-
"**/build/**",
|
|
6656
|
-
"**/forkbook-static/**",
|
|
6657
|
-
"**/*.test.*",
|
|
6658
|
-
"**/*.d.*",
|
|
6659
|
-
"**/*.config.*",
|
|
6660
|
-
"**/*.spec.*",
|
|
6661
|
-
"**/*.stories.*",
|
|
6662
|
-
// skip example story files that come from the CLI
|
|
6663
|
-
"**/stories/{Button,Header,Page}.*",
|
|
6664
|
-
"**/stories/{button,header,page}.*"
|
|
6665
|
-
]
|
|
6666
|
-
}), globMatchCount = files2.length, globMatchCount === 0)
|
|
6667
|
-
return {
|
|
6668
|
-
candidates: [],
|
|
6669
|
-
globMatchCount
|
|
6670
|
-
};
|
|
6671
|
-
let { analyzedCount, avgComplexity, candidates } = await getCandidatesForStorybook(
|
|
6672
|
-
files2,
|
|
6673
|
-
sampleSize
|
|
6674
|
-
);
|
|
6675
|
-
return {
|
|
6676
|
-
analyzedCount,
|
|
6677
|
-
avgComplexity,
|
|
6678
|
-
candidates,
|
|
6679
|
-
globMatchCount
|
|
6680
|
-
};
|
|
6681
|
-
} catch {
|
|
6682
|
-
return {
|
|
6683
|
-
candidates: [],
|
|
6684
|
-
error: "Failed to find candidates",
|
|
6685
|
-
globMatchCount
|
|
6686
|
-
};
|
|
6687
|
-
}
|
|
6688
|
-
}
|
|
6689
|
-
|
|
6690
|
-
// src/shared/utils/categorize-render-errors.ts
|
|
6691
|
-
var ERROR_CATEGORIES = {
|
|
6692
|
-
MISSING_PROVIDER: "MISSING_PROVIDER",
|
|
6693
|
-
MISSING_STATE_PROVIDER: "MISSING_STATE_PROVIDER",
|
|
6694
|
-
MISSING_ROUTER_PROVIDER: "MISSING_ROUTER_PROVIDER",
|
|
6695
|
-
MISSING_THEME_PROVIDER: "MISSING_THEME_PROVIDER",
|
|
6696
|
-
MISSING_TRANSLATION_PROVIDER: "MISSING_TRANSLATION_PROVIDER",
|
|
6697
|
-
MISSING_PORTAL_ROOT: "MISSING_PORTAL_ROOT",
|
|
6698
|
-
HOOK_USAGE_ERROR: "HOOK_USAGE_ERROR",
|
|
6699
|
-
MODULE_IMPORT_ERROR: "MODULE_IMPORT_ERROR",
|
|
6700
|
-
COMPONENT_RENDER_ERROR: "COMPONENT_RENDER_ERROR",
|
|
6701
|
-
SERVER_COMPONENTS_ERROR: "SERVER_COMPONENTS_ERROR",
|
|
6702
|
-
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
6703
|
-
// Vite related errors
|
|
6704
|
-
DYNAMIC_MODULE_IMPORT_ERROR: "DYNAMIC_MODULE_IMPORT_ERROR",
|
|
6705
|
-
// Vitest test run related errors
|
|
6706
|
-
TEST_FILE_IMPORT_ERROR: "TEST_FILE_IMPORT_ERROR"
|
|
6707
|
-
};
|
|
6708
|
-
function buildErrorContext(message, stack) {
|
|
6709
|
-
let normalizedMessage = message.toLowerCase(), normalizedStack = (stack ?? "").toLowerCase(), stackDeps = /* @__PURE__ */ new Set(), stackLines = normalizedStack.split(`
|
|
6710
|
-
`).filter(Boolean);
|
|
6711
|
-
for (let line of stackLines) {
|
|
6712
|
-
let depMatch = line.match(/\/deps\/([^:]+)\.js/);
|
|
6713
|
-
depMatch && stackDeps.add(depMatch[1]);
|
|
6714
|
-
}
|
|
6715
|
-
return {
|
|
6716
|
-
message,
|
|
6717
|
-
stack,
|
|
6718
|
-
normalizedMessage,
|
|
6719
|
-
normalizedStack,
|
|
6720
|
-
stackDeps
|
|
6721
|
-
};
|
|
6722
|
-
}
|
|
6723
|
-
var CATEGORIZATION_RULES = [
|
|
6724
|
-
{
|
|
6725
|
-
category: ERROR_CATEGORIES.MODULE_IMPORT_ERROR,
|
|
6726
|
-
priority: 100,
|
|
6727
|
-
match: (ctx) => ctx.normalizedMessage.includes("cannot find module") || ctx.normalizedMessage.includes("module not found") || ctx.normalizedMessage.includes("cannot resolve module")
|
|
6728
|
-
},
|
|
6729
|
-
{
|
|
6730
|
-
category: ERROR_CATEGORIES.TEST_FILE_IMPORT_ERROR,
|
|
6731
|
-
priority: 95,
|
|
6732
|
-
match: (ctx) => ctx.normalizedMessage.includes("failed to import test file")
|
|
6733
|
-
},
|
|
6734
|
-
{
|
|
6735
|
-
category: ERROR_CATEGORIES.DYNAMIC_MODULE_IMPORT_ERROR,
|
|
6736
|
-
priority: 95,
|
|
6737
|
-
match: (ctx) => ctx.normalizedMessage.includes("failed to fetch dynamically imported module")
|
|
6738
|
-
},
|
|
6739
|
-
{
|
|
6740
|
-
category: ERROR_CATEGORIES.HOOK_USAGE_ERROR,
|
|
6741
|
-
priority: 90,
|
|
6742
|
-
match: (ctx) => ctx.normalizedMessage.includes("invalid hook call") || ctx.normalizedMessage.includes("rendered more hooks") || ctx.normalizedMessage.includes("hooks can only be called") || ctx.normalizedMessage.includes("too many re-renders") || ctx.normalizedMessage.includes("maximum update depth exceeded") || ctx.normalizedMessage.includes("hook") && ctx.normalizedMessage.includes("function component")
|
|
6743
|
-
},
|
|
6744
|
-
{
|
|
6745
|
-
category: ERROR_CATEGORIES.MISSING_STATE_PROVIDER,
|
|
6746
|
-
priority: 85,
|
|
6747
|
-
match: (ctx) => Array.from(ctx.stackDeps).some(isStateManagementPackage) && (ctx.normalizedMessage.includes("context") || ctx.normalizedMessage.includes("undefined") || ctx.normalizedMessage.includes("null"))
|
|
6748
|
-
},
|
|
6749
|
-
{
|
|
6750
|
-
category: ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER,
|
|
6751
|
-
priority: 85,
|
|
6752
|
-
match: (ctx) => Array.from(ctx.stackDeps).some(isRouterPackage) || ctx.normalizedMessage.includes("usenavigate") || ctx.normalizedMessage.includes("router")
|
|
6753
|
-
},
|
|
6754
|
-
{
|
|
6755
|
-
category: ERROR_CATEGORIES.SERVER_COMPONENTS_ERROR,
|
|
6756
|
-
priority: 85,
|
|
6757
|
-
match: (ctx) => ctx.normalizedMessage.includes("server components") || ctx.normalizedMessage.includes("use client") || ctx.normalizedMessage.includes("async/await") && ctx.normalizedMessage.includes("not supported")
|
|
6758
|
-
},
|
|
6759
|
-
{
|
|
6760
|
-
category: ERROR_CATEGORIES.MISSING_THEME_PROVIDER,
|
|
6761
|
-
priority: 80,
|
|
6762
|
-
match: (ctx) => Array.from(ctx.stackDeps).some(isStylingPackage) && (ctx.normalizedMessage.includes("theme") || ctx.normalizedMessage.includes("undefined")) || ctx.normalizedMessage.includes("usetheme") || ctx.normalizedMessage.includes("theme") && ctx.normalizedMessage.includes("provider")
|
|
6763
|
-
},
|
|
6764
|
-
{
|
|
6765
|
-
category: ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER,
|
|
6766
|
-
priority: 80,
|
|
6767
|
-
match: (ctx) => Array.from(ctx.stackDeps).some(isI18nPackage) || ctx.normalizedMessage.includes("i18n") || ctx.normalizedMessage.includes("translation") || ctx.normalizedMessage.includes("locale")
|
|
6768
|
-
},
|
|
6769
|
-
{
|
|
6770
|
-
category: ERROR_CATEGORIES.MISSING_PORTAL_ROOT,
|
|
6771
|
-
priority: 70,
|
|
6772
|
-
match: (ctx) => ctx.normalizedMessage.includes("target container is not a dom element") || ctx.normalizedMessage.includes("portal") && (ctx.normalizedMessage.includes("container") || ctx.normalizedMessage.includes("root"))
|
|
6773
|
-
},
|
|
6774
|
-
{
|
|
6775
|
-
category: ERROR_CATEGORIES.MISSING_PROVIDER,
|
|
6776
|
-
priority: 60,
|
|
6777
|
-
match: (ctx) => ctx.normalizedMessage.includes("use") && ctx.normalizedMessage.includes("provider") || ctx.normalizedMessage.includes("<provider>") || ctx.normalizedMessage.includes("no provider") || ctx.normalizedMessage.includes("without a provider") || (ctx.normalizedMessage.includes("could not find") || ctx.normalizedMessage.includes("missing") || ctx.normalizedMessage.includes("not found")) && ctx.normalizedMessage.includes("context") || ctx.normalizedMessage.includes("context") && (ctx.normalizedMessage.includes("null") || ctx.normalizedMessage.includes("undefined"))
|
|
6778
|
-
},
|
|
6779
|
-
{
|
|
6780
|
-
category: ERROR_CATEGORIES.COMPONENT_RENDER_ERROR,
|
|
6781
|
-
priority: 10,
|
|
6782
|
-
match: (ctx) => ctx.normalizedMessage.includes("cannot read") || ctx.normalizedMessage.includes("is not a function") || ctx.normalizedMessage.includes("is not an object") || ctx.normalizedMessage.includes("is not defined") || ctx.normalizedMessage.includes("element type is invalid") || ctx.normalizedMessage.includes("objects are not valid as a react child") || ctx.normalizedMessage.includes("maximum call stack") || ctx.normalizedMessage.includes("render")
|
|
6783
|
-
}
|
|
6784
|
-
], RULES = CATEGORIZATION_RULES.sort((a, b) => b.priority - a.priority);
|
|
6785
|
-
function categorizeError(message, stack) {
|
|
6786
|
-
let ctx = buildErrorContext(message, stack), rule = RULES.find((r) => r.match(ctx));
|
|
6787
|
-
if (!rule)
|
|
6788
|
-
return { category: ERROR_CATEGORIES.UNKNOWN_ERROR, matchedDependencies: [] };
|
|
6789
|
-
let matchedDependencies = getMatchedDependencies(rule.category, ctx);
|
|
6790
|
-
return { category: rule.category, matchedDependencies };
|
|
6791
|
-
}
|
|
6792
|
-
function getMatchedDependencies(category, ctx) {
|
|
6793
|
-
switch (category) {
|
|
6794
|
-
case ERROR_CATEGORIES.MISSING_STATE_PROVIDER:
|
|
6795
|
-
return Array.from(ctx.stackDeps).filter(isStateManagementPackage);
|
|
6796
|
-
case ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER:
|
|
6797
|
-
return Array.from(ctx.stackDeps).filter(isRouterPackage);
|
|
6798
|
-
case ERROR_CATEGORIES.MISSING_THEME_PROVIDER:
|
|
6799
|
-
return Array.from(ctx.stackDeps).filter(isStylingPackage);
|
|
6800
|
-
case ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER:
|
|
6801
|
-
return Array.from(ctx.stackDeps).filter(isI18nPackage);
|
|
6802
|
-
default:
|
|
6803
|
-
return [];
|
|
6804
|
-
}
|
|
6805
|
-
}
|
|
6806
|
-
|
|
6807
|
-
// src/shared/utils/analyze-test-results.ts
|
|
6808
|
-
function extractCategorizedErrors(testResults) {
|
|
6809
|
-
let failed = testResults.filter((r) => r.status === "FAIL" && r.error), map = /* @__PURE__ */ new Map(), uniqueErrorMessages = /* @__PURE__ */ new Set();
|
|
6810
|
-
for (let r of failed) {
|
|
6811
|
-
let { category, matchedDependencies } = categorizeError(r.error, r.stack);
|
|
6812
|
-
map.has(category) || map.set(category, { count: 0, uniqueErrors: /* @__PURE__ */ new Set(), matchedDependencies: /* @__PURE__ */ new Set() });
|
|
6813
|
-
let data = map.get(category);
|
|
6814
|
-
data.count++, matchedDependencies.forEach((dep) => data.matchedDependencies.add(dep)), uniqueErrorMessages.add(r.error), data.uniqueErrors.add(r.error);
|
|
6815
|
-
}
|
|
6816
|
-
let categorizedErrors = Array.from(map.entries()).reduce(
|
|
6817
|
-
(acc, [category, data]) => (acc[category] = {
|
|
6818
|
-
uniqueCount: data.uniqueErrors.size,
|
|
6819
|
-
count: data.count,
|
|
6820
|
-
matchedDependencies: Array.from(data.matchedDependencies).sort()
|
|
6821
|
-
}, acc),
|
|
6822
|
-
{}
|
|
6823
|
-
);
|
|
6824
|
-
return {
|
|
6825
|
-
totalErrors: failed.length,
|
|
6826
|
-
uniqueErrorCount: uniqueErrorMessages.size,
|
|
6827
|
-
categorizedErrors
|
|
6828
|
-
};
|
|
6829
|
-
}
|
|
6830
|
-
var CSS_CHECK_STORY_ID_SUFFIX = "--css-check";
|
|
6831
|
-
function summarizeResults(results) {
|
|
6832
|
-
let total = results.length, passed = results.filter((r) => r.status === "PASS").length, passedButEmptyRender = results.filter((r) => r.status === "PASS" && r.emptyRender).length, successRate = total > 0 ? parseFloat((passed / total).toFixed(2)) : 0, successRateWithoutEmptyRender = total > 0 ? parseFloat(((passed - passedButEmptyRender) / total).toFixed(2)) : 0, errorClassification = extractCategorizedErrors(results), cssCheckMatch = results.find(
|
|
6833
|
-
(r) => r.storyId.toLowerCase().endsWith(CSS_CHECK_STORY_ID_SUFFIX)
|
|
6834
|
-
), cssCheck = cssCheckMatch?.status === "PASS" ? "pass" : cssCheckMatch?.status === "FAIL" ? "fail" : "not-run";
|
|
6835
|
-
return {
|
|
6836
|
-
total,
|
|
6837
|
-
passed,
|
|
6838
|
-
passedButEmptyRender,
|
|
6839
|
-
successRate,
|
|
6840
|
-
successRateWithoutEmptyRender,
|
|
6841
|
-
uniqueErrorCount: errorClassification.uniqueErrorCount,
|
|
6842
|
-
categorizedErrors: errorClassification.categorizedErrors,
|
|
6843
|
-
cssCheck
|
|
6844
|
-
};
|
|
6845
|
-
}
|
|
6846
|
-
function analyzeTestResults(results, cumulativeResults) {
|
|
6847
|
-
let run = summarizeResults(results), analysis = {
|
|
6848
|
-
total: run.total,
|
|
6849
|
-
passed: run.passed,
|
|
6850
|
-
passedButEmptyRender: run.passedButEmptyRender,
|
|
6851
|
-
successRate: run.successRate,
|
|
6852
|
-
successRateWithoutEmptyRender: run.successRateWithoutEmptyRender,
|
|
6853
|
-
uniqueErrorCount: run.uniqueErrorCount,
|
|
6854
|
-
categorizedErrors: run.categorizedErrors,
|
|
6855
|
-
cssCheck: run.cssCheck
|
|
6856
|
-
};
|
|
6857
|
-
if (cumulativeResults) {
|
|
6858
|
-
let cumulative = summarizeResults(cumulativeResults);
|
|
6859
|
-
analysis.cumulativeTotal = cumulative.total, analysis.cumulativePassed = cumulative.passed, analysis.cumulativePassedButEmptyRender = cumulative.passedButEmptyRender, analysis.cumulativeSuccessRate = cumulative.successRate, analysis.cumulativeSuccessRateWithoutEmptyRender = cumulative.successRateWithoutEmptyRender, analysis.cumulativeUniqueErrorCount = cumulative.uniqueErrorCount, analysis.cumulativeCategorizedErrors = cumulative.categorizedErrors, analysis.cumulativeCssCheck = cumulative.cssCheck;
|
|
6860
|
-
}
|
|
6861
|
-
return analysis;
|
|
6862
|
-
}
|
|
6863
|
-
|
|
6864
|
-
// src/shared/utils/to-story-test-result.ts
|
|
6865
|
-
var DEBUG_BANNER_RE = /^\n(?:\x1B\[\d+m)?Click to debug\b[^\n]*\n\n/;
|
|
6866
|
-
function extractErrorMessage(message, stack) {
|
|
6867
|
-
return (message ?? "").replace(DEBUG_BANNER_RE, "").split(`
|
|
6868
|
-
`)[0] || stack?.split(`
|
|
6869
|
-
`)[0] || "unknown error";
|
|
6870
|
-
}
|
|
6871
|
-
function detectEmptyRender(reports) {
|
|
6872
|
-
return reports?.some(
|
|
6873
|
-
(report) => report.type === "render-analysis" && report.result?.emptyRender === !0
|
|
6874
|
-
) ?? !1;
|
|
6875
|
-
}
|
|
6876
|
-
function normalizeStatus(statusRaw) {
|
|
6877
|
-
return statusRaw === "passed" ? "PASS" : statusRaw === "failed" ? "FAIL" : "PENDING";
|
|
6878
|
-
}
|
|
6879
|
-
function toStoryTestResult(input) {
|
|
6880
|
-
if (!input.storyId)
|
|
6881
|
-
return null;
|
|
6882
|
-
let status = normalizeStatus(input.statusRaw), emptyRender = status === "PASS" && detectEmptyRender(input.reports), error, stack;
|
|
6883
|
-
if (input.errors && input.errors.length > 0) {
|
|
6884
|
-
let firstError = input.errors[0];
|
|
6885
|
-
error = extractErrorMessage(firstError.message, firstError.stack), stack = firstError.stack ?? firstError.message;
|
|
6886
|
-
}
|
|
6887
|
-
return {
|
|
6888
|
-
storyId: input.storyId,
|
|
6889
|
-
status,
|
|
6890
|
-
error,
|
|
6891
|
-
stack,
|
|
6892
|
-
emptyRender: emptyRender || void 0
|
|
6893
|
-
};
|
|
6894
|
-
}
|
|
6895
|
-
|
|
6896
|
-
// src/core-server/utils/ghost-stories/run-story-tests.ts
|
|
6897
|
-
import { existsSync as existsSync4 } from "node:fs";
|
|
6898
|
-
import { mkdir as mkdir2, readFile as readFile7 } from "node:fs/promises";
|
|
6899
|
-
import { executeCommand, resolvePathInStorybookCache as resolvePathInStorybookCache2 } from "@aussieljk/forkbook/internal/common";
|
|
6900
|
-
import { join as join11 } from "pathe";
|
|
6901
|
-
|
|
6902
|
-
// src/core-server/utils/ghost-stories/parse-vitest-report.ts
|
|
6903
|
-
function parseVitestResults(report) {
|
|
6904
|
-
let storyTestResults = [];
|
|
6905
|
-
for (let testSuite of report.testResults)
|
|
6906
|
-
for (let assertion of testSuite.assertionResults) {
|
|
6907
|
-
let result = toStoryTestResult({
|
|
6908
|
-
storyId: assertion.meta?.storyId ?? assertion.fullName,
|
|
6909
|
-
statusRaw: assertion.status,
|
|
6910
|
-
reports: assertion.meta?.reports,
|
|
6911
|
-
errors: assertion.failureMessages?.map((message) => ({ stack: message }))
|
|
6912
|
-
});
|
|
6913
|
-
result && storyTestResults.push(result);
|
|
6914
|
-
}
|
|
6915
|
-
return {
|
|
6916
|
-
summary: analyzeTestResults(storyTestResults)
|
|
6917
|
-
};
|
|
6918
|
-
}
|
|
6919
|
-
|
|
6920
|
-
// src/core-server/utils/ghost-stories/run-story-tests.ts
|
|
6921
|
-
async function runStoryTests(componentFilePaths, options) {
|
|
6922
|
-
let cwd = options?.cwd;
|
|
6923
|
-
try {
|
|
6924
|
-
let cacheDir2 = resolvePathInStorybookCache2("story-tests");
|
|
6925
|
-
await mkdir2(cacheDir2, { recursive: !0 });
|
|
6926
|
-
let timestamp = Date.now(), outputFile = join11(cacheDir2, `test-results-${timestamp}.json`), startTime = Date.now(), testFailureMessage;
|
|
6927
|
-
try {
|
|
6928
|
-
await executeCommand({
|
|
6929
|
-
command: "npx",
|
|
6930
|
-
args: [
|
|
6931
|
-
"vitest",
|
|
6932
|
-
"run",
|
|
6933
|
-
"--reporter=json",
|
|
6934
|
-
"--testTimeout=1000",
|
|
6935
|
-
`--outputFile=${outputFile}`,
|
|
6936
|
-
...componentFilePaths
|
|
6937
|
-
],
|
|
6938
|
-
cwd,
|
|
6939
|
-
stdio: "pipe",
|
|
6940
|
-
env: {
|
|
6941
|
-
FORKBOOK_INTERNAL_TEST_RUN: "1",
|
|
6942
|
-
...options?.ghostRun ? { FORKBOOK_COMPONENT_PATHS: componentFilePaths.join(";") } : {}
|
|
6943
|
-
}
|
|
6944
|
-
});
|
|
6945
|
-
} catch (error) {
|
|
6946
|
-
let errorMessage = (error.stderr || String(error) || "").toLowerCase();
|
|
6947
|
-
errorMessage.includes("browsertype.launch") ? testFailureMessage = "Playwright is not installed" : errorMessage.includes("startup error") ? testFailureMessage = "Startup Error" : errorMessage.includes("no tests found") ? testFailureMessage = "No tests found" : errorMessage.includes("test timeout") ? testFailureMessage = "Test timeout" : errorMessage.includes("react-native-web") ? testFailureMessage = "React Native Web error" : errorMessage.includes("unhandled rejection") && (testFailureMessage = "Unhandled Rejection");
|
|
6948
|
-
}
|
|
6949
|
-
let duration = Date.now() - startTime;
|
|
6950
|
-
if (testFailureMessage)
|
|
6951
|
-
return {
|
|
6952
|
-
duration,
|
|
6953
|
-
runError: testFailureMessage
|
|
6954
|
-
};
|
|
6955
|
-
if (!existsSync4(outputFile))
|
|
6956
|
-
return {
|
|
6957
|
-
duration,
|
|
6958
|
-
runError: "JSON report not found"
|
|
6959
|
-
};
|
|
6960
|
-
let vitestReport;
|
|
6961
|
-
try {
|
|
6962
|
-
let resultsJson = await readFile7(outputFile, "utf8");
|
|
6963
|
-
vitestReport = JSON.parse(resultsJson);
|
|
6964
|
-
} catch {
|
|
6965
|
-
return {
|
|
6966
|
-
duration,
|
|
6967
|
-
runError: "Failed to read or parse JSON report"
|
|
6968
|
-
};
|
|
6969
|
-
}
|
|
6970
|
-
return !vitestReport.testResults || vitestReport.testResults.length === 0 ? {
|
|
6971
|
-
duration,
|
|
6972
|
-
runError: "No tests found"
|
|
6973
|
-
} : { ...parseVitestResults(vitestReport), duration };
|
|
6974
|
-
} catch {
|
|
6975
|
-
return {
|
|
6976
|
-
runError: "Uncaught error running story tests",
|
|
6977
|
-
duration: 0
|
|
6978
|
-
};
|
|
6979
|
-
}
|
|
6980
|
-
}
|
|
6981
|
-
|
|
6982
6464
|
// src/shared/open-service/services/story-docs/snippet.ts
|
|
6983
6465
|
function prependImportToSnippet(importBlock, snippet) {
|
|
6984
6466
|
let trimmedImport = importBlock?.trim();
|
|
@@ -7016,14 +6498,11 @@ export {
|
|
|
7016
6498
|
getChangeDetectionReadiness,
|
|
7017
6499
|
setChangeDetectionReadiness,
|
|
7018
6500
|
resetChangeDetectionReadiness,
|
|
6501
|
+
getOrRecreateStore,
|
|
7019
6502
|
getStatusStoreByTypeId,
|
|
7020
6503
|
getSyncedStatuses,
|
|
7021
6504
|
fullStatusStore,
|
|
7022
6505
|
universalStatusStore,
|
|
7023
|
-
startTestProviderStore,
|
|
7024
|
-
getTestProviderStoreById,
|
|
7025
|
-
fullTestProviderStore,
|
|
7026
|
-
universalTestProviderStore,
|
|
7027
6506
|
getWsToken,
|
|
7028
6507
|
getErrorLevel,
|
|
7029
6508
|
sendTelemetryError,
|
|
@@ -7040,9 +6519,5 @@ export {
|
|
|
7040
6519
|
createLocalDocsAccess,
|
|
7041
6520
|
getRefsFromConfig,
|
|
7042
6521
|
createStoriesToolset,
|
|
7043
|
-
reviewToolset
|
|
7044
|
-
getComponentCandidates,
|
|
7045
|
-
analyzeTestResults,
|
|
7046
|
-
toStoryTestResult,
|
|
7047
|
-
runStoryTests
|
|
6522
|
+
reviewToolset
|
|
7048
6523
|
};
|