@aussieljk/forkbook 0.0.1-2 → 0.0.1-20
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/LICENSE +1 -1
- package/README.md +35 -53
- package/assets/addon-vitest/templates/vitest.config.4.template.ts +2 -2
- package/assets/browser/favicon-wrapper.svg +4 -4
- package/assets/browser/favicon.svg +1 -1
- package/assets/browser/inter-LICENSE.txt +92 -0
- package/assets/browser/inter-variable-italic.woff2 +0 -0
- package/assets/browser/inter-variable.woff2 +0 -0
- package/assets/browser/mirror-ball.png +0 -0
- package/assets/builder-vite/iframe.html +8 -24
- package/assets/create/rendererAssets/common/Configure.mdx +100 -100
- package/assets/create/rendererAssets/common/button.css +7 -7
- package/assets/create/rendererAssets/common/header.css +6 -6
- package/assets/create/rendererAssets/common/page.css +12 -12
- package/assets/create/templates/react-native/index.expo.js +4 -4
- package/assets/create/templates/react-native/index.js +5 -5
- package/assets/server/base-preview-body.html +32 -32
- package/assets/server/base-preview-head.html +86 -86
- package/assets/server/template.ejs +31 -26
- package/dist/_browser-chunks/{Color-PCLE2J36.js → Color-KALNKPOV.js} +8 -8
- package/dist/_browser-chunks/{DocsRenderer-JXND3PVQ.js → DocsRenderer-DKXSW2OY.js} +2 -2
- package/dist/_browser-chunks/WithTooltip-66AWY4VQ.js +199 -0
- package/dist/_browser-chunks/{chunk-RBCHTR7C.js → chunk-2ELGJRFZ.js} +1 -1
- package/dist/_browser-chunks/{chunk-PFRNG3UC.js → chunk-2WZWS7GJ.js} +5 -5
- package/dist/_browser-chunks/{chunk-52CW7FF7.js → chunk-3QNZOMD7.js} +8 -3
- package/dist/_browser-chunks/{chunk-LV5PIKV4.js → chunk-3QPZOXB7.js} +6 -8
- package/dist/_browser-chunks/{chunk-ODVJ3XZJ.js → chunk-4BOJAE7P.js} +14 -10
- package/dist/_browser-chunks/{chunk-2MEPHP35.js → chunk-4KIQBRD2.js} +1 -1
- package/dist/_browser-chunks/chunk-4ZGQ4YQ2.js +20 -0
- package/dist/_browser-chunks/chunk-6AKCRYVX.js +6 -0
- package/dist/_browser-chunks/{chunk-W5M6NPS3.js → chunk-6SL45YM3.js} +15 -18
- package/dist/_browser-chunks/{chunk-2SCZVUKW.js → chunk-AN2LJG5I.js} +1 -1
- package/dist/_browser-chunks/{chunk-P6PK47TQ.js → chunk-BLCZ3C5M.js} +48 -83
- package/dist/_browser-chunks/{chunk-RSPAQWVJ.js → chunk-BNP234B4.js} +1 -1
- package/dist/_browser-chunks/{chunk-JYVGARBG.js → chunk-CX37N6FG.js} +770 -720
- package/dist/_browser-chunks/{chunk-JSBKXXXF.js → chunk-DHTLVXAL.js} +38 -45
- package/dist/_browser-chunks/{chunk-GNZY6LOW.js → chunk-DISGPOF4.js} +54 -51
- package/dist/_browser-chunks/chunk-DNJ3OSLB.js +6021 -0
- package/dist/_browser-chunks/{chunk-6SXYJQST.js → chunk-E6QKKKLO.js} +21 -6
- package/dist/_browser-chunks/{chunk-FJGWSWL5.js → chunk-EBSOKHFG.js} +10 -4
- package/dist/_browser-chunks/{chunk-CFAOWGL7.js → chunk-ECMVTOVD.js} +1 -1
- package/dist/_browser-chunks/{chunk-CFWWCCZV.js → chunk-ENHFQXYS.js} +9 -7
- package/dist/_browser-chunks/{chunk-YTIT5NA5.js → chunk-EW2M3URL.js} +91 -84
- package/dist/_browser-chunks/{chunk-MFMDGWP6.js → chunk-FCULT3AE.js} +3 -3
- package/dist/_browser-chunks/{chunk-46Z7NGAS.js → chunk-HX443LKV.js} +1 -1
- package/dist/_browser-chunks/chunk-HZFHNYRC.js +53 -0
- package/dist/_browser-chunks/chunk-IFADVEQE.js +669 -0
- package/dist/_browser-chunks/{chunk-OQWFVDIN.js → chunk-KQJ4T6JL.js} +31 -25
- package/dist/_browser-chunks/{chunk-RNTIV5CE.js → chunk-LYYXDWR2.js} +9 -9
- package/dist/_browser-chunks/{chunk-V5M7Q4HT.js → chunk-MJIDTL3X.js} +4 -14
- package/dist/_browser-chunks/{chunk-V2G23FV7.js → chunk-N5WQGLI7.js} +1 -1
- package/dist/_browser-chunks/{chunk-EIYAKDGP.js → chunk-NA4ITZTK.js} +127 -105
- package/dist/_browser-chunks/{chunk-RMYQ3QN3.js → chunk-NK5SGJNG.js} +22 -17
- package/dist/_browser-chunks/chunk-NPNIBOPF.js +18 -0
- package/dist/_browser-chunks/{chunk-YEKO6BHJ.js → chunk-ONTSNQON.js} +1 -1
- package/dist/_browser-chunks/chunk-OOETBSA7.js +502 -0
- package/dist/_browser-chunks/{chunk-KQ7CRO2B.js → chunk-OWWV6YG7.js} +12 -12
- package/dist/_browser-chunks/chunk-PFYL47RM.js +45 -0
- package/dist/_browser-chunks/{chunk-OD6IBQCC.js → chunk-PQRPDA4U.js} +5 -5
- package/dist/_browser-chunks/{chunk-2JDQ35OA.js → chunk-PU7D2WDP.js} +0 -11
- package/dist/_browser-chunks/chunk-PZQRXPVR.js +21 -0
- package/dist/_browser-chunks/{chunk-5WMXI5GW.js → chunk-QFO2B4X2.js} +31 -28
- package/dist/_browser-chunks/{chunk-2JT76G3E.js → chunk-SBOQ4QPY.js} +15 -15
- package/dist/_browser-chunks/{chunk-C3D4HEFY.js → chunk-TRXLBGLS.js} +344 -166
- package/dist/_browser-chunks/{chunk-ZTQ5MEJ5.js → chunk-UMGDO2ZM.js} +3 -37
- package/dist/_browser-chunks/{chunk-5I7E4GMO.js → chunk-WY2LUGOH.js} +1 -1
- package/dist/_browser-chunks/chunk-XKTORVEQ.js +255 -0
- package/dist/_browser-chunks/chunk-XSVERCGB.js +91 -0
- package/dist/_browser-chunks/{chunk-FVSEPWWX.js → chunk-XTQCLWVH.js} +325 -1635
- package/dist/_browser-chunks/{chunk-MDOL7KML.js → chunk-YJO5BK52.js} +7 -3
- package/dist/_browser-chunks/{chunk-66OCZ54D.js → chunk-ZF37BMDS.js} +6 -2
- 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-I2G4WLJI.js → attached-runtime-YD6HKC4B.js} +33 -31
- package/dist/_node-chunks/builder-manager-UNJGYVTD.js +1176 -0
- package/dist/_node-chunks/chunk-25A7444H.js +47 -0
- package/dist/_node-chunks/{chunk-U5W53R2J.js → chunk-2CNN3CRI.js} +506 -494
- package/dist/_node-chunks/{chunk-VLOXOXXE.js → chunk-2GA4VQCS.js} +9 -9
- package/dist/_node-chunks/{chunk-YZFWBA5L.js → chunk-2VJHCGAK.js} +368 -321
- package/dist/_node-chunks/{chunk-FK7KGTV7.js → chunk-33I6AQU7.js} +7 -7
- package/dist/_node-chunks/{chunk-6YKBRP72.js → chunk-3CQI3JH5.js} +6 -6
- package/dist/_node-chunks/{chunk-IK4FGZLR.js → chunk-3ZOSFS7G.js} +6 -6
- package/dist/_node-chunks/{chunk-DUR55DJJ.js → chunk-4BE3LRIQ.js} +86 -67
- package/dist/_node-chunks/{chunk-Q7QNUM5H.js → chunk-5LFJQCYN.js} +6 -6
- package/dist/_node-chunks/{chunk-3Y6AAY5H.js → chunk-65X3MXFT.js} +8 -8
- package/dist/_node-chunks/chunk-6FWJWEAG.js +52 -0
- package/dist/_node-chunks/{chunk-UVINFLGY.js → chunk-6NLQCV6A.js} +7 -7
- package/dist/_node-chunks/{chunk-KISMCCP5.js → chunk-6OQKMJJA.js} +474 -479
- package/dist/_node-chunks/{chunk-XLP2ZKXV.js → chunk-6RYD6ENB.js} +7 -7
- package/dist/_node-chunks/{chunk-V2DY426G.js → chunk-75TTPKEA.js} +283 -306
- package/dist/_node-chunks/{chunk-3W7F2B7P.js → chunk-7CWDZLIZ.js} +6 -6
- package/dist/_node-chunks/{chunk-FPZB5OI7.js → chunk-7M3TOE4F.js} +6 -6
- package/dist/_node-chunks/{chunk-DC7DKR5K.js → chunk-AGLGQNTY.js} +6 -6
- package/dist/_node-chunks/{chunk-NIBT7XDZ.js → chunk-AOYLA323.js} +9 -6
- package/dist/_node-chunks/{chunk-RRN2V55B.js → chunk-AP4HJ3I3.js} +7 -7
- package/dist/_node-chunks/chunk-AVHJZUTH.js +2613 -0
- package/dist/_node-chunks/{chunk-H32DYT6P.js → chunk-B2EEX2SZ.js} +6 -6
- package/dist/_node-chunks/chunk-CGVVOUBC.js +18 -0
- package/dist/_node-chunks/{chunk-B5J7Q7J4.js → chunk-CJDYU653.js} +6 -6
- package/dist/_node-chunks/{chunk-XHL2LVBM.js → chunk-CPDP5SQS.js} +14 -16
- package/dist/_node-chunks/{chunk-LO56I6E2.js → chunk-DAYTIH6Z.js} +10 -10
- package/dist/_node-chunks/{chunk-FW2HQUBQ.js → chunk-DO3CPQAZ.js} +6 -6
- package/dist/_node-chunks/chunk-DQEUNKLX.js +347 -0
- package/dist/_node-chunks/{chunk-BS2WMZMR.js → chunk-EFCBUWOB.js} +7 -7
- package/dist/_node-chunks/{chunk-OWNFOGTA.js → chunk-EG2WLN5V.js} +7 -7
- package/dist/_node-chunks/{chunk-LCK4ZQKG.js → chunk-EKYNX5NX.js} +9 -9
- package/dist/_node-chunks/{chunk-TNJIXE37.js → chunk-F762PHMI.js} +6 -6
- package/dist/_node-chunks/{chunk-ET7PWEO7.js → chunk-FC3V4KZO.js} +14 -13
- package/dist/_node-chunks/chunk-FXW52X4U.js +281 -0
- package/dist/_node-chunks/{chunk-TD5PLLQG.js → chunk-GEJBTN76.js} +62 -7
- package/dist/_node-chunks/chunk-GFEH7IBP.js +620 -0
- package/dist/_node-chunks/{chunk-TWI4GVH7.js → chunk-GWT4HQZU.js} +6 -6
- package/dist/_node-chunks/{chunk-4FEANXWU.js → chunk-HHM5X5RQ.js} +140 -118
- package/dist/_node-chunks/{chunk-MA24JW6C.js → chunk-IBLUURAJ.js} +25 -8
- package/dist/_node-chunks/{chunk-2BUPBPFB.js → chunk-IENHXJVB.js} +7 -7
- package/dist/_node-chunks/{chunk-EWOX7HPJ.js → chunk-IIGBIVK3.js} +6 -6
- package/dist/_node-chunks/{chunk-XGIUVY52.js → chunk-J6FGP2VM.js} +7 -7
- package/dist/_node-chunks/chunk-JOX7OETB.js +534 -0
- package/dist/_node-chunks/{chunk-RXNJDRGO.js → chunk-JR7ZCQ77.js} +21 -25
- package/dist/_node-chunks/{chunk-OISX4AGQ.js → chunk-JXZONVHW.js} +37 -31
- package/dist/_node-chunks/{chunk-34EO2PUT.js → chunk-KAALBGRE.js} +6 -6
- package/dist/_node-chunks/{chunk-SLWQNBGO.js → chunk-L52VGA36.js} +34 -949
- package/dist/_node-chunks/chunk-LAJIVWUF.js +497 -0
- package/dist/_node-chunks/{chunk-JGGFYIG5.js → chunk-LCNF6BLP.js} +7 -7
- package/dist/_node-chunks/chunk-LGHTKFSF.js +405 -0
- package/dist/_node-chunks/{chunk-WCULS5TP.js → chunk-LNGSV5UI.js} +7 -7
- package/dist/_node-chunks/{chunk-HMP2G23X.js → chunk-MC4BFUVH.js} +6 -6
- package/dist/_node-chunks/{chunk-SWO5CDYU.js → chunk-MWKSSYPG.js} +8 -8
- package/dist/_node-chunks/{chunk-2DSIDINN.js → chunk-N25CZ3RC.js} +650 -9
- package/dist/_node-chunks/{chunk-WZJF2OUH.js → chunk-N4LNGTYL.js} +7 -7
- package/dist/_node-chunks/{chunk-XI6B6P47.js → chunk-N5WU4BEY.js} +6 -6
- package/dist/_node-chunks/{chunk-TINO74G5.js → chunk-NRXCMSAI.js} +6 -6
- package/dist/_node-chunks/{chunk-E6YESGLX.js → chunk-NZWK62R5.js} +542 -1049
- package/dist/_node-chunks/{chunk-DHJFTB4K.js → chunk-OBPVOYJA.js} +7 -7
- package/dist/_node-chunks/{chunk-6KEHV53S.js → chunk-OMMQME7G.js} +33 -41
- package/dist/_node-chunks/chunk-PJRPETSU.js +62 -0
- package/dist/_node-chunks/{chunk-7GUDZVRQ.js → chunk-QDVIQG3B.js} +6 -6
- package/dist/_node-chunks/{chunk-OUW6R7C3.js → chunk-QEYWG5C7.js} +6 -6
- package/dist/_node-chunks/{chunk-GRBLDJCR.js → chunk-QQNRWEHL.js} +132 -149
- package/dist/_node-chunks/{chunk-EHUNOMDD.js → chunk-RAIWLNFA.js} +29849 -51588
- package/dist/_node-chunks/{chunk-JZOO7GGC.js → chunk-S7RGKBGT.js} +6 -6
- package/dist/_node-chunks/{chunk-GEFQN7K3.js → chunk-SFXFL4TP.js} +8 -8
- package/dist/_node-chunks/{chunk-JDXXX6LB.js → chunk-SPAHK37C.js} +6 -6
- package/dist/_node-chunks/chunk-SUQ4OM7Y.js +49 -0
- package/dist/_node-chunks/chunk-U54Q3F7E.js +20 -0
- package/dist/_node-chunks/{chunk-RWFIFGO5.js → chunk-UZH2V3WY.js} +8 -8
- package/dist/_node-chunks/{chunk-SVTBJ7Q3.js → chunk-VIMGLCNZ.js} +6 -6
- package/dist/_node-chunks/{chunk-BSKFCWQD.js → chunk-VNZF62KE.js} +7 -7
- package/dist/_node-chunks/{chunk-CCOTJ4FC.js → chunk-VPFU5CEP.js} +10 -10
- package/dist/_node-chunks/{chunk-RZMQ7S3L.js → chunk-VYCVBW5Q.js} +8 -8
- package/dist/_node-chunks/{chunk-ICPBH3E7.js → chunk-WDANLGYN.js} +7 -7
- package/dist/_node-chunks/{chunk-UMUBKI6E.js → chunk-WMZJ2WK4.js} +96 -177
- package/dist/_node-chunks/{chunk-LXBD4UL4.js → chunk-WTPHQ2NG.js} +8 -8
- package/dist/_node-chunks/chunk-WYCITRIE.js +11 -0
- package/dist/_node-chunks/chunk-WYRBOMQF.js +137 -0
- package/dist/_node-chunks/{chunk-ZWBCQ4MJ.js → chunk-WZBMPROH.js} +9 -17
- package/dist/_node-chunks/{chunk-CXRU72ET.js → chunk-X2GGQZIN.js} +6 -6
- package/dist/_node-chunks/chunk-X6OGIC2G.js +28 -0
- package/dist/_node-chunks/{chunk-42UWAGPW.js → chunk-XF7H5GZM.js} +52 -22
- package/dist/_node-chunks/{chunk-WNZ2UMFM.js → chunk-XUZB4FIX.js} +15 -9
- package/dist/_node-chunks/{chunk-3SDUYDXH.js → chunk-XVSUIOZA.js} +7 -7
- package/dist/_node-chunks/{chunk-TFEWM4E3.js → chunk-Z665R6AF.js} +75 -75
- package/dist/_node-chunks/{chunk-H4PPVMP5.js → chunk-ZEYZWDOS.js} +6 -6
- package/dist/_node-chunks/{chunk-UBOGWBEA.js → chunk-ZHRCL7PG.js} +10 -10
- package/dist/_node-chunks/chunk-ZLC4JSBV.js +25 -0
- package/dist/_node-chunks/{chunk-F3ZFKBHY.js → chunk-ZN6YOIB2.js} +8 -8
- package/dist/_node-chunks/{chunk-YCMRA6RX.js → chunk-ZX32M4O7.js} +7 -7
- package/dist/_node-chunks/{chunk-NDWKJ4CL.js → chunk-ZZ5XMIGW.js} +97 -111
- package/dist/_node-chunks/dist-HBFOS25E.js +16 -0
- package/dist/_node-chunks/dist-Q2XNFC24.js +27 -0
- package/dist/_node-chunks/{local-runtime-NTKIN2QT.js → local-runtime-4ETW6QTI.js} +19 -20
- package/dist/_node-chunks/{mdx-plugin-MWISDWDQ.js → mdx-plugin-OOYTYMVU.js} +2263 -130
- package/dist/_node-chunks/{monorepo-LIRFMQXE.js → monorepo-3AWUYNFD.js} +12 -12
- package/dist/_node-chunks/{monorepo-optimized-tests-relaxed-limits-no-story-deletion-CPDW4XTW.js → monorepo-optimized-tests-relaxed-limits-no-story-deletion-ORY3BAP5.js} +12 -12
- package/dist/_node-chunks/optimized-tests-DOKSUJAM.js +22 -0
- package/dist/_node-chunks/{pattern-copy-play-EKHIUAU2.js → pattern-copy-play-AY4DE7ME.js} +12 -12
- package/dist/_node-chunks/postinstallAddon-L46G75CD.js +20 -0
- package/dist/_node-chunks/{rehype-external-links-BUN3HUCO.js → rehype-external-links-FGVC633L.js} +9 -9
- package/dist/_node-chunks/{rehype-slug-PLADX223.js → rehype-slug-2AZLMC5G.js} +9 -9
- package/dist/_node-chunks/{relaxed-limits-GBHW6KIQ.js → relaxed-limits-QI3YR6CU.js} +12 -12
- package/dist/_node-chunks/{run-NL66VTNR.js → run-QJJ4FOF3.js} +281 -19
- package/dist/_node-chunks/{run-KDTIZNSY.js → run-WFJZYNZN.js} +18 -18
- package/dist/_node-chunks/{setup-MGC7BQO6.js → setup-V5CRAJMV.js} +9 -9
- package/dist/_node-chunks/{vitest.config.4.template-JH2THZFG.js → vitest.config.4.template-LECBBF3L.js} +9 -9
- package/dist/actions/decorator.js +18 -22
- package/dist/actions/index.d.ts +4 -4
- package/dist/actions/index.js +3 -2
- package/dist/addon-a11y/index.d.ts +3 -3
- package/dist/addon-a11y/index.js +3 -2
- package/dist/addon-a11y/manager.js +41 -38
- package/dist/addon-a11y/preset.js +7 -7
- package/dist/addon-a11y/preview.d.ts +8 -2
- package/dist/addon-a11y/preview.js +3 -2
- package/dist/addon-comments/manager.js +353 -0
- package/dist/addon-comments/preset.js +52 -0
- package/dist/addon-comments/preview.js +101 -0
- package/dist/addon-docs/blocks.d.ts +123 -85
- package/dist/addon-docs/blocks.js +159 -85
- package/dist/addon-docs/index.d.ts +21 -21
- package/dist/addon-docs/index.js +3 -3
- package/dist/addon-docs/manager.js +6 -6
- package/dist/addon-docs/preset.js +12 -12
- package/dist/addon-docs/preview.d.ts +3 -1
- package/dist/addon-docs/preview.js +1 -1
- package/dist/addon-links/index.d.ts +2 -1
- package/dist/addon-links/index.js +5 -2
- package/dist/addon-links/preview.d.ts +1 -1
- package/dist/addon-links/preview.js +5 -2
- package/dist/addon-links/react/index.js +4 -1
- package/dist/addon-mcp/preset.js +176 -57
- package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +70 -70
- package/dist/addon-ondevice-actions/index.js +5 -1
- package/dist/addon-ondevice-actions/register.js +5 -1
- package/dist/addon-ondevice-controls/index.js +1 -1
- package/dist/addon-ondevice-controls/register.js +1 -1
- package/dist/addon-pseudo-states/index.d.ts +1 -1
- package/dist/addon-pseudo-states/index.js +1 -1
- package/dist/addon-pseudo-states/manager.js +2 -2
- package/dist/addon-pseudo-states/preview.d.ts +1 -1
- package/dist/addon-pseudo-states/preview.js +1 -1
- package/dist/addon-themes/index.d.ts +7 -6
- package/dist/addon-themes/index.js +2 -2
- package/dist/addon-themes/manager.js +4 -4
- package/dist/addon-themes/postinstall.js +7 -7
- package/dist/addon-themes/preview.js +2 -2
- package/dist/addon-vitest/constants.js +8 -8
- package/dist/addon-vitest/manager.js +32 -23
- package/dist/addon-vitest/node/coverage-reporter.js +11 -11
- package/dist/addon-vitest/node/vitest.js +35 -35
- package/dist/addon-vitest/postinstall.js +10 -10
- package/dist/addon-vitest/preset.js +22 -22
- package/dist/addon-vitest/vitest-plugin/global-setup.js +22 -22
- package/dist/addon-vitest/vitest-plugin/index.js +78 -68
- package/dist/addon-vitest/vitest-plugin/setup-file-with-project-annotations.js +3 -3
- package/dist/addon-vitest/vitest-plugin/setup-file.js +1 -1
- package/dist/babel/index.d.ts +241 -995
- package/dist/babel/index.js +13 -19
- package/dist/backgrounds/index.d.ts +1 -1
- package/dist/bin/core.js +118 -95
- package/dist/bin/dispatcher.js +18 -16
- package/dist/bin/loader.js +17 -16
- package/dist/builder-next/index.d.ts +59 -0
- package/dist/builder-next/index.js +201 -0
- package/dist/builder-vite/index.d.ts +8 -3
- package/dist/builder-vite/index.js +80 -25
- package/dist/builder-vite/preset.js +13 -13
- package/dist/channels/index.d.ts +3 -2
- package/dist/channels/index.js +97 -24
- package/dist/{chunk-Dr3R0DXk.d.ts → chunk-B-NVyPqN.d.ts} +2 -2
- package/dist/{chunk-DoIGKY33.d.ts → chunk-BLZXEm1K.d.ts} +6 -8
- package/dist/chunk-BcYKnZln.d.ts +10 -0
- package/dist/{chunk-DEVFdzxR.d.ts → chunk-BsO65uOb.d.ts} +4 -4
- package/dist/{chunk-BCoJQE-f.d.ts → chunk-BtKww7r1.d.ts} +6 -4
- package/dist/{chunk-Bpi2tz-6.d.ts → chunk-Bubi-WAs.d.ts} +20 -17
- package/dist/chunk-CDMZhRke.d.ts +30 -0
- package/dist/chunk-CFhJCPSB.d.ts +48 -0
- package/dist/{chunk-DtHByo32.d.ts → chunk-CFk6djyM.d.ts} +5 -5
- package/dist/{chunk-CMeX4WRe.d.ts → chunk-CT2iXaHz.d.ts} +1 -1
- package/dist/{chunk-pcFXCimE.d.ts → chunk-CmV7WZzR.d.ts} +124 -2
- package/dist/{chunk-B2t1tGRh.d.ts → chunk-D2CQlXaR.d.ts} +13 -15
- package/dist/{chunk-BGkgZp-H.d.ts → chunk-D3uSIa6H.d.ts} +9 -1
- package/dist/{chunk-DzuY9DXg.d.ts → chunk-DDd8BhTY.d.ts} +2 -2
- package/dist/{chunk-Dw1z1Pki.d.ts → chunk-DNCU78oW.d.ts} +160 -323
- package/dist/chunk-DVIvUVkS.d.ts +195 -0
- package/dist/{chunk-gCX81nOr.d.ts → chunk-DgzPaTw9.d.ts} +3 -3
- package/dist/{chunk-Kt1tW-D1.d.ts → chunk-Dm-iHJ-s.d.ts} +3 -3
- package/dist/{chunk-C-bavsOH.d.ts → chunk-Dw_4ad2Y.d.ts} +6 -6
- package/dist/{chunk-CwQKNaYL.d.ts → chunk-OksNJcvJ.d.ts} +2 -2
- package/dist/chunk-Susgfkap.d.ts +20 -0
- package/dist/{chunk-C2p5r3Vt.d.ts → chunk-ge-rSPy0.d.ts} +818 -701
- package/dist/{chunk-BXLImeLy.d.ts → chunk-r-Vjut9o.d.ts} +52 -11
- package/dist/cli/index.d.ts +14 -867
- package/dist/cli/index.js +47 -4962
- package/dist/cli/skills/content/index.d.ts +2 -2
- package/dist/cli/skills/content/index.js +2 -2
- 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 +3 -3
- package/dist/cli/tools/sdk/index.js +18 -18
- package/dist/cli-commands/bin/index.js +7 -7
- package/dist/client-logger/index.d.ts +20 -21
- package/dist/client-logger/index.js +5 -2
- package/dist/common/index.d.ts +27 -39
- package/dist/common/index.js +35 -42
- package/dist/components/index.d.ts +86 -272
- package/dist/components/index.js +2759 -8547
- package/dist/core-events/index.d.ts +6 -4
- package/dist/core-events/index.js +5 -1
- package/dist/core-server/index.d.ts +58 -17
- package/dist/core-server/index.js +1500 -382
- package/dist/core-server/presets/common-manager.js +836 -1334
- package/dist/core-server/presets/common-override-preset.js +12 -10
- package/dist/core-server/presets/common-preset.js +100 -282
- 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 +6 -6
- package/dist/csf/index.js +86 -154
- package/dist/csf-tools/index.d.ts +66 -54
- package/dist/csf-tools/index.js +18 -16
- package/dist/docs-tools/index.d.ts +332 -16
- package/dist/docs-tools/index.js +3 -3
- package/dist/highlight/index.d.ts +1 -1
- package/dist/instrumenter/index.d.ts +5 -5
- package/dist/instrumenter/index.js +31 -19
- package/dist/manager/_manager-chunks/{globals-runtime-BvM-NY2g.js → globals-runtime-B4NRbNSS.js} +638 -1731
- package/dist/{preview/_chunks/runtime-CqHxptiK.js → manager/_manager-chunks/globals-runtime-BC43T1rL.js} +3413 -173
- package/dist/manager/_manager-chunks/{globals-runtime-sGpNlIJ1.js → globals-runtime-BDkYPr00.js} +715 -620
- package/dist/manager/_manager-chunks/{globals-runtime-eLPTIfX-.js → globals-runtime-BnQ7i5wq.js} +232 -370
- package/dist/manager/_manager-chunks/{globals-runtime-Rp_zjGnh.js → globals-runtime-BnWjPJUH.js} +2 -2
- package/dist/manager/_manager-chunks/globals-runtime-BtduS2C2.js +10601 -0
- package/dist/manager/_manager-chunks/{globals-runtime-C02fvgcd.js → globals-runtime-Bv2PBsx6.js} +411 -379
- package/dist/manager/_manager-chunks/globals-runtime-BzuYs3dZ.js +1971 -0
- package/dist/manager/_manager-chunks/globals-runtime-CBviMKtt.js +446 -0
- package/dist/manager/_manager-chunks/globals-runtime-CS41oTca.js +1808 -0
- package/dist/manager/_manager-chunks/globals-runtime-CoTrrHG3.js +1163 -0
- package/dist/manager/_manager-chunks/{globals-runtime-qKvCZHFY.js → globals-runtime-D6tkG2NO.js} +1033 -621
- package/dist/manager/_manager-chunks/{globals-runtime-BmphMP6z.js → globals-runtime-D9zzVzSP.js} +11 -11
- package/dist/manager/_manager-chunks/{globals-runtime-FC201B7s.js → globals-runtime-DCmvKMN5.js} +2 -1
- package/dist/manager/_manager-chunks/{globals-runtime-DpNYC-qi.js → globals-runtime-DafcXCKU.js} +1013 -778
- package/dist/manager/_manager-chunks/globals-runtime-DgO0hT2p.js +32 -0
- 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-oRjPg2jY.js +8935 -0
- package/dist/manager/_manager-chunks/{runtime-EITvVbkG.js → runtime-BdGkqNEt.js} +1 -2
- package/dist/manager/_manager-chunks/runtime-BhfRBP4G.js +294 -0
- package/dist/manager/_manager-chunks/runtime-BuPcYKCO.js +737 -0
- package/dist/manager/_manager-chunks/{runtime-eDVAYF7N.js → runtime-CGaGp83p.js} +57 -76
- package/dist/manager/_manager-chunks/{runtime-BhkT2CXl.js → runtime-CXROgt6G.js} +220 -406
- package/dist/manager/_manager-chunks/{runtime-i-PDAHLR.js → runtime-Cn5PJT3-.js} +741 -698
- package/dist/manager/_manager-chunks/{runtime-cp5pazY2.js → runtime-DJlTd1qE.js} +1717 -1536
- package/dist/manager/_manager-chunks/{runtime-D0UOWx0U.js → runtime-DTUm5K9J.js} +232 -158
- package/dist/manager/_manager-chunks/{runtime-D94Vq3oR.js → runtime-Dc6lf19c.js} +8 -534
- package/dist/manager/_manager-chunks/runtime-DmpQacrn.js +553 -0
- package/dist/manager/_manager-chunks/runtime-P663lpsR.js +528 -0
- package/dist/manager/_manager-chunks/runtime-mjv_40eH.js +201 -0
- package/dist/manager/globals-runtime.js +1 -1
- package/dist/manager/globals.d.ts +12 -12
- package/dist/manager/globals.js +12 -12
- package/dist/manager/runtime.js +1 -1
- package/dist/manager-api/index.d.ts +1 -1
- package/dist/manager-api/index.js +537 -527
- package/dist/manager-errors.d.ts +1 -1
- package/dist/manager-errors.js +2 -2
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +9 -9
- package/dist/mocking-utils/index.d.ts +7 -5
- package/dist/mocking-utils/index.js +34 -34
- package/dist/mocking-utils/mocker-runtime.js +2 -2
- package/dist/next/index.d.ts +231 -0
- package/dist/next/index.js +398 -0
- package/dist/nextjs-vite/export-mocks/headers/index.js +3 -1
- package/dist/nextjs-vite/export-mocks/link/index.d.ts +4 -1
- package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +9 -1
- package/dist/nextjs-vite/export-mocks/router/index.js +13 -7
- package/dist/nextjs-vite/index.d.ts +4 -4
- package/dist/nextjs-vite/index.js +10 -5
- package/dist/nextjs-vite/node/index.d.ts +2 -2
- package/dist/nextjs-vite/node/index.js +7 -7
- package/dist/nextjs-vite/node-stand-ins/index.d.ts +68 -0
- package/dist/nextjs-vite/node-stand-ins/index.js +145 -0
- package/dist/nextjs-vite/preset.js +117 -15
- package/dist/nextjs-vite/preview.d.ts +2 -1
- 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.d.ts +2 -3
- package/dist/nextjs-vite-plugin/index.js +24 -49
- package/dist/nextjs-vite-plugin/mocks/storybook.global.js +8 -8
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-image.js +2 -2
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-legacy-image.js +2 -2
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +10 -6
- package/dist/node-logger/index.d.ts +83 -90
- package/dist/node-logger/index.js +11 -12
- package/dist/oxc-parser/index.js +15 -14
- package/dist/oxc-parser/worker.js +10 -10
- package/dist/{manager/_manager-chunks/globals-runtime-8HkdnU2F.js → preview/_chunks/runtime-BYRCSYBN.js} +4440 -179
- package/dist/preview/_chunks/{runtime-CsV4HZPV.js → runtime-BiYuZt-X.js} +392 -173
- package/dist/preview/_chunks/{runtime-BZSnICCg.js → runtime-Bvh_rfnQ.js} +29 -64
- package/dist/preview/_chunks/{runtime-iXdo8CR8.js → runtime-C88AzFBv.js} +772 -418
- package/dist/preview/_chunks/{runtime-DrTjJkPY.js → runtime-Cpzxe5eK.js} +447 -151
- package/dist/preview/_chunks/{runtime-q3wt0e_N.js → runtime-D2MPrqbU.js} +2 -2
- package/dist/preview/_chunks/{runtime-BIzIdDbb.js → runtime-DS0s7U3c.js} +482 -334
- package/dist/preview/_chunks/{runtime-CxZK_Ln3.js → runtime-MYVHRAoo.js} +3 -3
- package/dist/preview/globals.d.ts +10 -10
- package/dist/preview/globals.js +10 -10
- package/dist/preview/runtime.js +1 -1
- package/dist/preview-api/index.d.ts +3 -3
- package/dist/preview-api/index.js +12 -10
- package/dist/preview-errors.d.ts +1 -1
- package/dist/preview-errors.js +2 -2
- package/dist/react/docgen/docgen-worker.js +11 -12
- package/dist/react/entry-preview-argtypes.js +1 -1
- package/dist/react/entry-preview-docs.js +1 -1
- package/dist/react/entry-preview.js +2 -1
- package/dist/react/index.d.ts +9 -11
- package/dist/react/index.js +8 -6
- package/dist/react/preset.js +13 -14
- package/dist/react/preview.d.ts +1 -1
- package/dist/react/preview.js +5 -4
- package/dist/react-native/bin/get-stories.js +12 -12
- package/dist/react-native/index.d.ts +48 -47
- package/dist/react-native/index.js +64 -249
- package/dist/react-native/metro/node.d.ts +3 -3
- package/dist/react-native/metro/node.js +10 -9
- package/dist/react-native/metro/{withStorybook.d.ts → withForkbook.d.ts} +18 -18
- package/dist/react-native/metro/{withStorybook.js → withForkbook.js} +27 -26
- package/dist/react-native/preview.js +4 -1
- package/dist/react-native/scripts/generate.d.ts +1 -1
- package/dist/react-native/scripts/generate.js +8 -8
- package/dist/react-native/stub.js +1 -1
- package/dist/react-native-theming/index.d.ts +2 -58
- package/dist/react-native-theming/index.js +63 -2338
- package/dist/react-native-ui/index.d.ts +14 -14
- package/dist/react-native-ui/index.js +8 -15
- package/dist/react-native-ui-common/index.d.ts +32 -12
- package/dist/react-native-ui-common/index.js +26 -31
- package/dist/react-vite/index.d.ts +2 -2
- package/dist/react-vite/node/index.d.ts +3 -3
- package/dist/react-vite/node/index.js +7 -7
- package/dist/react-vite/preset.d.ts +3 -1
- package/dist/react-vite/preset.js +16 -9
- package/dist/router/index.d.ts +80 -3
- package/dist/router/index.js +66 -12
- package/dist/server-errors.d.ts +1 -1
- package/dist/server-errors.js +9 -9
- package/dist/shared/open-service/index.d.ts +3 -3
- package/dist/shared/open-service/index.js +2 -2
- package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +9 -9
- package/dist/shared/open-service/toolsets/docs/public.d.ts +28 -28
- package/dist/telemetry/index.d.ts +38 -274
- package/dist/telemetry/index.js +11 -68
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.js +765 -511
- package/dist/theming/create.d.ts +1 -1
- package/dist/theming/create.js +2 -1
- package/dist/theming/index.d.ts +6 -6
- package/dist/theming/index.js +41 -16
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +5 -5
- package/dist/viewport/index.d.ts +1 -1
- package/package.json +69 -69
- package/skills/setup/SKILL.md +14 -0
- package/skills/stories/SKILL.md +21 -0
- package/skills/write-story/SKILL.md +14 -0
- package/template/nextjs-vite/cli/js/Button.jsx +2 -2
- package/template/nextjs-vite/cli/js/Button.stories.js +6 -6
- package/template/nextjs-vite/cli/js/Configure.mdx +100 -100
- package/template/nextjs-vite/cli/js/Header.jsx +1 -1
- package/template/nextjs-vite/cli/js/Header.stories.js +2 -2
- package/template/nextjs-vite/cli/js/Page.jsx +3 -3
- package/template/nextjs-vite/cli/js/Page.stories.js +2 -2
- package/template/nextjs-vite/cli/ts/Button.stories.ts +6 -6
- package/template/nextjs-vite/cli/ts/Button.tsx +2 -2
- package/template/nextjs-vite/cli/ts/Configure.mdx +84 -84
- package/template/nextjs-vite/cli/ts/Header.stories.ts +2 -2
- package/template/nextjs-vite/cli/ts/Header.tsx +1 -1
- package/template/nextjs-vite/cli/ts/Page.stories.ts +2 -2
- package/template/nextjs-vite/cli/ts/Page.tsx +3 -3
- package/template/react/cli/js/Button.jsx +2 -2
- package/template/react/cli/js/Button.stories.js +6 -6
- package/template/react/cli/js/Header.jsx +1 -1
- package/template/react/cli/js/Header.stories.js +2 -2
- package/template/react/cli/js/Page.jsx +3 -3
- package/template/react/cli/js/Page.stories.js +2 -2
- package/template/react/cli/ts/Button.stories.ts +6 -6
- package/template/react/cli/ts/Button.tsx +2 -2
- package/template/react/cli/ts/Header.stories.ts +2 -2
- package/template/react/cli/ts/Header.tsx +1 -1
- package/template/react/cli/ts/Page.stories.ts +2 -2
- package/template/react/cli/ts/Page.tsx +3 -3
- package/template/react-vite/cli/js/Button.jsx +2 -2
- package/template/react-vite/cli/js/Button.stories.js +6 -6
- package/template/react-vite/cli/js/Header.jsx +1 -1
- package/template/react-vite/cli/js/Header.stories.js +2 -2
- package/template/react-vite/cli/js/Page.jsx +3 -3
- package/template/react-vite/cli/js/Page.stories.js +2 -2
- package/template/react-vite/cli/ts/Button.stories.ts +6 -6
- package/template/react-vite/cli/ts/Button.tsx +2 -2
- package/template/react-vite/cli/ts/Header.stories.ts +2 -2
- package/template/react-vite/cli/ts/Header.tsx +1 -1
- package/template/react-vite/cli/ts/Page.stories.ts +2 -2
- package/template/react-vite/cli/ts/Page.tsx +3 -3
- package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-bold.woff2 +0 -0
- package/assets/browser/nunito-sans-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-regular.woff2 +0 -0
- package/dist/_browser-chunks/WithTooltip-XSQFTBMB.js +0 -1619
- package/dist/_browser-chunks/chunk-5P4QA6MY.js +0 -20
- package/dist/_browser-chunks/chunk-JMC7AIKT.js +0 -108
- package/dist/_node-chunks/builder-manager-VVHYQXCH.js +0 -1661
- package/dist/_node-chunks/chunk-2RU7BKEW.js +0 -23
- package/dist/_node-chunks/chunk-3BKIBF5S.js +0 -3008
- package/dist/_node-chunks/chunk-3T4ZSNPH.js +0 -662
- package/dist/_node-chunks/chunk-5DQFEZEA.js +0 -40
- package/dist/_node-chunks/chunk-6LMWA44H.js +0 -3837
- package/dist/_node-chunks/chunk-BXVYT7SB.js +0 -36
- package/dist/_node-chunks/chunk-CQKMLL5J.js +0 -33
- package/dist/_node-chunks/chunk-FY6UXW6G.js +0 -11
- package/dist/_node-chunks/chunk-IDEL2J23.js +0 -23
- package/dist/_node-chunks/chunk-JPAZLYJ3.js +0 -29
- package/dist/_node-chunks/chunk-MK2KYAI6.js +0 -5414
- package/dist/_node-chunks/chunk-NPO45IMH.js +0 -33
- package/dist/_node-chunks/chunk-QEQLR22M.js +0 -1877
- package/dist/_node-chunks/chunk-SIEXZVCR.js +0 -51
- package/dist/_node-chunks/chunk-TEQGGSP7.js +0 -33
- package/dist/_node-chunks/chunk-TFCEV2XX.js +0 -155
- package/dist/_node-chunks/chunk-W4OMYLSP.js +0 -1297
- package/dist/_node-chunks/chunk-WAXVSN3O.js +0 -18
- package/dist/_node-chunks/chunk-ZMAMXQKP.js +0 -4731
- package/dist/_node-chunks/dist-VTSTZKUB.js +0 -16
- package/dist/_node-chunks/globby-OEMHPBFY.js +0 -2884
- package/dist/_node-chunks/jiti-NFX6UU74.js +0 -3848
- package/dist/_node-chunks/lib-MDVARD7W.js +0 -366
- package/dist/_node-chunks/optimized-tests-HDOLR3EY.js +0 -22
- package/dist/_node-chunks/postinstallAddon-GYGMWDL6.js +0 -20
- package/dist/_node-chunks/session-id-KIIVOQLR.js +0 -23
- package/dist/chunk-BTVrWliM.d.ts +0 -115
- package/dist/chunk-BfBzpgct.d.ts +0 -916
- package/dist/chunk-BxWufQms.d.ts +0 -142
- package/dist/chunk-DaVb55-_.d.ts +0 -124
- package/dist/core-server/presets/common-manager.css +0 -170
- package/dist/manager/_manager-chunks/globals-runtime-BIKBO23x.js +0 -3389
- package/dist/manager/_manager-chunks/globals-runtime-DkAPXCvc.js +0 -9766
- package/dist/manager/_manager-chunks/globals-runtime-DtcOnYHR.js +0 -5357
- package/dist/manager/_manager-chunks/globals-runtime-ZHrQFa3-.js +0 -10463
- package/dist/manager/_manager-chunks/runtime-B1L9TH89.js +0 -452
- package/dist/manager/_manager-chunks/runtime-BK0zF7FN.js +0 -22
- package/dist/manager/_manager-chunks/runtime-Bly6WJLN.js +0 -998
- package/dist/manager/_manager-chunks/runtime-DMig8mT7.js +0 -77
- package/dist/preview/_chunks/runtime-BTPtVY1p.js +0 -1102
- package/dist/preview/_chunks/runtime-BwSxqk3t.js +0 -63
- package/dist/preview/_chunks/runtime-DZToXfvO.js +0 -9767
- package/dist/preview/_chunks/runtime-DuHdxMFA.js +0 -387
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_darlhdhnaq7 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_darlhdhnaq7 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_darlhdhnaq7 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_darlhdhnaq7.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_darlhdhnaq7.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_darlhdhnaq7.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Forkbook's esbuild configuration
|
|
@@ -12,63 +12,61 @@ var require = CJS_COMPAT_NODE_MODULE_ro17f80mg6k.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
UniversalStore,
|
|
14
14
|
instances
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JXZONVHW.js";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
buildStoryPathMap,
|
|
18
|
+
toUrlPath
|
|
19
|
+
} from "./chunk-PJRPETSU.js";
|
|
19
20
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
isStateManagementPackage,
|
|
23
|
-
isStylingPackage
|
|
24
|
-
} from "./chunk-TFCEV2XX.js";
|
|
21
|
+
require_build
|
|
22
|
+
} from "./chunk-J6FGP2VM.js";
|
|
25
23
|
import {
|
|
26
24
|
leven
|
|
27
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-5LFJQCYN.js";
|
|
28
26
|
import {
|
|
29
27
|
defineToolset
|
|
30
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-VNZF62KE.js";
|
|
31
29
|
import {
|
|
32
30
|
getToolName,
|
|
33
31
|
toMcpToolName
|
|
34
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-WDANLGYN.js";
|
|
35
33
|
import {
|
|
36
|
-
|
|
34
|
+
exec,
|
|
37
35
|
getComponentIdFromEntry,
|
|
38
36
|
optionalEnvToBoolean,
|
|
39
37
|
selectComponentEntriesByComponentId
|
|
40
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-LAJIVWUF.js";
|
|
41
39
|
import {
|
|
42
40
|
getService as getService2,
|
|
43
41
|
registerService
|
|
44
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-DQEUNKLX.js";
|
|
45
43
|
import {
|
|
46
44
|
getRegisteredServices,
|
|
47
45
|
getService
|
|
48
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-HHM5X5RQ.js";
|
|
49
47
|
import {
|
|
50
48
|
isEqual,
|
|
51
49
|
isPlainObject
|
|
52
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-EG2WLN5V.js";
|
|
53
51
|
import {
|
|
54
52
|
Tag
|
|
55
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-VIMGLCNZ.js";
|
|
56
54
|
import {
|
|
57
55
|
CHANGE_DETECTION_STATUS_TYPE_ID,
|
|
58
56
|
UNIVERSAL_STATUS_STORE_OPTIONS,
|
|
59
57
|
createStatusStore
|
|
60
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-XUZB4FIX.js";
|
|
61
59
|
import {
|
|
62
60
|
invariant
|
|
63
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-KAALBGRE.js";
|
|
64
62
|
import {
|
|
65
63
|
importModule,
|
|
66
64
|
resolveModulePath,
|
|
67
65
|
resolvePackageDir
|
|
68
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-ZN6YOIB2.js";
|
|
69
67
|
import {
|
|
70
68
|
jsTsSourceExtensions
|
|
71
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-F762PHMI.js";
|
|
72
70
|
import {
|
|
73
71
|
OpenServiceDocgenMissingComponentError,
|
|
74
72
|
OpenServiceMissingOriginError,
|
|
@@ -77,22 +75,19 @@ import {
|
|
|
77
75
|
OpenServiceUnknownStoryIdsError,
|
|
78
76
|
StorybookError,
|
|
79
77
|
describeUnknownStoryIds
|
|
80
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-2CNN3CRI.js";
|
|
81
79
|
import {
|
|
82
80
|
require_picocolors
|
|
83
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-IENHXJVB.js";
|
|
84
82
|
import {
|
|
85
83
|
errorToErrorLike,
|
|
86
84
|
reverseIndexToStoriesByFile,
|
|
87
85
|
toStoryIndexPath
|
|
88
|
-
} from "./chunk-
|
|
89
|
-
import {
|
|
90
|
-
glob
|
|
91
|
-
} from "./chunk-ZMAMXQKP.js";
|
|
86
|
+
} from "./chunk-6RYD6ENB.js";
|
|
92
87
|
import {
|
|
93
88
|
__commonJS,
|
|
94
89
|
__toESM
|
|
95
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-X2GGQZIN.js";
|
|
96
91
|
|
|
97
92
|
// ../../node_modules/map-or-similar/src/similar.js
|
|
98
93
|
var require_similar = __commonJS({
|
|
@@ -157,10 +152,10 @@ var require_memoizerific = __commonJS({
|
|
|
157
152
|
"../../node_modules/memoizerific/src/memoizerific.js"(exports, module) {
|
|
158
153
|
var MapOrSimilar = require_map_or_similar();
|
|
159
154
|
module.exports = function(limit) {
|
|
160
|
-
var
|
|
155
|
+
var cache4 = new MapOrSimilar(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP === "true"), lru = [];
|
|
161
156
|
return function(fn) {
|
|
162
157
|
var memoizerific = function() {
|
|
163
|
-
var currentCache =
|
|
158
|
+
var currentCache = cache4, newMap, fnResult, argsLengthMinusOne = arguments.length - 1, lruPath = Array(argsLengthMinusOne + 1), isMemoized = !0, i;
|
|
164
159
|
if ((memoizerific.numArgs || memoizerific.numArgs === 0) && memoizerific.numArgs !== argsLengthMinusOne + 1)
|
|
165
160
|
throw new Error("Memoizerific functions should always be called with the same number of arguments");
|
|
166
161
|
for (i = 0; i < argsLengthMinusOne; i++) {
|
|
@@ -178,7 +173,7 @@ var require_memoizerific = __commonJS({
|
|
|
178
173
|
arg: arguments[argsLengthMinusOne]
|
|
179
174
|
}, isMemoized ? moveToMostRecentLru(lru, lruPath) : lru.push(lruPath), lru.length > limit && removeCachedResult(lru.shift())), memoizerific.wasMemoized = isMemoized, memoizerific.numArgs = argsLengthMinusOne + 1, fnResult;
|
|
180
175
|
};
|
|
181
|
-
return memoizerific.limit = limit, memoizerific.wasMemoized = !1, memoizerific.cache =
|
|
176
|
+
return memoizerific.limit = limit, memoizerific.wasMemoized = !1, memoizerific.cache = cache4, memoizerific.lru = lru, memoizerific;
|
|
182
177
|
};
|
|
183
178
|
};
|
|
184
179
|
function moveToMostRecentLru(lru, lruPath) {
|
|
@@ -263,7 +258,7 @@ async function useStatics(app, options) {
|
|
|
263
258
|
}), staticDirs.map((dir) => {
|
|
264
259
|
try {
|
|
265
260
|
let { staticDir, staticPath, targetEndpoint } = mapStaticDir(dir, options.configDir);
|
|
266
|
-
if (!targetEndpoint.startsWith("/
|
|
261
|
+
if (!targetEndpoint.startsWith("/fb-") && !staticDir.startsWith(cacheDir)) {
|
|
267
262
|
let relativeStaticDir = relative(getProjectRoot(), staticDir);
|
|
268
263
|
logger.debug(
|
|
269
264
|
`Serving static files from ${CLI_COLORS.info(relativeStaticDir)} at ${CLI_COLORS.info(targetEndpoint)}`
|
|
@@ -282,8 +277,8 @@ async function useStatics(app, options) {
|
|
|
282
277
|
});
|
|
283
278
|
}
|
|
284
279
|
var sirvWorkaround = (dir, opts = {}) => (req, res, next) => {
|
|
285
|
-
let originalParsedUrl =
|
|
286
|
-
|
|
280
|
+
let polkaReq = req, originalParsedUrl = polkaReq._parsedUrl, maybeNext = next ? () => {
|
|
281
|
+
polkaReq._parsedUrl = originalParsedUrl, next();
|
|
287
282
|
} : void 0;
|
|
288
283
|
(0, import_sirv.default)(dir, { dev: !0, etag: !0, extensions: [], ...opts })(req, res, maybeNext);
|
|
289
284
|
}, parseStaticDir = (arg) => {
|
|
@@ -308,7 +303,7 @@ import { isAbsolute as isAbsolute2, join as join2 } from "node:path";
|
|
|
308
303
|
import { pathToFileURL } from "node:url";
|
|
309
304
|
import { MissingBuilderError } from "@aussieljk/forkbook/internal/server-errors";
|
|
310
305
|
async function getManagerBuilder() {
|
|
311
|
-
return await import("./builder-manager-
|
|
306
|
+
return await import("./builder-manager-UNJGYVTD.js");
|
|
312
307
|
}
|
|
313
308
|
async function getPreviewBuilder(resolvedPreviewBuilder) {
|
|
314
309
|
let packageJson = join2(resolvedPreviewBuilder, "package.json");
|
|
@@ -462,12 +457,12 @@ function hasMdxRef(entry) {
|
|
|
462
457
|
return typeof entry?.mdx?.$ref == "string";
|
|
463
458
|
}
|
|
464
459
|
function createDiskLoader(outputDir) {
|
|
465
|
-
let
|
|
460
|
+
let cache4 = /* @__PURE__ */ new Map();
|
|
466
461
|
return (relativePath) => {
|
|
467
|
-
let pending =
|
|
462
|
+
let pending = cache4.get(relativePath);
|
|
468
463
|
return pending || (pending = readFile3(join4(outputDir, "manifests", relativePath), "utf8").then(
|
|
469
464
|
(raw) => JSON.parse(raw)
|
|
470
|
-
),
|
|
465
|
+
), cache4.set(relativePath, pending)), pending;
|
|
471
466
|
};
|
|
472
467
|
}
|
|
473
468
|
function createServiceLoader(mdxPayloads) {
|
|
@@ -549,132 +544,388 @@ async function loadMdxPayloadsFromServiceIfNeeded(manifests, docsManifest) {
|
|
|
549
544
|
}
|
|
550
545
|
|
|
551
546
|
// src/core-server/utils/manifests/render-components-manifest.ts
|
|
552
|
-
import path from "node:path";
|
|
553
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";
|
|
554
551
|
function storyEntries(stories) {
|
|
555
552
|
return Array.isArray(stories) ? stories : Object.values(stories ?? {});
|
|
556
553
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
)
|
|
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
|
-
--chip: #1f2330;
|
|
610
|
-
--border: #2b2f3a;
|
|
611
|
-
--link: #8ab4f8;
|
|
612
|
-
--active-ring: 1px; /* 1px active ring for pills and toggles */
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
* {
|
|
616
|
-
box-sizing: border-box;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
html,
|
|
620
|
-
body {
|
|
621
|
-
margin: 0;
|
|
622
|
-
background: var(--bg);
|
|
623
|
-
color: var(--fg);
|
|
624
|
-
font: 14px/1.5 system-ui,
|
|
625
|
-
-apple-system,
|
|
626
|
-
Segoe UI,
|
|
627
|
-
Roboto,
|
|
628
|
-
Ubuntu,
|
|
629
|
-
Cantarell,
|
|
630
|
-
'Helvetica Neue',
|
|
631
|
-
Arial,
|
|
632
|
-
'Noto Sans';
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
.wrap {
|
|
636
|
-
max-width: 1100px;
|
|
637
|
-
margin: 0 auto;
|
|
638
|
-
padding: 16px 20px;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
header {
|
|
642
|
-
position: sticky;
|
|
643
|
-
top: 0;
|
|
644
|
-
backdrop-filter: blur(6px);
|
|
645
|
-
background: color-mix(in srgb, var(--bg) 84%, transparent);
|
|
646
|
-
border-bottom: 1px solid var(--border);
|
|
647
|
-
z-index: 10;
|
|
648
|
-
}
|
|
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>
|
|
649
606
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
}
|
|
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 />` : ""}
|
|
654
610
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
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>
|
|
661
682
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
border-radius: 999px;
|
|
670
|
-
background: var(--panel);
|
|
671
|
-
text-decoration: none;
|
|
672
|
-
cursor: pointer;
|
|
673
|
-
user-select: none;
|
|
674
|
-
color: var(--fg);
|
|
675
|
-
}
|
|
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 />` : ""}
|
|
676
690
|
|
|
677
|
-
|
|
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 {
|
|
678
929
|
color: #b9f6ca;
|
|
679
930
|
border-color: color-mix(in srgb, var(--ok) 55%, var(--border));
|
|
680
931
|
background: color-mix(in srgb, var(--ok) 18%, #000);
|
|
@@ -1195,336 +1446,89 @@ function renderComponentsManifest(manifest, docsManifest) {
|
|
|
1195
1446
|
overflow-y: auto;
|
|
1196
1447
|
margin-top: 8px;
|
|
1197
1448
|
}
|
|
1198
|
-
</style>
|
|
1199
|
-
</head>
|
|
1200
|
-
<body>
|
|
1201
|
-
<!-- Hidden targets for the top-level filters -->
|
|
1202
|
-
<span id="filter-all"></span>
|
|
1203
|
-
<span id="filter-errors"></span>
|
|
1204
|
-
<span id="filter-infos"></span>
|
|
1205
|
-
<span id="filter-story-errors"></span>
|
|
1206
|
-
<span id="filter-story-warnings"></span>
|
|
1207
|
-
<span id="filter-no-api"></span>
|
|
1208
|
-
<span id="filter-doc-errors"></span>
|
|
1209
|
-
<span id="filter-docs"></span>
|
|
1210
|
-
<header>
|
|
1211
|
-
<div class="wrap">
|
|
1212
|
-
<h1>Manifest Debugger</h1>
|
|
1213
|
-
<div class="summary">${allPill}${compErrorsPill}${compInfosPill}${noApiPill}${storiesPill}${snippetWarningsPill}${docsPill}</div>
|
|
1214
|
-
</div>
|
|
1215
|
-
</header>
|
|
1216
|
-
<main>
|
|
1217
|
-
<div class="wrap">
|
|
1218
|
-
<div class="note ok" style="margin-bottom: 16px;">
|
|
1219
|
-
Using <code>${esc(activeEngine)}</code>. Generation took <strong>${(durationMs / 1e3).toFixed(1)}s</strong>.
|
|
1220
|
-
</div>
|
|
1221
|
-
${grid ? `<h2 class="section-title">Components</h2>
|
|
1222
|
-
<div class="grid" role="list">
|
|
1223
|
-
${grid}
|
|
1224
|
-
</div>` : ""}
|
|
1225
|
-
${errorGroups.length ? `<div class="error-groups" role="region" aria-label="API error groups">${errorGroupsHTML}</div>` : ""}
|
|
1226
|
-
${docsGrid ? `<h2 class="section-title">Unattached Docs</h2>
|
|
1227
|
-
<div class="grid" role="list">
|
|
1228
|
-
${docsGrid}
|
|
1229
|
-
</div>` : ""}
|
|
1230
|
-
${!grid && !docsGrid ? '<div class="card"><div class="head"><div class="hint">No components or docs.</div></div></div>' : ""}
|
|
1231
|
-
</div>
|
|
1232
|
-
</main>
|
|
1233
|
-
</body>
|
|
1234
|
-
</html> `;
|
|
1235
|
-
}
|
|
1236
|
-
var esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c] ?? c), plural = (n, one, many = `${one}s`) => n === 1 ? one : many;
|
|
1237
|
-
function analyzeComponent(c) {
|
|
1238
|
-
let api = resolveComponentApi(c), hasApiError = api.kind === "error", warns = [];
|
|
1239
|
-
c.description?.trim() || warns.push("No description found. Write a jsdoc comment such as /** Component description */."), c.import?.trim() || warns.push(
|
|
1240
|
-
`Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
|
|
1241
|
-
);
|
|
1242
|
-
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;
|
|
1243
|
-
return {
|
|
1244
|
-
api,
|
|
1245
|
-
hasApiError,
|
|
1246
|
-
hasAnyError,
|
|
1247
|
-
hasWarns: warns.length > 0,
|
|
1248
|
-
warns,
|
|
1249
|
-
totalStories,
|
|
1250
|
-
storyErrors,
|
|
1251
|
-
storyWarnings,
|
|
1252
|
-
storyOk,
|
|
1253
|
-
totalDocs,
|
|
1254
|
-
docsErrors,
|
|
1255
|
-
docsOk
|
|
1256
|
-
};
|
|
1257
|
-
}
|
|
1258
|
-
function analyzeDoc(d) {
|
|
1259
|
-
return {
|
|
1260
|
-
hasError: !!d.error
|
|
1261
|
-
};
|
|
1262
|
-
}
|
|
1263
|
-
function note(title, bodyHTML, kind) {
|
|
1264
|
-
return `
|
|
1265
|
-
<div class="note ${kind}">
|
|
1266
|
-
<div class="note-title">${esc(title)}</div>
|
|
1267
|
-
<div class="note-body">${bodyHTML}</div>
|
|
1268
|
-
</div>`;
|
|
1269
|
-
}
|
|
1270
|
-
function renderDocCard(key, d, id) {
|
|
1271
|
-
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>` : "";
|
|
1272
|
-
return `
|
|
1273
|
-
<article
|
|
1274
|
-
class="card is-doc ${a.hasError ? "has-doc-error" : "no-doc-error"}"
|
|
1275
|
-
role="listitem"
|
|
1276
|
-
aria-label="${esc(d.name || key)}">
|
|
1277
|
-
<div class="head">
|
|
1278
|
-
<div class="title">
|
|
1279
|
-
<h2><span class="status-dot ${statusDot}"></span> ${esc(d.title || d.name || key)}</h2>
|
|
1280
|
-
<div class="badges">
|
|
1281
|
-
${errorBadge}
|
|
1282
|
-
${contentBadge}
|
|
1283
|
-
</div>
|
|
1284
|
-
</div>
|
|
1285
|
-
<div class="meta" title="${esc(d.path ?? d.id)}">${d.path ? `${esc(d.id)} \xB7 ${esc(d.path)}` : esc(d.id)}</div>
|
|
1286
|
-
${d.summary ? `<div>${esc(d.summary)}</div>` : ""}
|
|
1287
|
-
</div>
|
|
1288
|
-
|
|
1289
|
-
<!-- Hidden toggles must be siblings BEFORE .panels -->
|
|
1290
|
-
${a.hasError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
|
|
1291
|
-
${d.content ? `<input id="${slug}-content" class="tg tg-content" type="checkbox" hidden />` : ""}
|
|
1292
|
-
|
|
1293
|
-
<div class="panels">
|
|
1294
|
-
${a.hasError ? `
|
|
1295
|
-
<div class="panel panel-err">
|
|
1296
|
-
<div class="note err">
|
|
1297
|
-
<div class="note-title">${esc(d.error?.name || "Error")}</div>
|
|
1298
|
-
<div class="note-body"><pre><code>${esc(d.error?.message || "Unknown error")}</code></pre></div>
|
|
1299
|
-
</div>
|
|
1300
|
-
</div>` : ""}
|
|
1301
|
-
${d.content ? `
|
|
1302
|
-
<div class="panel panel-content">
|
|
1303
|
-
<div class="mdx-content">
|
|
1304
|
-
<pre><code>${esc(d.content)}</code></pre>
|
|
1305
|
-
</div>
|
|
1306
|
-
</div>` : ""}
|
|
1307
|
-
</div>
|
|
1308
|
-
</article>`;
|
|
1309
|
-
}
|
|
1310
|
-
function renderComponentCard(key, c, id, anchorId) {
|
|
1311
|
-
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" ? `
|
|
1312
|
-
<div class="panel panel-props">
|
|
1313
|
-
<div class="note ok">
|
|
1314
|
-
<div class="row">
|
|
1315
|
-
<span class="ex-name">API description</span>
|
|
1316
|
-
${c.renderer ? `<span class="badge ok">${esc(c.renderer)}</span>` : ""}
|
|
1317
|
-
</div>
|
|
1318
|
-
<pre><code>${esc(api.markdown)}</code></pre>
|
|
1319
|
-
</div>
|
|
1320
|
-
</div>` : api.kind === "props" ? `
|
|
1321
|
-
<div class="panel panel-props">
|
|
1322
|
-
<div class="note ok">
|
|
1323
|
-
<div class="row">
|
|
1324
|
-
<span class="ex-name">Prop types <small>(${api.engine})</small></span>
|
|
1325
|
-
<span class="badge ok">${api.entries.length} ${plural(api.entries.length, "prop type")}</span>
|
|
1326
|
-
</div>
|
|
1327
|
-
<pre><code>Component: ${api.filePath ? esc(path.relative(process.cwd(), api.filePath)) : ""}${api.exportName ? "::" + esc(api.exportName) : ""}</code></pre>
|
|
1328
|
-
<pre><code>Props:</code></pre>
|
|
1329
|
-
<pre><code>${esc(renderPropsCode(api.entries))}</code></pre>
|
|
1330
|
-
</div>
|
|
1331
|
-
</div>` : "", tags = c.jsDocTags && typeof c.jsDocTags == "object" ? Object.entries(c.jsDocTags).flatMap(
|
|
1332
|
-
([k, v10]) => (Array.isArray(v10) ? v10 : [v10]).map(
|
|
1333
|
-
(val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
|
|
1334
|
-
)
|
|
1335
|
-
).join("") : "";
|
|
1336
|
-
return `
|
|
1337
|
-
<article
|
|
1338
|
-
${anchorId ? `id="${esc(anchorId)}"` : ""}
|
|
1339
|
-
class="card
|
|
1340
|
-
${a.hasApiError ? "has-error" : "no-error"}
|
|
1341
|
-
${a.hasWarns ? "has-info" : "no-info"}
|
|
1342
|
-
${a.storyErrors ? "has-story-error" : "no-story-error"}
|
|
1343
|
-
${a.storyWarnings ? "has-story-warning" : "no-story-warning"}
|
|
1344
|
-
${api.kind === "none" ? "missing-api" : ""}
|
|
1345
|
-
${a.docsErrors ? "has-doc-error" : "no-doc-error"}"
|
|
1346
|
-
role="listitem"
|
|
1347
|
-
aria-label="${esc(c.name || key)}">
|
|
1348
|
-
<div class="head">
|
|
1349
|
-
<div class="title">
|
|
1350
|
-
<h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
|
|
1351
|
-
<div class="badges">
|
|
1352
|
-
${primaryBadge}
|
|
1353
|
-
${infosBadge}
|
|
1354
|
-
${storiesBadge}
|
|
1355
|
-
${docsBadge}
|
|
1356
|
-
${subcomponentsBadge}
|
|
1357
|
-
</div>
|
|
1358
|
-
</div>
|
|
1359
|
-
<div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
|
|
1360
|
-
${c.summary ? `<div>${esc(c.summary)}</div>` : ""}
|
|
1361
|
-
${c.description ? `<div class="hint">${esc(c.description)}</div>` : ""}
|
|
1362
|
-
${tags ? `<div class="kv">${tags}</div>` : ""}
|
|
1363
|
-
</div>
|
|
1364
|
-
|
|
1365
|
-
<!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
|
|
1366
|
-
${api.kind === "error" ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
|
|
1367
|
-
${a.hasWarns ? `<input id="${slug}-info" class="tg tg-info" type="checkbox" hidden />` : ""}
|
|
1368
|
-
${a.totalStories > 0 ? `<input id="${slug}-stories" class="tg tg-stories" type="checkbox" hidden />` : ""}
|
|
1369
|
-
${a.totalDocs > 0 ? `<input id="${slug}-docs" class="tg tg-docs" type="checkbox" hidden />` : ""}
|
|
1370
|
-
${subcomponentEntries.length > 0 ? `<input id="${slug}-subcomponents" class="tg tg-subcomponents" type="checkbox" hidden />` : ""}
|
|
1371
|
-
${apiPanel ? `<input id="${slug}-props" class="tg tg-props" type="checkbox" hidden />` : ""}
|
|
1372
|
-
|
|
1373
|
-
<div class="panels">
|
|
1374
|
-
${api.kind === "error" ? `
|
|
1375
|
-
<div class="panel panel-err">
|
|
1376
|
-
${note("API error", `<pre><code>${esc(api.message)}</code></pre>`, "err")}
|
|
1377
|
-
</div>` : ""}
|
|
1378
|
-
${a.hasWarns ? `
|
|
1379
|
-
<div class="panel panel-info">
|
|
1380
|
-
${a.warns.map((w) => note("Info", esc(w), "info")).join("")}
|
|
1381
|
-
</div>` : ""}
|
|
1382
|
-
${apiPanel}
|
|
1383
|
-
${a.totalStories > 0 ? `
|
|
1384
|
-
<div class="panel panel-stories">
|
|
1385
|
-
${errorStories.map(
|
|
1386
|
-
(ex) => `
|
|
1387
|
-
<div class="note err">
|
|
1388
|
-
<div class="row">
|
|
1389
|
-
<span class="ex-name">${esc(ex.name)}</span>
|
|
1390
|
-
<span class="badge err">story error</span>
|
|
1391
|
-
${ex?.warning ? '<span class="badge info">incomplete example</span>' : ""}
|
|
1392
|
-
</div>
|
|
1393
|
-
${ex?.summary ? `<div class="hint">Summary: ${esc(ex.summary)}</div>` : ""}
|
|
1394
|
-
${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
|
|
1395
|
-
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
1396
|
-
${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
|
|
1397
|
-
${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
|
|
1398
|
-
</div>`
|
|
1399
|
-
).join("")}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
${c.import ? `<div class="note ok">
|
|
1403
|
-
<div class="row">
|
|
1404
|
-
<span class="ex-name">Imports</span>
|
|
1405
|
-
</div>
|
|
1406
|
-
<pre><code>${c.import}</code></pre>
|
|
1407
|
-
</div>` : ""}
|
|
1408
|
-
|
|
1409
|
-
${okStories.map(
|
|
1410
|
-
(ex) => `
|
|
1411
|
-
<div class="note ok">
|
|
1412
|
-
<div class="row">
|
|
1413
|
-
<span class="ex-name">${esc(ex.name)}</span>
|
|
1414
|
-
<span class="badge ${ex?.warning ? "info" : "ok"}">${ex?.warning ? "incomplete example" : "story ok"}</span>
|
|
1415
|
-
</div>
|
|
1416
|
-
${ex?.summary ? `<div>${esc(ex.summary)}</div>` : ""}
|
|
1417
|
-
${ex?.description ? `<div class="hint">${esc(ex.description)}</div>` : ""}
|
|
1418
|
-
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
1419
|
-
${ex?.warning ? `<div class="snippet-warning">${esc(ex.warning)}</div>` : ""}
|
|
1420
|
-
</div>`
|
|
1421
|
-
).join("")}
|
|
1422
|
-
</div>` : ""}
|
|
1423
|
-
${a.totalDocs > 0 ? `
|
|
1424
|
-
<div class="panel panel-docs">
|
|
1425
|
-
${errorDocs.map(
|
|
1426
|
-
(doc) => `
|
|
1427
|
-
<div class="note err">
|
|
1428
|
-
<div class="row">
|
|
1429
|
-
<span class="ex-name">${esc(doc.name)}</span>
|
|
1430
|
-
<span class="badge err">doc error</span>
|
|
1431
|
-
</div>
|
|
1432
|
-
${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
|
|
1433
|
-
${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
|
|
1434
|
-
${doc?.error?.message ? `<pre><code>${esc(doc.error.message)}</code></pre>` : ""}
|
|
1435
|
-
</div>`
|
|
1436
|
-
).join("")}
|
|
1437
|
-
${okDocs.map(
|
|
1438
|
-
(doc) => `
|
|
1439
|
-
<div class="note ok">
|
|
1440
|
-
<div class="row">
|
|
1441
|
-
<span class="ex-name">${esc(doc.name)}</span>
|
|
1442
|
-
<span class="badge ok">doc ok</span>
|
|
1443
|
-
</div>
|
|
1444
|
-
${doc.path ? `<div class="hint">${esc(doc.path)}</div>` : ""}
|
|
1445
|
-
${doc?.summary ? `<div>${esc(doc.summary)}</div>` : ""}
|
|
1446
|
-
${doc?.content ? `<div class="mdx-content"><pre><code>${esc(doc.content)}</code></pre></div>` : ""}
|
|
1447
|
-
</div>`
|
|
1448
|
-
).join("")}
|
|
1449
|
-
</div>` : ""}
|
|
1450
|
-
${subcomponentEntries.length > 0 ? `
|
|
1451
|
-
<div class="panel panel-subcomponents">
|
|
1452
|
-
${subcomponentEntries.map(
|
|
1453
|
-
([subcomponentName, subcomponent]) => renderSubcomponentNote(subcomponentName, subcomponent)
|
|
1454
|
-
).join("")}
|
|
1455
|
-
</div>` : ""}
|
|
1456
|
-
</div>
|
|
1457
|
-
</article>`;
|
|
1458
|
-
}
|
|
1459
|
-
var docgenRenderData = (component) => component.reactComponentMeta ? {
|
|
1460
|
-
parsed: parseReactComponentMeta(component.reactComponentMeta),
|
|
1461
|
-
engine: "react-component-meta",
|
|
1462
|
-
filePath: component.reactComponentMeta.filePath,
|
|
1463
|
-
exportName: component.reactComponentMeta.exportName
|
|
1464
|
-
} : {};
|
|
1465
|
-
function resolveComponentApi(component) {
|
|
1466
|
-
if (component.error)
|
|
1467
|
-
return { kind: "error", message: component.error.message || "Unknown error" };
|
|
1468
|
-
let markdown = component.apiDescription?.trim();
|
|
1469
|
-
if (markdown)
|
|
1470
|
-
return { kind: "markdown", markdown };
|
|
1471
|
-
let { parsed, ...source } = docgenRenderData(component), entries = Object.entries(parsed?.props ?? {}).sort(([a], [b]) => a.localeCompare(b));
|
|
1472
|
-
return entries.length > 0 ? { kind: "props", entries, ...source } : { kind: "none" };
|
|
1473
|
-
}
|
|
1474
|
-
function renderPropsCode(entries) {
|
|
1475
|
-
return entries.map(([propName, info]) => {
|
|
1476
|
-
let description8 = (info?.description ?? "").trim(), type = (info?.type ?? "any").trim(), optional7 = info?.required ? "" : "?", defaultValue = (info?.defaultValue ?? "").trim(), fallback = defaultValue ? ` = ${defaultValue}` : "", doc = ["/**", ...description8.split(`
|
|
1477
|
-
`).map((line) => ` * ${line}`), " */"].join(`
|
|
1478
|
-
`) + `
|
|
1479
1449
|
`;
|
|
1480
|
-
return `${description8 ? doc : ""}${propName}${optional7}: ${type}${fallback}`;
|
|
1481
|
-
}).join(`
|
|
1482
1450
|
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
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"
|
|
1489
1471
|
)
|
|
1490
|
-
).
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
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>.
|
|
1509
1516
|
</div>
|
|
1510
|
-
|
|
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> `;
|
|
1511
1531
|
}
|
|
1512
|
-
var parseReactComponentMeta = (reactComponentMeta) => {
|
|
1513
|
-
let props = reactComponentMeta.props ?? {};
|
|
1514
|
-
return {
|
|
1515
|
-
props: Object.fromEntries(
|
|
1516
|
-
Object.entries(props).map(([propName, prop]) => [
|
|
1517
|
-
propName,
|
|
1518
|
-
{
|
|
1519
|
-
description: prop.description,
|
|
1520
|
-
type: prop.type?.raw ?? prop.type?.name,
|
|
1521
|
-
defaultValue: prop.defaultValue?.value,
|
|
1522
|
-
required: prop.required
|
|
1523
|
-
}
|
|
1524
|
-
])
|
|
1525
|
-
)
|
|
1526
|
-
};
|
|
1527
|
-
};
|
|
1528
1532
|
|
|
1529
1533
|
// src/core-server/utils/manifests/manifests.ts
|
|
1530
1534
|
function buildComponentsManifest(components, meta) {
|
|
@@ -2490,7 +2494,7 @@ var ReverseIndexImpl = class {
|
|
|
2490
2494
|
async function walkFromStory({
|
|
2491
2495
|
storyRoot,
|
|
2492
2496
|
registry,
|
|
2493
|
-
cache:
|
|
2497
|
+
cache: cache4,
|
|
2494
2498
|
reverseIndex,
|
|
2495
2499
|
recordEdges
|
|
2496
2500
|
}) {
|
|
@@ -2502,7 +2506,7 @@ async function walkFromStory({
|
|
|
2502
2506
|
let { file, depth } = queue[head++];
|
|
2503
2507
|
if (registry.parserFor(file) === void 0)
|
|
2504
2508
|
continue;
|
|
2505
|
-
let resolvedDeps = await
|
|
2509
|
+
let resolvedDeps = await cache4.resolveOnce(file);
|
|
2506
2510
|
recordEdges(file, resolvedDeps);
|
|
2507
2511
|
let nextDepth = depth + 1;
|
|
2508
2512
|
for (let normalised of resolvedDeps) {
|
|
@@ -2664,7 +2668,7 @@ var DEFAULT_EXTENSIONS = [".tsx", ".ts", ".d.ts", ".jsx", ".js", ".mjs", ".cjs",
|
|
|
2664
2668
|
alias,
|
|
2665
2669
|
conditionNames,
|
|
2666
2670
|
extensions: DEFAULT_EXTENSIONS
|
|
2667
|
-
}), this.projectRootEntry = join7(config.projectRoot, "
|
|
2671
|
+
}), this.projectRootEntry = join7(config.projectRoot, "__fb_resolver_root__.ts");
|
|
2668
2672
|
}
|
|
2669
2673
|
/**
|
|
2670
2674
|
* Resolves `specifier` from the file at `from` (must be an absolute path).
|
|
@@ -2873,7 +2877,7 @@ var ModuleGraphEngine = class {
|
|
|
2873
2877
|
pluginParsers
|
|
2874
2878
|
}), resolver = new ChangeDetectionResolverFactory(resolveConfig), workspaceRoots = /* @__PURE__ */ new Set([normalize5(getProjectRoot2())]), storyIndex = await this.options.getIndex(), storyIdsByFile = getStoryIdsByAbsolutePath(storyIndex, this.workingDir);
|
|
2875
2879
|
this.storyFiles = new Set(storyIdsByFile.keys());
|
|
2876
|
-
let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG,
|
|
2880
|
+
let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG, cache4 = new ParseResolveCache({
|
|
2877
2881
|
registry,
|
|
2878
2882
|
resolver,
|
|
2879
2883
|
workspaceRoots,
|
|
@@ -2886,19 +2890,19 @@ var ModuleGraphEngine = class {
|
|
|
2886
2890
|
resolver,
|
|
2887
2891
|
workspaceRoots,
|
|
2888
2892
|
projectRoot,
|
|
2889
|
-
cache:
|
|
2893
|
+
cache: cache4
|
|
2890
2894
|
});
|
|
2891
2895
|
let eventBuffer = [], unsubscribeBuffer = adapter.onFileChange((event) => {
|
|
2892
2896
|
eventBuffer.push({ event, receivedAt: Date.now() });
|
|
2893
2897
|
}), { reverseIndex, graph } = await this.dependencyGraphBuilder.build(this.storyFiles);
|
|
2894
|
-
this.reverseIndex = reverseIndex, this.dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots,
|
|
2898
|
+
this.reverseIndex = reverseIndex, this.dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache4), this.incrementalPatcher = new IncrementalPatcher({
|
|
2895
2899
|
reverseIndex,
|
|
2896
2900
|
graph,
|
|
2897
2901
|
registry,
|
|
2898
2902
|
resolver,
|
|
2899
2903
|
workspaceRoots,
|
|
2900
2904
|
projectRoot,
|
|
2901
|
-
cache:
|
|
2905
|
+
cache: cache4,
|
|
2902
2906
|
isStoryFile: (path3) => this.storyFiles.has(normalize5(path3))
|
|
2903
2907
|
}), unsubscribeBuffer();
|
|
2904
2908
|
for (let { event, receivedAt } of eventBuffer)
|
|
@@ -2944,7 +2948,7 @@ var ModuleGraphEngine = class {
|
|
|
2944
2948
|
});
|
|
2945
2949
|
}
|
|
2946
2950
|
}
|
|
2947
|
-
async dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots,
|
|
2951
|
+
async dumpDebugSnapshot(reverseIndex, graph, projectRoot, workspaceRoots, cache4) {
|
|
2948
2952
|
let debugEnv = process.env.FORKBOOK_CHANGE_DETECTION_DEBUG;
|
|
2949
2953
|
if (!debugEnv)
|
|
2950
2954
|
return;
|
|
@@ -2971,7 +2975,7 @@ var ModuleGraphEngine = class {
|
|
|
2971
2975
|
// Each entry records one named-import barrel lookup: which names were requested,
|
|
2972
2976
|
// which source files they resolved to, and whether the barrel itself was also
|
|
2973
2977
|
// included (needBarrel: true means at least one name fell back to the barrel).
|
|
2974
|
-
barrelResolutions:
|
|
2978
|
+
barrelResolutions: cache4.getBarrelTrace() ?? []
|
|
2975
2979
|
};
|
|
2976
2980
|
try {
|
|
2977
2981
|
await writeFile2(outPath, JSON.stringify(snapshot, null, 2), "utf8"), logger5.debug(`Change detection: graph debug snapshot written to ${outPath}`);
|
|
@@ -3154,7 +3158,7 @@ var GitDiffProvider = class {
|
|
|
3154
3158
|
if (this.repoRoot)
|
|
3155
3159
|
return this.repoRoot;
|
|
3156
3160
|
try {
|
|
3157
|
-
let { stdout } = await
|
|
3161
|
+
let { stdout } = await exec("git", ["rev-parse", "--show-toplevel"], {
|
|
3158
3162
|
cwd: this.cwd,
|
|
3159
3163
|
stdio: "pipe",
|
|
3160
3164
|
// Prevent git from acquiring .git/index.lock for stat-cache refreshes
|
|
@@ -3287,7 +3291,7 @@ var GitDiffProvider = class {
|
|
|
3287
3291
|
}
|
|
3288
3292
|
async runGitCommand(repoRoot, args) {
|
|
3289
3293
|
try {
|
|
3290
|
-
return await
|
|
3294
|
+
return await exec("git", args, {
|
|
3291
3295
|
cwd: repoRoot,
|
|
3292
3296
|
stdio: "pipe",
|
|
3293
3297
|
// GIT_OPTIONAL_LOCKS=0 disables the stat-cache refresh that
|
|
@@ -3351,9 +3355,9 @@ function resetChangeDetectionReadiness() {
|
|
|
3351
3355
|
function isServerStoreLeader() {
|
|
3352
3356
|
return !optionalEnvToBoolean(process.env.VITEST_CHILD_PROCESS) && !optionalEnvToBoolean(process.env.FORKBOOK_ATTACHED_TOOLS) && UniversalStore.preparedEnvironment !== UniversalStore.Environment.UNKNOWN;
|
|
3353
3357
|
}
|
|
3354
|
-
function getOrRecreateStore(id,
|
|
3358
|
+
function getOrRecreateStore(id, cache4, create) {
|
|
3355
3359
|
let leader = isServerStoreLeader();
|
|
3356
|
-
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;
|
|
3357
3361
|
}
|
|
3358
3362
|
|
|
3359
3363
|
// src/core-server/stores/status.ts
|
|
@@ -3414,10 +3418,8 @@ import {
|
|
|
3414
3418
|
import { logger as logger7, prompt } from "@aussieljk/forkbook/internal/node-logger";
|
|
3415
3419
|
import {
|
|
3416
3420
|
ErrorCollector,
|
|
3417
|
-
getPrecedingUpgrade,
|
|
3418
3421
|
isTelemetryStateResolved,
|
|
3419
3422
|
oneWayHash,
|
|
3420
|
-
onPayloadError,
|
|
3421
3423
|
setTelemetryEnabled,
|
|
3422
3424
|
telemetry,
|
|
3423
3425
|
withSpan
|
|
@@ -3468,7 +3470,7 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
|
|
|
3468
3470
|
} catch {
|
|
3469
3471
|
}
|
|
3470
3472
|
if (errorLevel !== "none") {
|
|
3471
|
-
let
|
|
3473
|
+
let error = _error, errorHash;
|
|
3472
3474
|
"message" in error ? errorHash = error.message ? oneWayHash(error.message) : "EMPTY_MESSAGE" : errorHash = "NO_MESSAGE";
|
|
3473
3475
|
let { code, name, category } = error;
|
|
3474
3476
|
if (await telemetry(
|
|
@@ -3479,7 +3481,6 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
|
|
|
3479
3481
|
category,
|
|
3480
3482
|
eventType,
|
|
3481
3483
|
blocking,
|
|
3482
|
-
precedingUpgrade,
|
|
3483
3484
|
error: errorLevel === "full" ? error : void 0,
|
|
3484
3485
|
errorHash,
|
|
3485
3486
|
// if we ever end up sending a non-error instance, we'd like to know
|
|
@@ -3487,13 +3488,8 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
|
|
|
3487
3488
|
// Include parent error information if this is a sub-error
|
|
3488
3489
|
...parent ? { parent: parent.fullErrorCode } : {}
|
|
3489
3490
|
},
|
|
3490
|
-
{
|
|
3491
|
-
|
|
3492
|
-
configDir: options.cliOptions.configDir || options.presetOptions?.configDir,
|
|
3493
|
-
enableCrashReports: errorLevel === "full",
|
|
3494
|
-
force: !0
|
|
3495
|
-
}
|
|
3496
|
-
), error && "subErrors" in error && error.subErrors.length > 0)
|
|
3491
|
+
{ force: !0 }
|
|
3492
|
+
), error && error.subErrors && error.subErrors.length > 0)
|
|
3497
3493
|
for (let subError of error.subErrors)
|
|
3498
3494
|
await sendTelemetryError(subError, eventType, options, blocking, error);
|
|
3499
3495
|
}
|
|
@@ -3501,16 +3497,20 @@ async function sendTelemetryError(_error, eventType, options, blocking = !0, par
|
|
|
3501
3497
|
}
|
|
3502
3498
|
}
|
|
3503
3499
|
async function resolveTelemetryState(options) {
|
|
3504
|
-
if (options.cliOptions.disableTelemetry !== void 0)
|
|
3505
|
-
|
|
3500
|
+
if (options.cliOptions.disableTelemetry !== void 0) {
|
|
3501
|
+
setTelemetryEnabled(!options.cliOptions.disableTelemetry);
|
|
3502
|
+
return;
|
|
3503
|
+
}
|
|
3506
3504
|
let mainConfig, configDir = options.cliOptions.configDir ?? options.presetOptions?.configDir ?? defaultConfigDir();
|
|
3507
3505
|
try {
|
|
3508
3506
|
mainConfig = await loadMainConfig({ configDir });
|
|
3509
3507
|
} catch {
|
|
3510
3508
|
}
|
|
3511
|
-
if (mainConfig)
|
|
3512
|
-
|
|
3513
|
-
|
|
3509
|
+
if (mainConfig) {
|
|
3510
|
+
setTelemetryEnabled(!mainConfig?.core?.disableTelemetry);
|
|
3511
|
+
return;
|
|
3512
|
+
}
|
|
3513
|
+
setTelemetryEnabled(options.fallbackTelemetryState ?? !1);
|
|
3514
3514
|
}
|
|
3515
3515
|
function isInterruptionError(error) {
|
|
3516
3516
|
if (!error || typeof error != "object")
|
|
@@ -3523,12 +3523,10 @@ async function withTelemetry(eventType, options, run) {
|
|
|
3523
3523
|
isTelemetryStateResolved() || await resolveTelemetryState(options);
|
|
3524
3524
|
let canceled = !1;
|
|
3525
3525
|
async function cancelTelemetry() {
|
|
3526
|
-
canceled = !0, await telemetry("canceled", { eventType }
|
|
3526
|
+
canceled = !0, await telemetry("canceled", { eventType }), process.exit(0);
|
|
3527
3527
|
}
|
|
3528
3528
|
let trackCancellation = CANCELLATION_TRACKED_EVENTS.includes(eventType);
|
|
3529
|
-
trackCancellation && process.on("SIGINT", cancelTelemetry),
|
|
3530
|
-
await sendTelemetryError(error, evtType, options);
|
|
3531
|
-
}), telemetry("boot", { eventType }, { stripMetadata: !0 });
|
|
3529
|
+
trackCancellation && process.on("SIGINT", cancelTelemetry), telemetry("boot", { eventType });
|
|
3532
3530
|
try {
|
|
3533
3531
|
return await withSpan(`forkbook ${eventType}`, { "forkbook.command": eventType }, run);
|
|
3534
3532
|
} catch (error) {
|
|
@@ -3547,7 +3545,7 @@ async function withTelemetry(eventType, options, run) {
|
|
|
3547
3545
|
let errors = ErrorCollector.getErrors();
|
|
3548
3546
|
for (let error of errors)
|
|
3549
3547
|
await sendTelemetryError(error, eventType, options, !1);
|
|
3550
|
-
process.off("SIGINT", cancelTelemetry)
|
|
3548
|
+
process.off("SIGINT", cancelTelemetry);
|
|
3551
3549
|
}
|
|
3552
3550
|
}
|
|
3553
3551
|
|
|
@@ -3654,7 +3652,7 @@ var storyInputProps = {
|
|
|
3654
3652
|
v4.optional(v4.record(v4.string(), v4.any())),
|
|
3655
3653
|
v4.description(`Optional custom props to pass to the story for rendering. Use this when you don't want to render the default story,
|
|
3656
3654
|
but you want to customize some args or other props.
|
|
3657
|
-
You can look up the component's documentation using the get-
|
|
3655
|
+
You can look up the component's documentation using the get-forkbook-story-instructions tool to see what props are available.`)
|
|
3658
3656
|
),
|
|
3659
3657
|
globals: v4.pipe(
|
|
3660
3658
|
v4.optional(v4.record(v4.string(), v4.any())),
|
|
@@ -4843,7 +4841,7 @@ async function getRefsFromConfig(options) {
|
|
|
4843
4841
|
refs = await options.presets.apply("refs", {}) ?? {};
|
|
4844
4842
|
} catch (error) {
|
|
4845
4843
|
return logger8.warn(
|
|
4846
|
-
`Composed
|
|
4844
|
+
`Composed Forkbooks are left out of the docs toolset: reading "refs" failed. ${error instanceof Error ? error.message : String(error)}`
|
|
4847
4845
|
), [];
|
|
4848
4846
|
}
|
|
4849
4847
|
return Object.entries(refs).filter(([, ref]) => typeof ref?.url == "string" && ref.url.length > 0 && !ref.disable).map(([key, ref]) => ({
|
|
@@ -5928,7 +5926,7 @@ var splitPathRegex = /\/([^/]+)\/(?:(.*)_)?([^/]+)?/, parsePath = (0, import_mem
|
|
|
5928
5926
|
return update.length >= value.length ? res : res.concat(new Array(value.length - update.length).fill(void 0));
|
|
5929
5927
|
}
|
|
5930
5928
|
return isPlainObject(value) && isPlainObject(update) ? Object.keys({ ...value, ...update }).reduce((acc, key) => {
|
|
5931
|
-
let diff = deepDiff(value
|
|
5929
|
+
let diff = deepDiff(value[key], update[key]);
|
|
5932
5930
|
return diff === DEEPLY_EQUAL ? acc : Object.assign(acc, { [key]: diff });
|
|
5933
5931
|
}, {}) : update;
|
|
5934
5932
|
}, VALIDATION_REGEXP = /^[a-zA-Z0-9 _-]*$/, NUMBER_REGEXP = /^-?[0-9]+(\.[0-9]+)?$/, HEX_REGEXP = /^#([a-f0-9]{3,4}|[a-f0-9]{6}|[a-f0-9]{8})$/i, COLOR_REGEXP = /^(rgba?|hsla?)\(([0-9]{1,3}),\s?([0-9]{1,3})%?,\s?([0-9]{1,3})%?,?\s?([0-9](\.[0-9]{1,2})?)?\)$/i, validateArgs = (key = "", value) => key === null || key === "" || !VALIDATION_REGEXP.test(key) ? !1 : value == null || value instanceof Date || typeof value == "number" || typeof value == "boolean" ? !0 : typeof value == "string" ? VALIDATION_REGEXP.test(value) || NUMBER_REGEXP.test(value) || HEX_REGEXP.test(value) || COLOR_REGEXP.test(value) : Array.isArray(value) ? value.every((v10) => validateArgs(key, v10)) : isPlainObject(value) ? Object.entries(value).every(([k, v10]) => validateArgs(k, v10)) : !1, encodeSpecialValues = (value) => value === void 0 ? "!undefined" : value === null ? "!null" : typeof value == "string" ? HEX_REGEXP.test(value) ? `!hex(${value.slice(1)})` : COLOR_REGEXP.test(value) ? `!${value.replace(/[\s%]/g, "")}` : value : typeof value == "boolean" ? `!${value}` : value instanceof Date ? `!date(${value.toISOString()})` : Array.isArray(value) ? value.map(encodeSpecialValues) : isPlainObject(value) ? Object.entries(value).reduce(
|
|
@@ -5955,7 +5953,7 @@ var splitPathRegex = /\/([^/]+)\/(?:(.*)_)?([^/]+)?/, parsePath = (0, import_mem
|
|
|
5955
5953
|
let object8 = Object.entries(update).reduce((acc, [key, value]) => validateArgs(key, value) ? Object.assign(acc, { [key]: value }) : (once2.warn(dedent3`
|
|
5956
5954
|
Omitted potentially unsafe URL args.
|
|
5957
5955
|
|
|
5958
|
-
More info: https://
|
|
5956
|
+
More info: https://forkbook.ljk.dev/docs/writing-stories/args#setting-args-through-the-url
|
|
5959
5957
|
`), acc), {});
|
|
5960
5958
|
return stringify(encodeSpecialValues(object8), {
|
|
5961
5959
|
delimiter: ";",
|
|
@@ -5964,7 +5962,9 @@ var splitPathRegex = /\/([^/]+)\/(?:(.*)_)?([^/]+)?/, parsePath = (0, import_mem
|
|
|
5964
5962
|
nestingSyntax: "js"
|
|
5965
5963
|
// encode objects using dot notation: obj.key=val
|
|
5966
5964
|
}).replace(knownQueryChar, decodeKnownQueryChar).split(";").map((part) => part.replace("=", ":")).join(";");
|
|
5967
|
-
}, queryFromString = (0, import_memoizerific.default)(1e3)(
|
|
5965
|
+
}, queryFromString = (0, import_memoizerific.default)(1e3)(
|
|
5966
|
+
(s) => s !== void 0 ? parse2(s) : {}
|
|
5967
|
+
);
|
|
5968
5968
|
var getMatch = (0, import_memoizerific.default)(1e3)((current, target, startsWith = !0) => {
|
|
5969
5969
|
if (startsWith) {
|
|
5970
5970
|
if (typeof target != "string")
|
|
@@ -5981,7 +5981,7 @@ function previewStories({
|
|
|
5981
5981
|
index,
|
|
5982
5982
|
stories
|
|
5983
5983
|
}) {
|
|
5984
|
-
let resolvedStories = findStoryIds(index, stories), result = [];
|
|
5984
|
+
let resolvedStories = findStoryIds(index, stories), result = [], pathMap = buildStoryPathMap(Object.values(index.entries)), base = origin.replace(/\/$/, "");
|
|
5985
5985
|
for (let story of resolvedStories) {
|
|
5986
5986
|
if ("errorMessage" in story) {
|
|
5987
5987
|
result.push({
|
|
@@ -5990,13 +5990,16 @@ function previewStories({
|
|
|
5990
5990
|
});
|
|
5991
5991
|
continue;
|
|
5992
5992
|
}
|
|
5993
|
-
let indexEntry = story.entry,
|
|
5994
|
-
argsParam && (
|
|
5993
|
+
let indexEntry = story.entry, query = [], argsParam = buildArgsParam({}, story.input.props ?? {});
|
|
5994
|
+
argsParam && query.push(`args=${argsParam}`);
|
|
5995
5995
|
let globalsParam = buildArgsParam({}, story.input.globals ?? {});
|
|
5996
|
-
globalsParam && (
|
|
5996
|
+
globalsParam && query.push(`globals=${globalsParam}`);
|
|
5997
|
+
let search = query.length ? `?${query.join("&")}` : "", previewUrl = `${base}${toUrlPath(`/story/${indexEntry.id}`, pathMap)}${search}`, iframeUrl = `${base}/iframe.html?${["id=" + indexEntry.id, ...query].join("&")}`;
|
|
5998
|
+
result.push({
|
|
5997
5999
|
title: indexEntry.title,
|
|
5998
6000
|
name: indexEntry.name,
|
|
5999
|
-
previewUrl
|
|
6001
|
+
previewUrl,
|
|
6002
|
+
iframeUrl
|
|
6000
6003
|
});
|
|
6001
6004
|
}
|
|
6002
6005
|
return { stories: result };
|
|
@@ -6006,7 +6009,11 @@ function previewStories({
|
|
|
6006
6009
|
var previewSuccessSchema = v8.object({
|
|
6007
6010
|
title: v8.string(),
|
|
6008
6011
|
name: v8.string(),
|
|
6009
|
-
previewUrl: v8.pipe(v8.string(), v8.description("Direct URL to open the story preview."))
|
|
6012
|
+
previewUrl: v8.pipe(v8.string(), v8.description("Direct URL to open the story preview.")),
|
|
6013
|
+
iframeUrl: v8.pipe(
|
|
6014
|
+
v8.string(),
|
|
6015
|
+
v8.description("URL of the story preview frame without the manager.")
|
|
6016
|
+
)
|
|
6010
6017
|
}), previewFailureSchema = v8.object({
|
|
6011
6018
|
input: storyInputSchema,
|
|
6012
6019
|
error: v8.string()
|
|
@@ -6437,7 +6444,7 @@ var reviewToolset = defineToolset({
|
|
|
6437
6444
|
let collectionCount = review.collections.length, storyCount = review.collections.reduce(
|
|
6438
6445
|
(total, collection) => total + collection.storyIds.length,
|
|
6439
6446
|
0
|
|
6440
|
-
), reviewUrl = `${ctx.origin.replace(/\/$/, "")}
|
|
6447
|
+
), reviewUrl = `${ctx.origin.replace(/\/$/, "")}${REVIEW_PAGE_PATH}`, data = {
|
|
6441
6448
|
reviewUrl,
|
|
6442
6449
|
collectionCount,
|
|
6443
6450
|
storyCount,
|
|
@@ -6456,514 +6463,6 @@ var reviewToolset = defineToolset({
|
|
|
6456
6463
|
}
|
|
6457
6464
|
});
|
|
6458
6465
|
|
|
6459
|
-
// src/shared/test-provider-store/index.ts
|
|
6460
|
-
var UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS = {
|
|
6461
|
-
id: "@aussieljk/forkbook/test-provider",
|
|
6462
|
-
leader: !0,
|
|
6463
|
-
initialState: {}
|
|
6464
|
-
};
|
|
6465
|
-
function createTestProviderStore({
|
|
6466
|
-
universalTestProviderStore: universalTestProviderStore2,
|
|
6467
|
-
useUniversalStore
|
|
6468
|
-
}) {
|
|
6469
|
-
let baseStore = {
|
|
6470
|
-
settingsChanged: () => {
|
|
6471
|
-
universalTestProviderStore2.untilReady().then(() => {
|
|
6472
|
-
universalTestProviderStore2.send({ type: "settings-changed" });
|
|
6473
|
-
});
|
|
6474
|
-
},
|
|
6475
|
-
onRunAll: (listener) => universalTestProviderStore2.subscribe("run-all", listener),
|
|
6476
|
-
onClearAll: (listener) => universalTestProviderStore2.subscribe("clear-all", listener)
|
|
6477
|
-
}, fullTestProviderStore2 = {
|
|
6478
|
-
...baseStore,
|
|
6479
|
-
getFullState: universalTestProviderStore2.getState,
|
|
6480
|
-
setFullState: universalTestProviderStore2.setState,
|
|
6481
|
-
onSettingsChanged: (listener) => universalTestProviderStore2.subscribe("settings-changed", listener),
|
|
6482
|
-
runAll: async () => {
|
|
6483
|
-
await universalTestProviderStore2.untilReady(), universalTestProviderStore2.send({ type: "run-all" });
|
|
6484
|
-
},
|
|
6485
|
-
clearAll: async () => {
|
|
6486
|
-
await universalTestProviderStore2.untilReady(), universalTestProviderStore2.send({ type: "clear-all" });
|
|
6487
|
-
}
|
|
6488
|
-
}, getTestProviderStoreById2 = (testProviderId) => {
|
|
6489
|
-
let getStateForTestProvider = () => universalTestProviderStore2.getState()[testProviderId] ?? "test-provider-state:pending", setStateForTestProvider = (state) => {
|
|
6490
|
-
universalTestProviderStore2.untilReady().then(() => {
|
|
6491
|
-
universalTestProviderStore2.setState((currentState) => ({
|
|
6492
|
-
...currentState,
|
|
6493
|
-
[testProviderId]: state
|
|
6494
|
-
}));
|
|
6495
|
-
});
|
|
6496
|
-
};
|
|
6497
|
-
return {
|
|
6498
|
-
...baseStore,
|
|
6499
|
-
testProviderId,
|
|
6500
|
-
getState: getStateForTestProvider,
|
|
6501
|
-
setState: setStateForTestProvider,
|
|
6502
|
-
runWithState: async (callback) => {
|
|
6503
|
-
setStateForTestProvider("test-provider-state:running");
|
|
6504
|
-
try {
|
|
6505
|
-
await callback(), setStateForTestProvider("test-provider-state:succeeded");
|
|
6506
|
-
} catch {
|
|
6507
|
-
setStateForTestProvider("test-provider-state:crashed");
|
|
6508
|
-
}
|
|
6509
|
-
}
|
|
6510
|
-
};
|
|
6511
|
-
};
|
|
6512
|
-
return useUniversalStore ? {
|
|
6513
|
-
getTestProviderStoreById: getTestProviderStoreById2,
|
|
6514
|
-
fullTestProviderStore: fullTestProviderStore2,
|
|
6515
|
-
universalTestProviderStore: universalTestProviderStore2,
|
|
6516
|
-
useTestProviderStore: (selector) => useUniversalStore(universalTestProviderStore2, selector)[0]
|
|
6517
|
-
} : {
|
|
6518
|
-
getTestProviderStoreById: getTestProviderStoreById2,
|
|
6519
|
-
fullTestProviderStore: fullTestProviderStore2,
|
|
6520
|
-
universalTestProviderStore: universalTestProviderStore2
|
|
6521
|
-
};
|
|
6522
|
-
}
|
|
6523
|
-
|
|
6524
|
-
// src/core-server/stores/test-provider.ts
|
|
6525
|
-
function createServerTestProviderStore(leader) {
|
|
6526
|
-
return createTestProviderStore({
|
|
6527
|
-
universalTestProviderStore: UniversalStore.create({
|
|
6528
|
-
...UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS,
|
|
6529
|
-
leader
|
|
6530
|
-
})
|
|
6531
|
-
});
|
|
6532
|
-
}
|
|
6533
|
-
var cache4 = {};
|
|
6534
|
-
function getTestProviderStoreBundle() {
|
|
6535
|
-
return getOrRecreateStore(
|
|
6536
|
-
UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS.id,
|
|
6537
|
-
cache4,
|
|
6538
|
-
createServerTestProviderStore
|
|
6539
|
-
);
|
|
6540
|
-
}
|
|
6541
|
-
var getTestProviderStoreById = (id) => getTestProviderStoreBundle().getTestProviderStoreById(id), fullTestProviderStore = new Proxy(
|
|
6542
|
-
{},
|
|
6543
|
-
{
|
|
6544
|
-
get(_target, prop) {
|
|
6545
|
-
let store = getTestProviderStoreBundle().fullTestProviderStore, value = Reflect.get(store, prop, store);
|
|
6546
|
-
return typeof value == "function" ? value.bind(store) : value;
|
|
6547
|
-
}
|
|
6548
|
-
}
|
|
6549
|
-
), universalTestProviderStore = new Proxy({}, {
|
|
6550
|
-
get(_target, prop) {
|
|
6551
|
-
let store = getTestProviderStoreBundle().universalTestProviderStore, value = Reflect.get(store, prop, store);
|
|
6552
|
-
return typeof value == "function" ? value.bind(store) : value;
|
|
6553
|
-
}
|
|
6554
|
-
});
|
|
6555
|
-
|
|
6556
|
-
// src/core-server/utils/ghost-stories/get-candidates.ts
|
|
6557
|
-
import { readFile as readFile6 } from "node:fs/promises";
|
|
6558
|
-
import { babelParse, traverse } from "@aussieljk/forkbook/internal/babel";
|
|
6559
|
-
|
|
6560
|
-
// src/core-server/utils/ghost-stories/component-analyzer.ts
|
|
6561
|
-
var COMPLEXITY_CONFIG = {
|
|
6562
|
-
/** Weight applied to non-empty lines */
|
|
6563
|
-
locWeight: 1,
|
|
6564
|
-
/** Imports can be cheap, so they get a lower weight */
|
|
6565
|
-
importWeight: 0.5,
|
|
6566
|
-
/**
|
|
6567
|
-
* Defines what raw complexity value should map to the upper bound of a "simple" file For instance
|
|
6568
|
-
* 30 LOC + 4 imports = 32. This would result in a score of 0.3
|
|
6569
|
-
*/
|
|
6570
|
-
simpleBaseline: 32,
|
|
6571
|
-
simpleScore: 0.3
|
|
6572
|
-
}, getComponentComplexity = (fileContent) => {
|
|
6573
|
-
let lines = fileContent.split(`
|
|
6574
|
-
`), 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);
|
|
6575
|
-
return Math.min(normalizedScore, 1);
|
|
6576
|
-
};
|
|
6577
|
-
|
|
6578
|
-
// src/core-server/utils/ghost-stories/get-candidates.ts
|
|
6579
|
-
function isValidCandidate(source) {
|
|
6580
|
-
let ast = babelParse(source), hasJSX = !1, hasExport = !1;
|
|
6581
|
-
return traverse(ast, {
|
|
6582
|
-
JSXElement(path3) {
|
|
6583
|
-
hasJSX = !0, hasExport && path3.stop();
|
|
6584
|
-
},
|
|
6585
|
-
JSXFragment(path3) {
|
|
6586
|
-
hasJSX = !0, hasExport && path3.stop();
|
|
6587
|
-
},
|
|
6588
|
-
ExportNamedDeclaration(path3) {
|
|
6589
|
-
hasExport = !0, hasJSX && path3.stop();
|
|
6590
|
-
},
|
|
6591
|
-
ExportDefaultDeclaration(path3) {
|
|
6592
|
-
hasExport = !0, hasJSX && path3.stop();
|
|
6593
|
-
},
|
|
6594
|
-
ExportAllDeclaration(path3) {
|
|
6595
|
-
hasExport = !0, hasJSX && path3.stop();
|
|
6596
|
-
}
|
|
6597
|
-
}), hasJSX && hasExport;
|
|
6598
|
-
}
|
|
6599
|
-
async function getCandidatesForStorybook(files2, sampleCount) {
|
|
6600
|
-
let simpleCandidates = [], analyzedCandidates = [];
|
|
6601
|
-
for (let file of files2) {
|
|
6602
|
-
let source;
|
|
6603
|
-
try {
|
|
6604
|
-
if (source = await readFile6(file, "utf-8"), !isValidCandidate(source))
|
|
6605
|
-
continue;
|
|
6606
|
-
} catch {
|
|
6607
|
-
continue;
|
|
6608
|
-
}
|
|
6609
|
-
let complexity = getComponentComplexity(source);
|
|
6610
|
-
if (analyzedCandidates.push({ file, complexity }), complexity < 0.3 && (simpleCandidates.push({ file, complexity }), simpleCandidates.length >= sampleCount))
|
|
6611
|
-
break;
|
|
6612
|
-
}
|
|
6613
|
-
let selectedCandidates = [];
|
|
6614
|
-
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);
|
|
6615
|
-
let avgComplexity = selectedCandidates.length > 0 ? Number(
|
|
6616
|
-
(selectedCandidates.reduce((acc, curr) => acc + curr.complexity, 0) / selectedCandidates.length).toFixed(2)
|
|
6617
|
-
) : 0;
|
|
6618
|
-
return {
|
|
6619
|
-
candidates: selectedCandidates.map(({ file }) => file),
|
|
6620
|
-
analyzedCount: analyzedCandidates.length,
|
|
6621
|
-
avgComplexity
|
|
6622
|
-
};
|
|
6623
|
-
}
|
|
6624
|
-
async function getComponentCandidates({
|
|
6625
|
-
sampleSize = 20,
|
|
6626
|
-
globPattern = "**/*.{tsx,jsx}",
|
|
6627
|
-
cwd = process.cwd()
|
|
6628
|
-
} = {}) {
|
|
6629
|
-
let globMatchCount = 0;
|
|
6630
|
-
try {
|
|
6631
|
-
let files2 = [];
|
|
6632
|
-
if (files2 = await glob(globPattern, {
|
|
6633
|
-
cwd,
|
|
6634
|
-
absolute: !0,
|
|
6635
|
-
ignore: [
|
|
6636
|
-
"**/node_modules/**",
|
|
6637
|
-
"**/.git/**",
|
|
6638
|
-
"**/dist/**",
|
|
6639
|
-
"**/__mocks__/**",
|
|
6640
|
-
"**/build/**",
|
|
6641
|
-
"**/storybook-static/**",
|
|
6642
|
-
"**/*.test.*",
|
|
6643
|
-
"**/*.d.*",
|
|
6644
|
-
"**/*.config.*",
|
|
6645
|
-
"**/*.spec.*",
|
|
6646
|
-
"**/*.stories.*",
|
|
6647
|
-
// skip example story files that come from the CLI
|
|
6648
|
-
"**/stories/{Button,Header,Page}.*",
|
|
6649
|
-
"**/stories/{button,header,page}.*"
|
|
6650
|
-
]
|
|
6651
|
-
}), globMatchCount = files2.length, globMatchCount === 0)
|
|
6652
|
-
return {
|
|
6653
|
-
candidates: [],
|
|
6654
|
-
globMatchCount
|
|
6655
|
-
};
|
|
6656
|
-
let { analyzedCount, avgComplexity, candidates } = await getCandidatesForStorybook(
|
|
6657
|
-
files2,
|
|
6658
|
-
sampleSize
|
|
6659
|
-
);
|
|
6660
|
-
return {
|
|
6661
|
-
analyzedCount,
|
|
6662
|
-
avgComplexity,
|
|
6663
|
-
candidates,
|
|
6664
|
-
globMatchCount
|
|
6665
|
-
};
|
|
6666
|
-
} catch {
|
|
6667
|
-
return {
|
|
6668
|
-
candidates: [],
|
|
6669
|
-
error: "Failed to find candidates",
|
|
6670
|
-
globMatchCount
|
|
6671
|
-
};
|
|
6672
|
-
}
|
|
6673
|
-
}
|
|
6674
|
-
|
|
6675
|
-
// src/shared/utils/categorize-render-errors.ts
|
|
6676
|
-
var ERROR_CATEGORIES = {
|
|
6677
|
-
MISSING_PROVIDER: "MISSING_PROVIDER",
|
|
6678
|
-
MISSING_STATE_PROVIDER: "MISSING_STATE_PROVIDER",
|
|
6679
|
-
MISSING_ROUTER_PROVIDER: "MISSING_ROUTER_PROVIDER",
|
|
6680
|
-
MISSING_THEME_PROVIDER: "MISSING_THEME_PROVIDER",
|
|
6681
|
-
MISSING_TRANSLATION_PROVIDER: "MISSING_TRANSLATION_PROVIDER",
|
|
6682
|
-
MISSING_PORTAL_ROOT: "MISSING_PORTAL_ROOT",
|
|
6683
|
-
HOOK_USAGE_ERROR: "HOOK_USAGE_ERROR",
|
|
6684
|
-
MODULE_IMPORT_ERROR: "MODULE_IMPORT_ERROR",
|
|
6685
|
-
COMPONENT_RENDER_ERROR: "COMPONENT_RENDER_ERROR",
|
|
6686
|
-
SERVER_COMPONENTS_ERROR: "SERVER_COMPONENTS_ERROR",
|
|
6687
|
-
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
6688
|
-
// Vite related errors
|
|
6689
|
-
DYNAMIC_MODULE_IMPORT_ERROR: "DYNAMIC_MODULE_IMPORT_ERROR",
|
|
6690
|
-
// Vitest test run related errors
|
|
6691
|
-
TEST_FILE_IMPORT_ERROR: "TEST_FILE_IMPORT_ERROR"
|
|
6692
|
-
};
|
|
6693
|
-
function buildErrorContext(message, stack) {
|
|
6694
|
-
let normalizedMessage = message.toLowerCase(), normalizedStack = (stack ?? "").toLowerCase(), stackDeps = /* @__PURE__ */ new Set(), stackLines = normalizedStack.split(`
|
|
6695
|
-
`).filter(Boolean);
|
|
6696
|
-
for (let line of stackLines) {
|
|
6697
|
-
let depMatch = line.match(/\/deps\/([^:]+)\.js/);
|
|
6698
|
-
depMatch && stackDeps.add(depMatch[1]);
|
|
6699
|
-
}
|
|
6700
|
-
return {
|
|
6701
|
-
message,
|
|
6702
|
-
stack,
|
|
6703
|
-
normalizedMessage,
|
|
6704
|
-
normalizedStack,
|
|
6705
|
-
stackDeps
|
|
6706
|
-
};
|
|
6707
|
-
}
|
|
6708
|
-
var CATEGORIZATION_RULES = [
|
|
6709
|
-
{
|
|
6710
|
-
category: ERROR_CATEGORIES.MODULE_IMPORT_ERROR,
|
|
6711
|
-
priority: 100,
|
|
6712
|
-
match: (ctx) => ctx.normalizedMessage.includes("cannot find module") || ctx.normalizedMessage.includes("module not found") || ctx.normalizedMessage.includes("cannot resolve module")
|
|
6713
|
-
},
|
|
6714
|
-
{
|
|
6715
|
-
category: ERROR_CATEGORIES.TEST_FILE_IMPORT_ERROR,
|
|
6716
|
-
priority: 95,
|
|
6717
|
-
match: (ctx) => ctx.normalizedMessage.includes("failed to import test file")
|
|
6718
|
-
},
|
|
6719
|
-
{
|
|
6720
|
-
category: ERROR_CATEGORIES.DYNAMIC_MODULE_IMPORT_ERROR,
|
|
6721
|
-
priority: 95,
|
|
6722
|
-
match: (ctx) => ctx.normalizedMessage.includes("failed to fetch dynamically imported module")
|
|
6723
|
-
},
|
|
6724
|
-
{
|
|
6725
|
-
category: ERROR_CATEGORIES.HOOK_USAGE_ERROR,
|
|
6726
|
-
priority: 90,
|
|
6727
|
-
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")
|
|
6728
|
-
},
|
|
6729
|
-
{
|
|
6730
|
-
category: ERROR_CATEGORIES.MISSING_STATE_PROVIDER,
|
|
6731
|
-
priority: 85,
|
|
6732
|
-
match: (ctx) => Array.from(ctx.stackDeps).some(isStateManagementPackage) && (ctx.normalizedMessage.includes("context") || ctx.normalizedMessage.includes("undefined") || ctx.normalizedMessage.includes("null"))
|
|
6733
|
-
},
|
|
6734
|
-
{
|
|
6735
|
-
category: ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER,
|
|
6736
|
-
priority: 85,
|
|
6737
|
-
match: (ctx) => Array.from(ctx.stackDeps).some(isRouterPackage) || ctx.normalizedMessage.includes("usenavigate") || ctx.normalizedMessage.includes("router")
|
|
6738
|
-
},
|
|
6739
|
-
{
|
|
6740
|
-
category: ERROR_CATEGORIES.SERVER_COMPONENTS_ERROR,
|
|
6741
|
-
priority: 85,
|
|
6742
|
-
match: (ctx) => ctx.normalizedMessage.includes("server components") || ctx.normalizedMessage.includes("use client") || ctx.normalizedMessage.includes("async/await") && ctx.normalizedMessage.includes("not supported")
|
|
6743
|
-
},
|
|
6744
|
-
{
|
|
6745
|
-
category: ERROR_CATEGORIES.MISSING_THEME_PROVIDER,
|
|
6746
|
-
priority: 80,
|
|
6747
|
-
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")
|
|
6748
|
-
},
|
|
6749
|
-
{
|
|
6750
|
-
category: ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER,
|
|
6751
|
-
priority: 80,
|
|
6752
|
-
match: (ctx) => Array.from(ctx.stackDeps).some(isI18nPackage) || ctx.normalizedMessage.includes("i18n") || ctx.normalizedMessage.includes("translation") || ctx.normalizedMessage.includes("locale")
|
|
6753
|
-
},
|
|
6754
|
-
{
|
|
6755
|
-
category: ERROR_CATEGORIES.MISSING_PORTAL_ROOT,
|
|
6756
|
-
priority: 70,
|
|
6757
|
-
match: (ctx) => ctx.normalizedMessage.includes("target container is not a dom element") || ctx.normalizedMessage.includes("portal") && (ctx.normalizedMessage.includes("container") || ctx.normalizedMessage.includes("root"))
|
|
6758
|
-
},
|
|
6759
|
-
{
|
|
6760
|
-
category: ERROR_CATEGORIES.MISSING_PROVIDER,
|
|
6761
|
-
priority: 60,
|
|
6762
|
-
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"))
|
|
6763
|
-
},
|
|
6764
|
-
{
|
|
6765
|
-
category: ERROR_CATEGORIES.COMPONENT_RENDER_ERROR,
|
|
6766
|
-
priority: 10,
|
|
6767
|
-
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")
|
|
6768
|
-
}
|
|
6769
|
-
], RULES = CATEGORIZATION_RULES.sort((a, b) => b.priority - a.priority);
|
|
6770
|
-
function categorizeError(message, stack) {
|
|
6771
|
-
let ctx = buildErrorContext(message, stack), rule = RULES.find((r) => r.match(ctx));
|
|
6772
|
-
if (!rule)
|
|
6773
|
-
return { category: ERROR_CATEGORIES.UNKNOWN_ERROR, matchedDependencies: [] };
|
|
6774
|
-
let matchedDependencies = getMatchedDependencies(rule.category, ctx);
|
|
6775
|
-
return { category: rule.category, matchedDependencies };
|
|
6776
|
-
}
|
|
6777
|
-
function getMatchedDependencies(category, ctx) {
|
|
6778
|
-
switch (category) {
|
|
6779
|
-
case ERROR_CATEGORIES.MISSING_STATE_PROVIDER:
|
|
6780
|
-
return Array.from(ctx.stackDeps).filter(isStateManagementPackage);
|
|
6781
|
-
case ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER:
|
|
6782
|
-
return Array.from(ctx.stackDeps).filter(isRouterPackage);
|
|
6783
|
-
case ERROR_CATEGORIES.MISSING_THEME_PROVIDER:
|
|
6784
|
-
return Array.from(ctx.stackDeps).filter(isStylingPackage);
|
|
6785
|
-
case ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER:
|
|
6786
|
-
return Array.from(ctx.stackDeps).filter(isI18nPackage);
|
|
6787
|
-
default:
|
|
6788
|
-
return [];
|
|
6789
|
-
}
|
|
6790
|
-
}
|
|
6791
|
-
|
|
6792
|
-
// src/shared/utils/analyze-test-results.ts
|
|
6793
|
-
function extractCategorizedErrors(testResults) {
|
|
6794
|
-
let failed = testResults.filter((r) => r.status === "FAIL" && r.error), map = /* @__PURE__ */ new Map(), uniqueErrorMessages = /* @__PURE__ */ new Set();
|
|
6795
|
-
for (let r of failed) {
|
|
6796
|
-
let { category, matchedDependencies } = categorizeError(r.error, r.stack);
|
|
6797
|
-
map.has(category) || map.set(category, { count: 0, uniqueErrors: /* @__PURE__ */ new Set(), matchedDependencies: /* @__PURE__ */ new Set() });
|
|
6798
|
-
let data = map.get(category);
|
|
6799
|
-
data.count++, matchedDependencies.forEach((dep) => data.matchedDependencies.add(dep)), uniqueErrorMessages.add(r.error), data.uniqueErrors.add(r.error);
|
|
6800
|
-
}
|
|
6801
|
-
let categorizedErrors = Array.from(map.entries()).reduce(
|
|
6802
|
-
(acc, [category, data]) => (acc[category] = {
|
|
6803
|
-
uniqueCount: data.uniqueErrors.size,
|
|
6804
|
-
count: data.count,
|
|
6805
|
-
matchedDependencies: Array.from(data.matchedDependencies).sort()
|
|
6806
|
-
}, acc),
|
|
6807
|
-
{}
|
|
6808
|
-
);
|
|
6809
|
-
return {
|
|
6810
|
-
totalErrors: failed.length,
|
|
6811
|
-
uniqueErrorCount: uniqueErrorMessages.size,
|
|
6812
|
-
categorizedErrors
|
|
6813
|
-
};
|
|
6814
|
-
}
|
|
6815
|
-
var CSS_CHECK_STORY_ID_SUFFIX = "--css-check";
|
|
6816
|
-
function summarizeResults(results) {
|
|
6817
|
-
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(
|
|
6818
|
-
(r) => r.storyId.toLowerCase().endsWith(CSS_CHECK_STORY_ID_SUFFIX)
|
|
6819
|
-
), cssCheck = cssCheckMatch?.status === "PASS" ? "pass" : cssCheckMatch?.status === "FAIL" ? "fail" : "not-run";
|
|
6820
|
-
return {
|
|
6821
|
-
total,
|
|
6822
|
-
passed,
|
|
6823
|
-
passedButEmptyRender,
|
|
6824
|
-
successRate,
|
|
6825
|
-
successRateWithoutEmptyRender,
|
|
6826
|
-
uniqueErrorCount: errorClassification.uniqueErrorCount,
|
|
6827
|
-
categorizedErrors: errorClassification.categorizedErrors,
|
|
6828
|
-
cssCheck
|
|
6829
|
-
};
|
|
6830
|
-
}
|
|
6831
|
-
function analyzeTestResults(results, cumulativeResults) {
|
|
6832
|
-
let run = summarizeResults(results), analysis = {
|
|
6833
|
-
total: run.total,
|
|
6834
|
-
passed: run.passed,
|
|
6835
|
-
passedButEmptyRender: run.passedButEmptyRender,
|
|
6836
|
-
successRate: run.successRate,
|
|
6837
|
-
successRateWithoutEmptyRender: run.successRateWithoutEmptyRender,
|
|
6838
|
-
uniqueErrorCount: run.uniqueErrorCount,
|
|
6839
|
-
categorizedErrors: run.categorizedErrors,
|
|
6840
|
-
cssCheck: run.cssCheck
|
|
6841
|
-
};
|
|
6842
|
-
if (cumulativeResults) {
|
|
6843
|
-
let cumulative = summarizeResults(cumulativeResults);
|
|
6844
|
-
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;
|
|
6845
|
-
}
|
|
6846
|
-
return analysis;
|
|
6847
|
-
}
|
|
6848
|
-
|
|
6849
|
-
// src/shared/utils/to-story-test-result.ts
|
|
6850
|
-
var DEBUG_BANNER_RE = /^\n(?:\x1B\[\d+m)?Click to debug\b[^\n]*\n\n/;
|
|
6851
|
-
function extractErrorMessage(message, stack) {
|
|
6852
|
-
return (message ?? "").replace(DEBUG_BANNER_RE, "").split(`
|
|
6853
|
-
`)[0] || stack?.split(`
|
|
6854
|
-
`)[0] || "unknown error";
|
|
6855
|
-
}
|
|
6856
|
-
function detectEmptyRender(reports) {
|
|
6857
|
-
return reports?.some(
|
|
6858
|
-
(report) => report.type === "render-analysis" && report.result?.emptyRender === !0
|
|
6859
|
-
) ?? !1;
|
|
6860
|
-
}
|
|
6861
|
-
function normalizeStatus(statusRaw) {
|
|
6862
|
-
return statusRaw === "passed" ? "PASS" : statusRaw === "failed" ? "FAIL" : "PENDING";
|
|
6863
|
-
}
|
|
6864
|
-
function toStoryTestResult(input) {
|
|
6865
|
-
if (!input.storyId)
|
|
6866
|
-
return null;
|
|
6867
|
-
let status = normalizeStatus(input.statusRaw), emptyRender = status === "PASS" && detectEmptyRender(input.reports), error, stack;
|
|
6868
|
-
if (input.errors && input.errors.length > 0) {
|
|
6869
|
-
let firstError = input.errors[0];
|
|
6870
|
-
error = extractErrorMessage(firstError.message, firstError.stack), stack = firstError.stack ?? firstError.message;
|
|
6871
|
-
}
|
|
6872
|
-
return {
|
|
6873
|
-
storyId: input.storyId,
|
|
6874
|
-
status,
|
|
6875
|
-
error,
|
|
6876
|
-
stack,
|
|
6877
|
-
emptyRender: emptyRender || void 0
|
|
6878
|
-
};
|
|
6879
|
-
}
|
|
6880
|
-
|
|
6881
|
-
// src/core-server/utils/ghost-stories/run-story-tests.ts
|
|
6882
|
-
import { existsSync as existsSync4 } from "node:fs";
|
|
6883
|
-
import { mkdir as mkdir2, readFile as readFile7 } from "node:fs/promises";
|
|
6884
|
-
import { executeCommand, resolvePathInStorybookCache as resolvePathInStorybookCache2 } from "@aussieljk/forkbook/internal/common";
|
|
6885
|
-
import { join as join11 } from "pathe";
|
|
6886
|
-
|
|
6887
|
-
// src/core-server/utils/ghost-stories/parse-vitest-report.ts
|
|
6888
|
-
function parseVitestResults(report) {
|
|
6889
|
-
let storyTestResults = [];
|
|
6890
|
-
for (let testSuite of report.testResults)
|
|
6891
|
-
for (let assertion of testSuite.assertionResults) {
|
|
6892
|
-
let result = toStoryTestResult({
|
|
6893
|
-
storyId: assertion.meta?.storyId ?? assertion.fullName,
|
|
6894
|
-
statusRaw: assertion.status,
|
|
6895
|
-
reports: assertion.meta?.reports,
|
|
6896
|
-
errors: assertion.failureMessages?.map((message) => ({ stack: message }))
|
|
6897
|
-
});
|
|
6898
|
-
result && storyTestResults.push(result);
|
|
6899
|
-
}
|
|
6900
|
-
return {
|
|
6901
|
-
summary: analyzeTestResults(storyTestResults)
|
|
6902
|
-
};
|
|
6903
|
-
}
|
|
6904
|
-
|
|
6905
|
-
// src/core-server/utils/ghost-stories/run-story-tests.ts
|
|
6906
|
-
async function runStoryTests(componentFilePaths, options) {
|
|
6907
|
-
let cwd = options?.cwd;
|
|
6908
|
-
try {
|
|
6909
|
-
let cacheDir2 = resolvePathInStorybookCache2("story-tests");
|
|
6910
|
-
await mkdir2(cacheDir2, { recursive: !0 });
|
|
6911
|
-
let timestamp = Date.now(), outputFile = join11(cacheDir2, `test-results-${timestamp}.json`), startTime = Date.now(), testFailureMessage;
|
|
6912
|
-
try {
|
|
6913
|
-
await executeCommand({
|
|
6914
|
-
command: "npx",
|
|
6915
|
-
args: [
|
|
6916
|
-
"vitest",
|
|
6917
|
-
"run",
|
|
6918
|
-
"--reporter=json",
|
|
6919
|
-
"--testTimeout=1000",
|
|
6920
|
-
`--outputFile=${outputFile}`,
|
|
6921
|
-
...componentFilePaths
|
|
6922
|
-
],
|
|
6923
|
-
cwd,
|
|
6924
|
-
stdio: "pipe",
|
|
6925
|
-
env: {
|
|
6926
|
-
FORKBOOK_INTERNAL_TEST_RUN: "1",
|
|
6927
|
-
...options?.ghostRun ? { FORKBOOK_COMPONENT_PATHS: componentFilePaths.join(";") } : {}
|
|
6928
|
-
}
|
|
6929
|
-
});
|
|
6930
|
-
} catch (error) {
|
|
6931
|
-
let errorMessage = (error.stderr || String(error) || "").toLowerCase();
|
|
6932
|
-
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");
|
|
6933
|
-
}
|
|
6934
|
-
let duration = Date.now() - startTime;
|
|
6935
|
-
if (testFailureMessage)
|
|
6936
|
-
return {
|
|
6937
|
-
duration,
|
|
6938
|
-
runError: testFailureMessage
|
|
6939
|
-
};
|
|
6940
|
-
if (!existsSync4(outputFile))
|
|
6941
|
-
return {
|
|
6942
|
-
duration,
|
|
6943
|
-
runError: "JSON report not found"
|
|
6944
|
-
};
|
|
6945
|
-
let vitestReport;
|
|
6946
|
-
try {
|
|
6947
|
-
let resultsJson = await readFile7(outputFile, "utf8");
|
|
6948
|
-
vitestReport = JSON.parse(resultsJson);
|
|
6949
|
-
} catch {
|
|
6950
|
-
return {
|
|
6951
|
-
duration,
|
|
6952
|
-
runError: "Failed to read or parse JSON report"
|
|
6953
|
-
};
|
|
6954
|
-
}
|
|
6955
|
-
return !vitestReport.testResults || vitestReport.testResults.length === 0 ? {
|
|
6956
|
-
duration,
|
|
6957
|
-
runError: "No tests found"
|
|
6958
|
-
} : { ...parseVitestResults(vitestReport), duration };
|
|
6959
|
-
} catch {
|
|
6960
|
-
return {
|
|
6961
|
-
runError: "Uncaught error running story tests",
|
|
6962
|
-
duration: 0
|
|
6963
|
-
};
|
|
6964
|
-
}
|
|
6965
|
-
}
|
|
6966
|
-
|
|
6967
6466
|
// src/shared/open-service/services/story-docs/snippet.ts
|
|
6968
6467
|
function prependImportToSnippet(importBlock, snippet) {
|
|
6969
6468
|
let trimmedImport = importBlock?.trim();
|
|
@@ -7001,6 +6500,7 @@ export {
|
|
|
7001
6500
|
getChangeDetectionReadiness,
|
|
7002
6501
|
setChangeDetectionReadiness,
|
|
7003
6502
|
resetChangeDetectionReadiness,
|
|
6503
|
+
getOrRecreateStore,
|
|
7004
6504
|
getStatusStoreByTypeId,
|
|
7005
6505
|
getSyncedStatuses,
|
|
7006
6506
|
fullStatusStore,
|
|
@@ -7021,12 +6521,5 @@ export {
|
|
|
7021
6521
|
createLocalDocsAccess,
|
|
7022
6522
|
getRefsFromConfig,
|
|
7023
6523
|
createStoriesToolset,
|
|
7024
|
-
reviewToolset
|
|
7025
|
-
getTestProviderStoreById,
|
|
7026
|
-
fullTestProviderStore,
|
|
7027
|
-
universalTestProviderStore,
|
|
7028
|
-
getComponentCandidates,
|
|
7029
|
-
analyzeTestResults,
|
|
7030
|
-
toStoryTestResult,
|
|
7031
|
-
runStoryTests
|
|
6524
|
+
reviewToolset
|
|
7032
6525
|
};
|