@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
|
|
@@ -13,30 +13,37 @@ import {
|
|
|
13
13
|
fromMarkdown,
|
|
14
14
|
mdxFromMarkdown,
|
|
15
15
|
mdxjs
|
|
16
|
-
} from "../_node-chunks/chunk-
|
|
16
|
+
} from "../_node-chunks/chunk-IBLUURAJ.js";
|
|
17
17
|
import {
|
|
18
18
|
require_dist
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
19
|
+
} from "../_node-chunks/chunk-XF7H5GZM.js";
|
|
20
20
|
import {
|
|
21
21
|
BananaSlug
|
|
22
|
-
} from "../_node-chunks/chunk-
|
|
22
|
+
} from "../_node-chunks/chunk-N5WU4BEY.js";
|
|
23
|
+
import {
|
|
24
|
+
withRouteDepth
|
|
25
|
+
} from "../_node-chunks/chunk-JOX7OETB.js";
|
|
26
|
+
import {
|
|
27
|
+
createBasePathMount,
|
|
28
|
+
isForwardedForOrigin,
|
|
29
|
+
resolveBasePath
|
|
30
|
+
} from "../_node-chunks/chunk-6FWJWEAG.js";
|
|
23
31
|
import {
|
|
24
32
|
debounce
|
|
25
|
-
} from "../_node-chunks/chunk-
|
|
33
|
+
} from "../_node-chunks/chunk-ZX32M4O7.js";
|
|
26
34
|
import {
|
|
27
35
|
require_lib
|
|
28
|
-
} from "../_node-chunks/chunk-
|
|
36
|
+
} from "../_node-chunks/chunk-N25CZ3RC.js";
|
|
29
37
|
import {
|
|
30
38
|
Parser,
|
|
31
39
|
init_acorn,
|
|
32
40
|
require_acorn_jsx
|
|
33
|
-
} from "../_node-chunks/chunk-
|
|
41
|
+
} from "../_node-chunks/chunk-LNGSV5UI.js";
|
|
34
42
|
import {
|
|
35
43
|
isTelemetryModuleEnabled,
|
|
36
44
|
telemetry,
|
|
37
45
|
withSpan
|
|
38
|
-
} from "../_node-chunks/chunk-
|
|
39
|
-
import "../_node-chunks/chunk-CQKMLL5J.js";
|
|
46
|
+
} from "../_node-chunks/chunk-FXW52X4U.js";
|
|
40
47
|
import {
|
|
41
48
|
getEffectiveToolAvailability,
|
|
42
49
|
getManifestStatus,
|
|
@@ -46,48 +53,42 @@ import {
|
|
|
46
53
|
isClaudePreviewLaunch,
|
|
47
54
|
isModuleGraphSupported,
|
|
48
55
|
resolveSkillInputs
|
|
49
|
-
} from "../_node-chunks/chunk-
|
|
56
|
+
} from "../_node-chunks/chunk-ZHRCL7PG.js";
|
|
50
57
|
import {
|
|
51
58
|
CLAUDE_PREVIEW_AGENT_NAME
|
|
52
|
-
} from "../_node-chunks/chunk-
|
|
53
|
-
import "../_node-chunks/chunk-
|
|
54
|
-
import "../_node-chunks/chunk-
|
|
55
|
-
import "../_node-chunks/chunk-WAXVSN3O.js";
|
|
59
|
+
} from "../_node-chunks/chunk-GWT4HQZU.js";
|
|
60
|
+
import "../_node-chunks/chunk-CJDYU653.js";
|
|
61
|
+
import "../_node-chunks/chunk-CGVVOUBC.js";
|
|
56
62
|
import {
|
|
57
63
|
detectAgent
|
|
58
|
-
} from "../_node-chunks/chunk-
|
|
59
|
-
import "../_node-chunks/chunk-
|
|
60
|
-
import "../_node-chunks/chunk-
|
|
64
|
+
} from "../_node-chunks/chunk-OBPVOYJA.js";
|
|
65
|
+
import "../_node-chunks/chunk-S7RGKBGT.js";
|
|
66
|
+
import "../_node-chunks/chunk-75TTPKEA.js";
|
|
61
67
|
import {
|
|
62
68
|
userOrAutoTitleFromSpecifier
|
|
63
|
-
} from "../_node-chunks/chunk-
|
|
64
|
-
import "../_node-chunks/chunk-
|
|
65
|
-
import "../_node-chunks/chunk-
|
|
66
|
-
import "../_node-chunks/chunk-
|
|
69
|
+
} from "../_node-chunks/chunk-WMZJ2WK4.js";
|
|
70
|
+
import "../_node-chunks/chunk-LCNF6BLP.js";
|
|
71
|
+
import "../_node-chunks/chunk-6NLQCV6A.js";
|
|
72
|
+
import "../_node-chunks/chunk-7M3TOE4F.js";
|
|
67
73
|
import {
|
|
68
74
|
resolveImport,
|
|
69
75
|
supportedExtensions
|
|
70
|
-
} from "../_node-chunks/chunk-
|
|
71
|
-
import "../_node-chunks/chunk-
|
|
72
|
-
import "../_node-chunks/chunk-
|
|
76
|
+
} from "../_node-chunks/chunk-QQNRWEHL.js";
|
|
77
|
+
import "../_node-chunks/chunk-MWKSSYPG.js";
|
|
78
|
+
import "../_node-chunks/chunk-2VJHCGAK.js";
|
|
73
79
|
import {
|
|
74
80
|
require_src
|
|
75
|
-
} from "../_node-chunks/chunk-
|
|
76
|
-
import "../_node-chunks/chunk-
|
|
77
|
-
import "../_node-chunks/chunk-
|
|
78
|
-
import "../_node-chunks/chunk-3BKIBF5S.js";
|
|
79
|
-
import "../_node-chunks/chunk-SIEXZVCR.js";
|
|
80
|
-
import "../_node-chunks/chunk-RZMQ7S3L.js";
|
|
81
|
+
} from "../_node-chunks/chunk-SFXFL4TP.js";
|
|
82
|
+
import "../_node-chunks/chunk-EFCBUWOB.js";
|
|
83
|
+
import "../_node-chunks/chunk-VYCVBW5Q.js";
|
|
81
84
|
import {
|
|
82
|
-
logger
|
|
83
|
-
|
|
84
|
-
} from "../_node-chunks/chunk-6LMWA44H.js";
|
|
85
|
+
logger
|
|
86
|
+
} from "../_node-chunks/chunk-AVHJZUTH.js";
|
|
85
87
|
import {
|
|
86
88
|
ChangeDetectionFailureError,
|
|
87
89
|
ChangeDetectionUnavailableError,
|
|
88
90
|
GitDiffProvider,
|
|
89
91
|
MDX_SERVICE_ID,
|
|
90
|
-
analyzeTestResults,
|
|
91
92
|
applyServicesPresetOnce,
|
|
92
93
|
createDocsToolset,
|
|
93
94
|
createLocalDocsAccess,
|
|
@@ -98,17 +99,15 @@ import {
|
|
|
98
99
|
emptyManifests,
|
|
99
100
|
findStoryIds,
|
|
100
101
|
fullStatusStore,
|
|
101
|
-
fullTestProviderStore,
|
|
102
102
|
getBuilders,
|
|
103
103
|
getChangeDetectionReadiness,
|
|
104
|
-
getComponentCandidates,
|
|
105
104
|
getErrorLevel,
|
|
106
105
|
getManagerBuilder,
|
|
106
|
+
getOrRecreateStore,
|
|
107
107
|
getPreviewBuilder,
|
|
108
108
|
getRefsFromConfig,
|
|
109
109
|
getStatusStoreByTypeId,
|
|
110
110
|
getStoryIdsByAbsolutePath,
|
|
111
|
-
getTestProviderStoreById,
|
|
112
111
|
getWsToken,
|
|
113
112
|
loadManifests,
|
|
114
113
|
mapStaticDir,
|
|
@@ -120,91 +119,96 @@ import {
|
|
|
120
119
|
resetServicesPresetOnce,
|
|
121
120
|
resolveChangeDetectionAdapter,
|
|
122
121
|
reviewToolset,
|
|
123
|
-
runStoryTests,
|
|
124
122
|
sendTelemetryError,
|
|
125
123
|
setChangeDetectionHost,
|
|
126
124
|
setChangeDetectionReadiness,
|
|
127
125
|
storyInputArraySchema,
|
|
128
|
-
toStoryTestResult,
|
|
129
126
|
universalStatusStore,
|
|
130
|
-
universalTestProviderStore,
|
|
131
127
|
useStatics,
|
|
132
128
|
withTelemetry,
|
|
133
129
|
writeManifests
|
|
134
|
-
} from "../_node-chunks/chunk-
|
|
130
|
+
} from "../_node-chunks/chunk-NZWK62R5.js";
|
|
135
131
|
import {
|
|
136
132
|
UniversalStore
|
|
137
|
-
} from "../_node-chunks/chunk-
|
|
133
|
+
} from "../_node-chunks/chunk-JXZONVHW.js";
|
|
134
|
+
import {
|
|
135
|
+
buildStoryPathMap,
|
|
136
|
+
urlPathDepth
|
|
137
|
+
} from "../_node-chunks/chunk-PJRPETSU.js";
|
|
138
138
|
import {
|
|
139
139
|
init_build,
|
|
140
140
|
parse
|
|
141
|
-
} from "../_node-chunks/chunk-
|
|
142
|
-
import
|
|
143
|
-
|
|
141
|
+
} from "../_node-chunks/chunk-J6FGP2VM.js";
|
|
142
|
+
import {
|
|
143
|
+
joinBasePath,
|
|
144
|
+
normalizeBasePath
|
|
145
|
+
} from "../_node-chunks/chunk-SUQ4OM7Y.js";
|
|
146
|
+
import "../_node-chunks/chunk-5LFJQCYN.js";
|
|
144
147
|
import {
|
|
145
148
|
registerToolset
|
|
146
|
-
} from "../_node-chunks/chunk-
|
|
147
|
-
import "../_node-chunks/chunk-
|
|
148
|
-
import "../_node-chunks/chunk-
|
|
149
|
-
import "../_node-chunks/chunk-
|
|
149
|
+
} from "../_node-chunks/chunk-65X3MXFT.js";
|
|
150
|
+
import "../_node-chunks/chunk-VNZF62KE.js";
|
|
151
|
+
import "../_node-chunks/chunk-WDANLGYN.js";
|
|
152
|
+
import "../_node-chunks/chunk-IIGBIVK3.js";
|
|
150
153
|
import {
|
|
151
154
|
STORY_FILE_TEST_REGEXP,
|
|
152
|
-
getStoryImportPathFromEntry
|
|
153
|
-
|
|
154
|
-
} from "../_node-chunks/chunk-MK2KYAI6.js";
|
|
155
|
-
import "../_node-chunks/chunk-IDEL2J23.js";
|
|
156
|
-
import "../_node-chunks/chunk-BXVYT7SB.js";
|
|
155
|
+
getStoryImportPathFromEntry
|
|
156
|
+
} from "../_node-chunks/chunk-LAJIVWUF.js";
|
|
157
157
|
import {
|
|
158
158
|
getService,
|
|
159
159
|
registerService,
|
|
160
160
|
writeOpenServiceStaticFiles
|
|
161
|
-
} from "../_node-chunks/chunk-
|
|
161
|
+
} from "../_node-chunks/chunk-DQEUNKLX.js";
|
|
162
162
|
import {
|
|
163
163
|
Channel,
|
|
164
164
|
describeService,
|
|
165
165
|
getRegisteredServices,
|
|
166
166
|
listServices
|
|
167
|
-
} from "../_node-chunks/chunk-
|
|
168
|
-
import
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
import "../_node-chunks/chunk-
|
|
172
|
-
import "../_node-chunks/chunk-
|
|
167
|
+
} from "../_node-chunks/chunk-HHM5X5RQ.js";
|
|
168
|
+
import {
|
|
169
|
+
isEqual
|
|
170
|
+
} from "../_node-chunks/chunk-EG2WLN5V.js";
|
|
171
|
+
import "../_node-chunks/chunk-MC4BFUVH.js";
|
|
172
|
+
import "../_node-chunks/chunk-7CWDZLIZ.js";
|
|
173
|
+
import "../_node-chunks/chunk-QEYWG5C7.js";
|
|
173
174
|
import {
|
|
174
175
|
Tag
|
|
175
|
-
} from "../_node-chunks/chunk-
|
|
176
|
-
import "../_node-chunks/chunk-
|
|
177
|
-
import "../_node-chunks/chunk-
|
|
176
|
+
} from "../_node-chunks/chunk-VIMGLCNZ.js";
|
|
177
|
+
import "../_node-chunks/chunk-XUZB4FIX.js";
|
|
178
|
+
import "../_node-chunks/chunk-AP4HJ3I3.js";
|
|
178
179
|
import {
|
|
179
180
|
up2 as up
|
|
180
|
-
} from "../_node-chunks/chunk-
|
|
181
|
+
} from "../_node-chunks/chunk-SPAHK37C.js";
|
|
181
182
|
import {
|
|
182
183
|
invariant
|
|
183
|
-
} from "../_node-chunks/chunk-
|
|
184
|
+
} from "../_node-chunks/chunk-KAALBGRE.js";
|
|
184
185
|
import {
|
|
185
186
|
resolvePackageDir,
|
|
186
187
|
safeResolveModule
|
|
187
|
-
} from "../_node-chunks/chunk-
|
|
188
|
-
import "../_node-chunks/chunk-
|
|
188
|
+
} from "../_node-chunks/chunk-ZN6YOIB2.js";
|
|
189
|
+
import "../_node-chunks/chunk-F762PHMI.js";
|
|
189
190
|
import {
|
|
190
191
|
StorybookError
|
|
191
|
-
} from "../_node-chunks/chunk-
|
|
192
|
+
} from "../_node-chunks/chunk-2CNN3CRI.js";
|
|
192
193
|
import {
|
|
193
194
|
require_picocolors
|
|
194
|
-
} from "../_node-chunks/chunk-
|
|
195
|
+
} from "../_node-chunks/chunk-IENHXJVB.js";
|
|
195
196
|
import {
|
|
196
197
|
storyIndexPathToAbsolutePath
|
|
197
|
-
} from "../_node-chunks/chunk-
|
|
198
|
-
import "../_node-chunks/chunk-
|
|
198
|
+
} from "../_node-chunks/chunk-6RYD6ENB.js";
|
|
199
|
+
import "../_node-chunks/chunk-DO3CPQAZ.js";
|
|
199
200
|
import {
|
|
200
201
|
slash
|
|
201
|
-
} from "../_node-chunks/chunk-
|
|
202
|
-
import
|
|
202
|
+
} from "../_node-chunks/chunk-AGLGQNTY.js";
|
|
203
|
+
import {
|
|
204
|
+
glob
|
|
205
|
+
} from "../_node-chunks/chunk-GFEH7IBP.js";
|
|
206
|
+
import "../_node-chunks/chunk-L52VGA36.js";
|
|
203
207
|
import {
|
|
204
208
|
__commonJS,
|
|
205
209
|
__require,
|
|
206
210
|
__toESM
|
|
207
|
-
} from "../_node-chunks/chunk-
|
|
211
|
+
} from "../_node-chunks/chunk-X2GGQZIN.js";
|
|
208
212
|
|
|
209
213
|
// ../../node_modules/@discoveryjs/json-ext/package.json
|
|
210
214
|
var require_package = __commonJS({
|
|
@@ -707,7 +711,7 @@ var require_parse_chunked = __commonJS({
|
|
|
707
711
|
module.exports = function(chunkEmitter) {
|
|
708
712
|
let parser = new ChunkParser();
|
|
709
713
|
if (isObject(chunkEmitter) && isReadableStream(chunkEmitter))
|
|
710
|
-
return new Promise((
|
|
714
|
+
return new Promise((resolve10, reject) => {
|
|
711
715
|
chunkEmitter.on("data", (chunk) => {
|
|
712
716
|
try {
|
|
713
717
|
parser.push(chunk);
|
|
@@ -718,7 +722,7 @@ var require_parse_chunked = __commonJS({
|
|
|
718
722
|
parser = null, reject(e);
|
|
719
723
|
}).on("end", () => {
|
|
720
724
|
try {
|
|
721
|
-
|
|
725
|
+
resolve10(parser.finish());
|
|
722
726
|
} catch (e) {
|
|
723
727
|
reject(adjustPosition(e, parser));
|
|
724
728
|
} finally {
|
|
@@ -729,11 +733,11 @@ var require_parse_chunked = __commonJS({
|
|
|
729
733
|
if (typeof chunkEmitter == "function") {
|
|
730
734
|
let iterator = chunkEmitter();
|
|
731
735
|
if (isObject(iterator) && (Symbol.iterator in iterator || Symbol.asyncIterator in iterator))
|
|
732
|
-
return new Promise(async (
|
|
736
|
+
return new Promise(async (resolve10, reject) => {
|
|
733
737
|
try {
|
|
734
738
|
for await (let chunk of iterator)
|
|
735
739
|
parser.push(chunk);
|
|
736
|
-
|
|
740
|
+
resolve10(parser.finish());
|
|
737
741
|
} catch (e) {
|
|
738
742
|
reject(adjustPosition(e, parser));
|
|
739
743
|
} finally {
|
|
@@ -881,6 +885,361 @@ var require_src2 = __commonJS({
|
|
|
881
885
|
}
|
|
882
886
|
});
|
|
883
887
|
|
|
888
|
+
// ../../node_modules/isexe/windows.js
|
|
889
|
+
var require_windows = __commonJS({
|
|
890
|
+
"../../node_modules/isexe/windows.js"(exports, module) {
|
|
891
|
+
module.exports = isexe;
|
|
892
|
+
isexe.sync = sync;
|
|
893
|
+
var fs = __require("fs");
|
|
894
|
+
function checkPathExt(path, options) {
|
|
895
|
+
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
896
|
+
if (!pathext || (pathext = pathext.split(";"), pathext.indexOf("") !== -1))
|
|
897
|
+
return !0;
|
|
898
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
899
|
+
var p = pathext[i].toLowerCase();
|
|
900
|
+
if (p && path.substr(-p.length).toLowerCase() === p)
|
|
901
|
+
return !0;
|
|
902
|
+
}
|
|
903
|
+
return !1;
|
|
904
|
+
}
|
|
905
|
+
function checkStat(stat2, path, options) {
|
|
906
|
+
return !stat2.isSymbolicLink() && !stat2.isFile() ? !1 : checkPathExt(path, options);
|
|
907
|
+
}
|
|
908
|
+
function isexe(path, options, cb) {
|
|
909
|
+
fs.stat(path, function(er, stat2) {
|
|
910
|
+
cb(er, er ? !1 : checkStat(stat2, path, options));
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
function sync(path, options) {
|
|
914
|
+
return checkStat(fs.statSync(path), path, options);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
|
|
919
|
+
// ../../node_modules/isexe/mode.js
|
|
920
|
+
var require_mode = __commonJS({
|
|
921
|
+
"../../node_modules/isexe/mode.js"(exports, module) {
|
|
922
|
+
module.exports = isexe;
|
|
923
|
+
isexe.sync = sync;
|
|
924
|
+
var fs = __require("fs");
|
|
925
|
+
function isexe(path, options, cb) {
|
|
926
|
+
fs.stat(path, function(er, stat2) {
|
|
927
|
+
cb(er, er ? !1 : checkStat(stat2, options));
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
function sync(path, options) {
|
|
931
|
+
return checkStat(fs.statSync(path), options);
|
|
932
|
+
}
|
|
933
|
+
function checkStat(stat2, options) {
|
|
934
|
+
return stat2.isFile() && checkMode(stat2, options);
|
|
935
|
+
}
|
|
936
|
+
function checkMode(stat2, options) {
|
|
937
|
+
var mod = stat2.mode, uid = stat2.uid, gid = stat2.gid, myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid(), myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid(), u = parseInt("100", 8), g = parseInt("010", 8), o = parseInt("001", 8), ug = u | g, ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
938
|
+
return ret;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
|
|
943
|
+
// ../../node_modules/isexe/index.js
|
|
944
|
+
var require_isexe = __commonJS({
|
|
945
|
+
"../../node_modules/isexe/index.js"(exports, module) {
|
|
946
|
+
var fs = __require("fs"), core;
|
|
947
|
+
process.platform === "win32" || global.TESTING_WINDOWS ? core = require_windows() : core = require_mode();
|
|
948
|
+
module.exports = isexe;
|
|
949
|
+
isexe.sync = sync;
|
|
950
|
+
function isexe(path, options, cb) {
|
|
951
|
+
if (typeof options == "function" && (cb = options, options = {}), !cb) {
|
|
952
|
+
if (typeof Promise != "function")
|
|
953
|
+
throw new TypeError("callback not provided");
|
|
954
|
+
return new Promise(function(resolve10, reject) {
|
|
955
|
+
isexe(path, options || {}, function(er, is) {
|
|
956
|
+
er ? reject(er) : resolve10(is);
|
|
957
|
+
});
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
core(path, options || {}, function(er, is) {
|
|
961
|
+
er && (er.code === "EACCES" || options && options.ignoreErrors) && (er = null, is = !1), cb(er, is);
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
function sync(path, options) {
|
|
965
|
+
try {
|
|
966
|
+
return core.sync(path, options || {});
|
|
967
|
+
} catch (er) {
|
|
968
|
+
if (options && options.ignoreErrors || er.code === "EACCES")
|
|
969
|
+
return !1;
|
|
970
|
+
throw er;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
// ../../node_modules/which/which.js
|
|
977
|
+
var require_which = __commonJS({
|
|
978
|
+
"../../node_modules/which/which.js"(exports, module) {
|
|
979
|
+
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", path = __require("path"), COLON = isWindows ? ";" : ":", isexe = require_isexe(), getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }), getPathInfo = (cmd, opt) => {
|
|
980
|
+
let colon = opt.colon || COLON, pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
|
|
981
|
+
// windows always checks the cwd first
|
|
982
|
+
...isWindows ? [process.cwd()] : [],
|
|
983
|
+
...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
984
|
+
"").split(colon)
|
|
985
|
+
], pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "", pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
986
|
+
return isWindows && cmd.indexOf(".") !== -1 && pathExt[0] !== "" && pathExt.unshift(""), {
|
|
987
|
+
pathEnv,
|
|
988
|
+
pathExt,
|
|
989
|
+
pathExtExe
|
|
990
|
+
};
|
|
991
|
+
}, which = (cmd, opt, cb) => {
|
|
992
|
+
typeof opt == "function" && (cb = opt, opt = {}), opt || (opt = {});
|
|
993
|
+
let { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt), found = [], step = (i) => new Promise((resolve10, reject) => {
|
|
994
|
+
if (i === pathEnv.length)
|
|
995
|
+
return opt.all && found.length ? resolve10(found) : reject(getNotFoundError(cmd));
|
|
996
|
+
let ppRaw = pathEnv[i], pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw, pCmd = path.join(pathPart, cmd), p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
997
|
+
resolve10(subStep(p, i, 0));
|
|
998
|
+
}), subStep = (p, i, ii) => new Promise((resolve10, reject) => {
|
|
999
|
+
if (ii === pathExt.length)
|
|
1000
|
+
return resolve10(step(i + 1));
|
|
1001
|
+
let ext = pathExt[ii];
|
|
1002
|
+
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
1003
|
+
if (!er && is)
|
|
1004
|
+
if (opt.all)
|
|
1005
|
+
found.push(p + ext);
|
|
1006
|
+
else
|
|
1007
|
+
return resolve10(p + ext);
|
|
1008
|
+
return resolve10(subStep(p, i, ii + 1));
|
|
1009
|
+
});
|
|
1010
|
+
});
|
|
1011
|
+
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
1012
|
+
}, whichSync = (cmd, opt) => {
|
|
1013
|
+
opt = opt || {};
|
|
1014
|
+
let { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt), found = [];
|
|
1015
|
+
for (let i = 0; i < pathEnv.length; i++) {
|
|
1016
|
+
let ppRaw = pathEnv[i], pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw, pCmd = path.join(pathPart, cmd), p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
1017
|
+
for (let j = 0; j < pathExt.length; j++) {
|
|
1018
|
+
let cur = p + pathExt[j];
|
|
1019
|
+
try {
|
|
1020
|
+
if (isexe.sync(cur, { pathExt: pathExtExe }))
|
|
1021
|
+
if (opt.all)
|
|
1022
|
+
found.push(cur);
|
|
1023
|
+
else
|
|
1024
|
+
return cur;
|
|
1025
|
+
} catch {
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
if (opt.all && found.length)
|
|
1030
|
+
return found;
|
|
1031
|
+
if (opt.nothrow)
|
|
1032
|
+
return null;
|
|
1033
|
+
throw getNotFoundError(cmd);
|
|
1034
|
+
};
|
|
1035
|
+
module.exports = which;
|
|
1036
|
+
which.sync = whichSync;
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
|
|
1040
|
+
// ../../node_modules/path-key/index.js
|
|
1041
|
+
var require_path_key = __commonJS({
|
|
1042
|
+
"../../node_modules/path-key/index.js"(exports, module) {
|
|
1043
|
+
"use strict";
|
|
1044
|
+
var pathKey = (options = {}) => {
|
|
1045
|
+
let environment = options.env || process.env;
|
|
1046
|
+
return (options.platform || process.platform) !== "win32" ? "PATH" : Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
1047
|
+
};
|
|
1048
|
+
module.exports = pathKey;
|
|
1049
|
+
module.exports.default = pathKey;
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
|
|
1053
|
+
// ../../node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
1054
|
+
var require_resolveCommand = __commonJS({
|
|
1055
|
+
"../../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
1056
|
+
"use strict";
|
|
1057
|
+
var path = __require("path"), which = require_which(), getPathKey = require_path_key();
|
|
1058
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
1059
|
+
let env = parsed.options.env || process.env, cwd = process.cwd(), hasCustomCwd = parsed.options.cwd != null, shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
1060
|
+
if (shouldSwitchCwd)
|
|
1061
|
+
try {
|
|
1062
|
+
process.chdir(parsed.options.cwd);
|
|
1063
|
+
} catch {
|
|
1064
|
+
}
|
|
1065
|
+
let resolved;
|
|
1066
|
+
try {
|
|
1067
|
+
resolved = which.sync(parsed.command, {
|
|
1068
|
+
path: env[getPathKey({ env })],
|
|
1069
|
+
pathExt: withoutPathExt ? path.delimiter : void 0
|
|
1070
|
+
});
|
|
1071
|
+
} catch {
|
|
1072
|
+
} finally {
|
|
1073
|
+
shouldSwitchCwd && process.chdir(cwd);
|
|
1074
|
+
}
|
|
1075
|
+
return resolved && (resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved)), resolved;
|
|
1076
|
+
}
|
|
1077
|
+
function resolveCommand(parsed) {
|
|
1078
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, !0);
|
|
1079
|
+
}
|
|
1080
|
+
module.exports = resolveCommand;
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
// ../../node_modules/cross-spawn/lib/util/escape.js
|
|
1085
|
+
var require_escape = __commonJS({
|
|
1086
|
+
"../../node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
|
|
1087
|
+
"use strict";
|
|
1088
|
+
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
1089
|
+
function escapeCommand(arg) {
|
|
1090
|
+
return arg = arg.replace(metaCharsRegExp, "^$1"), arg;
|
|
1091
|
+
}
|
|
1092
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
1093
|
+
return arg = `${arg}`, arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"'), arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1"), arg = `"${arg}"`, arg = arg.replace(metaCharsRegExp, "^$1"), doubleEscapeMetaChars && (arg = arg.replace(metaCharsRegExp, "^$1")), arg;
|
|
1094
|
+
}
|
|
1095
|
+
module.exports.command = escapeCommand;
|
|
1096
|
+
module.exports.argument = escapeArgument;
|
|
1097
|
+
}
|
|
1098
|
+
});
|
|
1099
|
+
|
|
1100
|
+
// ../../node_modules/shebang-regex/index.js
|
|
1101
|
+
var require_shebang_regex = __commonJS({
|
|
1102
|
+
"../../node_modules/shebang-regex/index.js"(exports, module) {
|
|
1103
|
+
"use strict";
|
|
1104
|
+
module.exports = /^#!(.*)/;
|
|
1105
|
+
}
|
|
1106
|
+
});
|
|
1107
|
+
|
|
1108
|
+
// ../../node_modules/shebang-command/index.js
|
|
1109
|
+
var require_shebang_command = __commonJS({
|
|
1110
|
+
"../../node_modules/shebang-command/index.js"(exports, module) {
|
|
1111
|
+
"use strict";
|
|
1112
|
+
var shebangRegex = require_shebang_regex();
|
|
1113
|
+
module.exports = (string = "") => {
|
|
1114
|
+
let match = string.match(shebangRegex);
|
|
1115
|
+
if (!match)
|
|
1116
|
+
return null;
|
|
1117
|
+
let [path, argument] = match[0].replace(/#! ?/, "").split(" "), binary = path.split("/").pop();
|
|
1118
|
+
return binary === "env" ? argument : argument ? `${binary} ${argument}` : binary;
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
});
|
|
1122
|
+
|
|
1123
|
+
// ../../node_modules/cross-spawn/lib/util/readShebang.js
|
|
1124
|
+
var require_readShebang = __commonJS({
|
|
1125
|
+
"../../node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
1126
|
+
"use strict";
|
|
1127
|
+
var fs = __require("fs"), shebangCommand = require_shebang_command();
|
|
1128
|
+
function readShebang(command) {
|
|
1129
|
+
let buffer = Buffer.alloc(150), fd;
|
|
1130
|
+
try {
|
|
1131
|
+
fd = fs.openSync(command, "r"), fs.readSync(fd, buffer, 0, 150, 0), fs.closeSync(fd);
|
|
1132
|
+
} catch {
|
|
1133
|
+
}
|
|
1134
|
+
return shebangCommand(buffer.toString());
|
|
1135
|
+
}
|
|
1136
|
+
module.exports = readShebang;
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
1139
|
+
|
|
1140
|
+
// ../../node_modules/cross-spawn/lib/parse.js
|
|
1141
|
+
var require_parse = __commonJS({
|
|
1142
|
+
"../../node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
1143
|
+
"use strict";
|
|
1144
|
+
var path = __require("path"), resolveCommand = require_resolveCommand(), escape = require_escape(), readShebang = require_readShebang(), isWin = process.platform === "win32", isExecutableRegExp = /\.(?:com|exe)$/i, isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
1145
|
+
function detectShebang(parsed) {
|
|
1146
|
+
parsed.file = resolveCommand(parsed);
|
|
1147
|
+
let shebang = parsed.file && readShebang(parsed.file);
|
|
1148
|
+
return shebang ? (parsed.args.unshift(parsed.file), parsed.command = shebang, resolveCommand(parsed)) : parsed.file;
|
|
1149
|
+
}
|
|
1150
|
+
function parseNonShell(parsed) {
|
|
1151
|
+
if (!isWin)
|
|
1152
|
+
return parsed;
|
|
1153
|
+
let commandFile = detectShebang(parsed), needsShell = !isExecutableRegExp.test(commandFile);
|
|
1154
|
+
if (parsed.options.forceShell || needsShell) {
|
|
1155
|
+
let needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
1156
|
+
parsed.command = path.normalize(parsed.command), parsed.command = escape.command(parsed.command), parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
1157
|
+
let shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
1158
|
+
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`], parsed.command = process.env.comspec || "cmd.exe", parsed.options.windowsVerbatimArguments = !0;
|
|
1159
|
+
}
|
|
1160
|
+
return parsed;
|
|
1161
|
+
}
|
|
1162
|
+
function parse5(command, args, options) {
|
|
1163
|
+
args && !Array.isArray(args) && (options = args, args = null), args = args ? args.slice(0) : [], options = Object.assign({}, options);
|
|
1164
|
+
let parsed = {
|
|
1165
|
+
command,
|
|
1166
|
+
args,
|
|
1167
|
+
options,
|
|
1168
|
+
file: void 0,
|
|
1169
|
+
original: {
|
|
1170
|
+
command,
|
|
1171
|
+
args
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
return options.shell ? parsed : parseNonShell(parsed);
|
|
1175
|
+
}
|
|
1176
|
+
module.exports = parse5;
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
// ../../node_modules/cross-spawn/lib/enoent.js
|
|
1181
|
+
var require_enoent = __commonJS({
|
|
1182
|
+
"../../node_modules/cross-spawn/lib/enoent.js"(exports, module) {
|
|
1183
|
+
"use strict";
|
|
1184
|
+
var isWin = process.platform === "win32";
|
|
1185
|
+
function notFoundError(original, syscall) {
|
|
1186
|
+
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
1187
|
+
code: "ENOENT",
|
|
1188
|
+
errno: "ENOENT",
|
|
1189
|
+
syscall: `${syscall} ${original.command}`,
|
|
1190
|
+
path: original.command,
|
|
1191
|
+
spawnargs: original.args
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
function hookChildProcess(cp3, parsed) {
|
|
1195
|
+
if (!isWin)
|
|
1196
|
+
return;
|
|
1197
|
+
let originalEmit = cp3.emit;
|
|
1198
|
+
cp3.emit = function(name, arg1) {
|
|
1199
|
+
if (name === "exit") {
|
|
1200
|
+
let err = verifyENOENT(arg1, parsed);
|
|
1201
|
+
if (err)
|
|
1202
|
+
return originalEmit.call(cp3, "error", err);
|
|
1203
|
+
}
|
|
1204
|
+
return originalEmit.apply(cp3, arguments);
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
function verifyENOENT(status, parsed) {
|
|
1208
|
+
return isWin && status === 1 && !parsed.file ? notFoundError(parsed.original, "spawn") : null;
|
|
1209
|
+
}
|
|
1210
|
+
function verifyENOENTSync(status, parsed) {
|
|
1211
|
+
return isWin && status === 1 && !parsed.file ? notFoundError(parsed.original, "spawnSync") : null;
|
|
1212
|
+
}
|
|
1213
|
+
module.exports = {
|
|
1214
|
+
hookChildProcess,
|
|
1215
|
+
verifyENOENT,
|
|
1216
|
+
verifyENOENTSync,
|
|
1217
|
+
notFoundError
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1221
|
+
|
|
1222
|
+
// ../../node_modules/cross-spawn/index.js
|
|
1223
|
+
var require_cross_spawn = __commonJS({
|
|
1224
|
+
"../../node_modules/cross-spawn/index.js"(exports, module) {
|
|
1225
|
+
"use strict";
|
|
1226
|
+
var cp3 = __require("child_process"), parse5 = require_parse(), enoent = require_enoent();
|
|
1227
|
+
function spawn2(command, args, options) {
|
|
1228
|
+
let parsed = parse5(command, args, options), spawned = cp3.spawn(parsed.command, parsed.args, parsed.options);
|
|
1229
|
+
return enoent.hookChildProcess(spawned, parsed), spawned;
|
|
1230
|
+
}
|
|
1231
|
+
function spawnSync(command, args, options) {
|
|
1232
|
+
let parsed = parse5(command, args, options), result = cp3.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
1233
|
+
return result.error = result.error || enoent.verifyENOENTSync(result.status, parsed), result;
|
|
1234
|
+
}
|
|
1235
|
+
module.exports = spawn2;
|
|
1236
|
+
module.exports.spawn = spawn2;
|
|
1237
|
+
module.exports.sync = spawnSync;
|
|
1238
|
+
module.exports._parse = parse5;
|
|
1239
|
+
module.exports._enoent = enoent;
|
|
1240
|
+
}
|
|
1241
|
+
});
|
|
1242
|
+
|
|
884
1243
|
// ../../node_modules/address/lib/address.js
|
|
885
1244
|
var require_address = __commonJS({
|
|
886
1245
|
"../../node_modules/address/lib/address.js"(exports, module) {
|
|
@@ -999,9 +1358,9 @@ var require_detect_port = __commonJS({
|
|
|
999
1358
|
let hostname = "";
|
|
1000
1359
|
typeof port == "object" && port ? (hostname = port.hostname, callback = port.callback, port = port.port) : typeof port == "function" && (callback = port, port = null), port = parseInt(port) || 0;
|
|
1001
1360
|
let maxPort = port + 10;
|
|
1002
|
-
return maxPort > 65535 && (maxPort = 65535), debug("detect free port between [%s, %s)", port, maxPort), typeof callback == "function" ? tryListen(port, maxPort, hostname, callback) : new Promise((
|
|
1361
|
+
return maxPort > 65535 && (maxPort = 65535), debug("detect free port between [%s, %s)", port, maxPort), typeof callback == "function" ? tryListen(port, maxPort, hostname, callback) : new Promise((resolve10) => {
|
|
1003
1362
|
tryListen(port, maxPort, hostname, (_, realPort) => {
|
|
1004
|
-
|
|
1363
|
+
resolve10(realPort);
|
|
1005
1364
|
});
|
|
1006
1365
|
});
|
|
1007
1366
|
};
|
|
@@ -1044,7 +1403,7 @@ var require_detect_port = __commonJS({
|
|
|
1044
1403
|
var require_wait_port = __commonJS({
|
|
1045
1404
|
"../../node_modules/detect-port/lib/wait-port.js"(exports, module) {
|
|
1046
1405
|
"use strict";
|
|
1047
|
-
var debug = require_src()("wait-port"), detect = require_detect_port(), sleep = (ms) => new Promise((
|
|
1406
|
+
var debug = require_src()("wait-port"), detect = require_detect_port(), sleep = (ms) => new Promise((resolve10) => setTimeout(resolve10, ms));
|
|
1048
1407
|
async function waitPort(port, options = {}) {
|
|
1049
1408
|
let { retryInterval = 1e3, retries = 1 / 0 } = options, count = 1;
|
|
1050
1409
|
async function loop() {
|
|
@@ -1076,8 +1435,7 @@ import {
|
|
|
1076
1435
|
} from "@aussieljk/forkbook/internal/common";
|
|
1077
1436
|
|
|
1078
1437
|
// src/core-server/build-static.ts
|
|
1079
|
-
|
|
1080
|
-
import { cp as cp2, mkdir } from "node:fs/promises";
|
|
1438
|
+
import { cp as cp2, mkdir as mkdir3 } from "node:fs/promises";
|
|
1081
1439
|
import { rm } from "node:fs/promises";
|
|
1082
1440
|
import { Channel as Channel2 } from "@aussieljk/forkbook/internal/channels";
|
|
1083
1441
|
import {
|
|
@@ -1087,9 +1445,14 @@ import {
|
|
|
1087
1445
|
resolveAddonName
|
|
1088
1446
|
} from "@aussieljk/forkbook/internal/common";
|
|
1089
1447
|
import { logger as logger4 } from "@aussieljk/forkbook/internal/node-logger";
|
|
1090
|
-
import {
|
|
1091
|
-
|
|
1092
|
-
|
|
1448
|
+
import { telemetry as telemetry2 } from "@aussieljk/forkbook/internal/telemetry";
|
|
1449
|
+
|
|
1450
|
+
// src/shared/global.ts
|
|
1451
|
+
var global2 = globalThis;
|
|
1452
|
+
|
|
1453
|
+
// src/core-server/build-static.ts
|
|
1454
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
1455
|
+
import { join as join6, relative as relative4, resolve as resolve4 } from "pathe";
|
|
1093
1456
|
|
|
1094
1457
|
// src/core-server/utils/build-or-throw.ts
|
|
1095
1458
|
import { NoMatchingExportError } from "@aussieljk/forkbook/internal/server-errors";
|
|
@@ -1100,7 +1463,7 @@ async function buildOrThrow(callback) {
|
|
|
1100
1463
|
let builderErrors = err.errors;
|
|
1101
1464
|
throw builderErrors && builderErrors.find(
|
|
1102
1465
|
(er) => er.text?.includes("No matching export")
|
|
1103
|
-
) ? new NoMatchingExportError(err) : err;
|
|
1466
|
+
) ? new NoMatchingExportError({ error: err }) : err;
|
|
1104
1467
|
}
|
|
1105
1468
|
}
|
|
1106
1469
|
|
|
@@ -1184,8 +1547,11 @@ function watchStorySpecifiers(specifiers, options, onInvalidate) {
|
|
|
1184
1547
|
// files can be e.g. '**/foo/*/*.js' so we just want the last bit,
|
|
1185
1548
|
// because the directory could already be within the files part (e.g. './x/foo/bar')
|
|
1186
1549
|
basename(specifier.files)
|
|
1187
|
-
), {
|
|
1188
|
-
(await
|
|
1550
|
+
), { glob: glob2 } = await import("../_node-chunks/dist-Q2XNFC24.js");
|
|
1551
|
+
(await glob2(slash(dirGlob), {
|
|
1552
|
+
...commonGlobOptions(dirGlob),
|
|
1553
|
+
expandDirectories: !1
|
|
1554
|
+
})).forEach((filePath) => {
|
|
1189
1555
|
let fileImportPath = toImportPath(filePath);
|
|
1190
1556
|
specifier.importPathMatcher.exec(fileImportPath) && onInvalidate(fileImportPath, removed);
|
|
1191
1557
|
});
|
|
@@ -1237,7 +1603,7 @@ function registerIndexJsonRoute({
|
|
|
1237
1603
|
basename2(filePath).startsWith("preview") && ((await storyIndexGeneratorPromise).invalidateAll(), maybeInvalidate());
|
|
1238
1604
|
}), app.use("/index.json", async (_req, res) => {
|
|
1239
1605
|
try {
|
|
1240
|
-
let index = await (await storyIndexGeneratorPromise).
|
|
1606
|
+
let index = await (await storyIndexGeneratorPromise).getIndexWithFileErrors();
|
|
1241
1607
|
res.setHeader("Content-Type", "application/json"), res.setHeader("Access-Control-Allow-Origin", "*"), res.setHeader(
|
|
1242
1608
|
"Access-Control-Allow-Headers",
|
|
1243
1609
|
"Origin, X-Requested-With, Content-Type, Accept"
|
|
@@ -1248,24 +1614,102 @@ function registerIndexJsonRoute({
|
|
|
1248
1614
|
});
|
|
1249
1615
|
}
|
|
1250
1616
|
|
|
1251
|
-
// src/core-server/utils/
|
|
1252
|
-
import {
|
|
1253
|
-
import {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1617
|
+
// src/core-server/utils/thumbnails.ts
|
|
1618
|
+
import { copyFile, mkdir, readFile } from "node:fs/promises";
|
|
1619
|
+
import { dirname as dirname2, join as join3 } from "pathe";
|
|
1620
|
+
|
|
1621
|
+
// src/shared/thumbnails.ts
|
|
1622
|
+
import { dirname, isAbsolute, normalize, relative as relative3, resolve as resolve3 } from "pathe";
|
|
1623
|
+
var THUMBNAIL_ROUTE = "thumbnails", THUMBNAIL_TYPES = {
|
|
1624
|
+
avif: "image/avif",
|
|
1625
|
+
gif: "image/gif",
|
|
1626
|
+
jpeg: "image/jpeg",
|
|
1627
|
+
jpg: "image/jpeg",
|
|
1628
|
+
png: "image/png",
|
|
1629
|
+
svg: "image/svg+xml",
|
|
1630
|
+
webp: "image/webp"
|
|
1631
|
+
}, extension = (path) => path.split(".").pop()?.toLowerCase() ?? "", isThumbnailUrl = (value) => /^([a-z][a-z\d+.-]*:|\/\/|\/)/i.test(value), resolveThumbnail = (value, storyFile, workingDir) => {
|
|
1632
|
+
if (!value)
|
|
1633
|
+
return;
|
|
1634
|
+
if (isThumbnailUrl(value) && !isAbsolute(value))
|
|
1635
|
+
return value;
|
|
1636
|
+
let file = isAbsolute(value) ? value : resolve3(dirname(storyFile), value);
|
|
1637
|
+
if (isAbsolute(value) && !normalize(value).startsWith(normalize(workingDir)))
|
|
1638
|
+
return value;
|
|
1639
|
+
let path = relative3(workingDir, file);
|
|
1640
|
+
if (!(path.startsWith("..") || !THUMBNAIL_TYPES[extension(path)]))
|
|
1641
|
+
return `${THUMBNAIL_ROUTE}/${path}`;
|
|
1642
|
+
}, thumbnailFile = (urlPath, workingDir) => {
|
|
1643
|
+
let path = urlPath.replace(/^\/+/, "");
|
|
1644
|
+
try {
|
|
1645
|
+
path = decodeURIComponent(path);
|
|
1646
|
+
} catch {
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
if (!path.startsWith(`${THUMBNAIL_ROUTE}/`))
|
|
1650
|
+
return;
|
|
1651
|
+
let file = resolve3(workingDir, path.slice(THUMBNAIL_ROUTE.length + 1));
|
|
1652
|
+
if (!(relative3(workingDir, file).startsWith("..") || !THUMBNAIL_TYPES[extension(file)]))
|
|
1653
|
+
return file;
|
|
1654
|
+
}, thumbnailContentType = (file) => THUMBNAIL_TYPES[extension(file)] ?? "application/octet-stream";
|
|
1655
|
+
|
|
1656
|
+
// src/core-server/utils/thumbnails.ts
|
|
1657
|
+
function registerThumbnailRoute(app, workingDir) {
|
|
1658
|
+
app.use(`/${THUMBNAIL_ROUTE}`, async (req, res) => {
|
|
1659
|
+
let url = (req.originalUrl ?? req.url ?? "").split("?")[0], file = thumbnailFile(url, workingDir);
|
|
1660
|
+
try {
|
|
1661
|
+
if (!file)
|
|
1662
|
+
throw new Error("Not a thumbnail");
|
|
1663
|
+
let body = await readFile(file);
|
|
1664
|
+
res.setHeader("Content-Type", thumbnailContentType(file)), res.end(body);
|
|
1665
|
+
} catch {
|
|
1666
|
+
res.statusCode = 404, res.end("Not found");
|
|
1667
|
+
}
|
|
1262
1668
|
});
|
|
1263
1669
|
}
|
|
1670
|
+
async function copyThumbnails(outputDir, index, workingDir) {
|
|
1671
|
+
let paths = new Set(
|
|
1672
|
+
Object.values(index.entries).map((entry) => entry.thumbnail).filter((path) => !!path && path.startsWith(`${THUMBNAIL_ROUTE}/`))
|
|
1673
|
+
), count = 0;
|
|
1674
|
+
return await Promise.all(
|
|
1675
|
+
[...paths].map(async (path) => {
|
|
1676
|
+
let file = thumbnailFile(path, workingDir);
|
|
1677
|
+
if (!file)
|
|
1678
|
+
return;
|
|
1679
|
+
let target = join3(outputDir, path);
|
|
1680
|
+
await mkdir(dirname2(target), { recursive: !0 }), await copyFile(file, target).then(
|
|
1681
|
+
() => count++,
|
|
1682
|
+
() => {
|
|
1683
|
+
}
|
|
1684
|
+
);
|
|
1685
|
+
})
|
|
1686
|
+
), count;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
// src/core-server/utils/write-route-pages.ts
|
|
1690
|
+
import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
|
|
1691
|
+
import { join as join4 } from "pathe";
|
|
1692
|
+
var STATIC_APP_ROUTES = [
|
|
1693
|
+
"/all",
|
|
1694
|
+
"/review",
|
|
1695
|
+
"/settings/about",
|
|
1696
|
+
"/settings/shortcuts",
|
|
1697
|
+
"/settings/whats-new"
|
|
1698
|
+
];
|
|
1699
|
+
async function writeRoutePages(outputDir, index) {
|
|
1700
|
+
let html = await readFile2(join4(outputDir, "index.html"), "utf8"), urlPaths = [...buildStoryPathMap(Object.values(index.entries)).byUrl.keys()], allPaths = [...STATIC_APP_ROUTES, ...urlPaths];
|
|
1701
|
+
return await Promise.all(
|
|
1702
|
+
allPaths.map(async (urlPath) => {
|
|
1703
|
+
let dir = join4(outputDir, urlPath);
|
|
1704
|
+
await mkdir2(dir, { recursive: !0 }), await writeFile2(join4(dir, "index.html"), withRouteDepth(html, urlPathDepth(urlPath)));
|
|
1705
|
+
})
|
|
1706
|
+
), allPaths.length;
|
|
1707
|
+
}
|
|
1264
1708
|
|
|
1265
1709
|
// src/core-server/utils/output-stats.ts
|
|
1266
1710
|
var import_json_ext = __toESM(require_src2(), 1), import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
1267
1711
|
import { createWriteStream } from "node:fs";
|
|
1268
|
-
import { join as
|
|
1712
|
+
import { join as join5 } from "node:path";
|
|
1269
1713
|
import { logger as logger3 } from "@aussieljk/forkbook/internal/node-logger";
|
|
1270
1714
|
async function outputStats(directory, previewStats, managerStats) {
|
|
1271
1715
|
if (previewStats) {
|
|
@@ -1278,9 +1722,9 @@ async function outputStats(directory, previewStats, managerStats) {
|
|
|
1278
1722
|
}
|
|
1279
1723
|
}
|
|
1280
1724
|
var writeStats = async (directory, name, stats) => {
|
|
1281
|
-
let filePath =
|
|
1282
|
-
return await new Promise((
|
|
1283
|
-
(0, import_json_ext.stringifyStream)(data, null, 2).on("error", reject).pipe(createWriteStream(filePath)).on("error", reject).on("finish",
|
|
1725
|
+
let filePath = join5(directory, `${name}-stats.json`), { chunks, ...data } = stats.toJson();
|
|
1726
|
+
return await new Promise((resolve10, reject) => {
|
|
1727
|
+
(0, import_json_ext.stringifyStream)(data, null, 2).on("error", reject).pipe(createWriteStream(filePath)).on("error", reject).on("finish", resolve10);
|
|
1284
1728
|
}), filePath;
|
|
1285
1729
|
};
|
|
1286
1730
|
|
|
@@ -1332,16 +1776,40 @@ function summarizeIndex(storyIndex) {
|
|
|
1332
1776
|
}
|
|
1333
1777
|
|
|
1334
1778
|
// src/core-server/build-static.ts
|
|
1779
|
+
var DEFAULT_STATIC_OUTPUT_DIR = "./forkbook-static";
|
|
1780
|
+
function resolveStaticOutputDir({
|
|
1781
|
+
outputDir,
|
|
1782
|
+
buildToPublic,
|
|
1783
|
+
basePath
|
|
1784
|
+
}) {
|
|
1785
|
+
if (outputDir)
|
|
1786
|
+
return outputDir;
|
|
1787
|
+
if (buildToPublic) {
|
|
1788
|
+
if (!basePath)
|
|
1789
|
+
throw new Error('buildToPublic needs a base path other than "/".');
|
|
1790
|
+
return join6("public", basePath);
|
|
1791
|
+
}
|
|
1792
|
+
return DEFAULT_STATIC_OUTPUT_DIR;
|
|
1793
|
+
}
|
|
1335
1794
|
async function buildStaticStandalone(options) {
|
|
1336
|
-
|
|
1795
|
+
options.configType = "PRODUCTION", options.configDir = resolve4(options.configDir);
|
|
1796
|
+
let config = await loadMainConfig(options), mainCore = typeof config.core == "object" ? config.core : void 0;
|
|
1797
|
+
options.basePath = resolveBasePath(options.basePath, mainCore?.basePath), options.buildToPublic = options.buildToPublic ?? mainCore?.buildToPublic ?? !1;
|
|
1798
|
+
let outputDir = resolveStaticOutputDir({
|
|
1799
|
+
outputDir: options.outputDir,
|
|
1800
|
+
buildToPublic: options.buildToPublic,
|
|
1801
|
+
basePath: options.basePath
|
|
1802
|
+
});
|
|
1803
|
+
if (outputDir === "")
|
|
1337
1804
|
throw new Error("Won't remove current directory. Check your outputDir!");
|
|
1338
|
-
|
|
1805
|
+
let outputDirPath = resolve4(outputDir);
|
|
1806
|
+
if (options.outputDir = outputDirPath, logger4.step(`Cleaning outputDir: ${import_picocolors3.default.cyan(relative4(process.cwd(), outputDirPath))}`), outputDirPath === "/")
|
|
1339
1807
|
throw new Error("Won't remove directory '/'. Check your outputDir!");
|
|
1340
|
-
await rm(
|
|
1341
|
-
}), await
|
|
1342
|
-
let
|
|
1343
|
-
frameworkName ? corePresets.push(
|
|
1344
|
-
let commonPreset =
|
|
1808
|
+
await rm(outputDirPath, { recursive: !0, force: !0 }).catch(() => {
|
|
1809
|
+
}), await mkdir3(outputDirPath, { recursive: !0 });
|
|
1810
|
+
let { framework } = config, corePresets = [], frameworkName = typeof framework == "string" ? framework : framework?.name;
|
|
1811
|
+
frameworkName ? corePresets.push(join6(frameworkName, "preset")) : logger4.warn(`you have not specified a framework in your ${options.configDir}/main.js`);
|
|
1812
|
+
let commonPreset = join6(
|
|
1345
1813
|
resolvePackageDir("@aussieljk/forkbook"),
|
|
1346
1814
|
"dist/core-server/presets/common-preset.js"
|
|
1347
1815
|
), commonOverridePreset = import.meta.resolve("@aussieljk/forkbook/internal/core-server/presets/common-override-preset");
|
|
@@ -1376,7 +1844,7 @@ async function buildStaticStandalone(options) {
|
|
|
1376
1844
|
presets.apply("core"),
|
|
1377
1845
|
presets.apply("staticDirs")
|
|
1378
1846
|
]), invokedBy = process.env.FORKBOOK_INVOKED_BY;
|
|
1379
|
-
invokedBy && telemetry2("test-run", { runner: invokedBy, watch: !1 }
|
|
1847
|
+
invokedBy && telemetry2("test-run", { runner: invokedBy, watch: !1 });
|
|
1380
1848
|
let fullOptions = {
|
|
1381
1849
|
...options,
|
|
1382
1850
|
channel,
|
|
@@ -1386,20 +1854,21 @@ async function buildStaticStandalone(options) {
|
|
|
1386
1854
|
}, effects = [];
|
|
1387
1855
|
global2.FEATURES = features, await applyServicesPresetOnce(presets), options.previewOnly || await buildOrThrow(
|
|
1388
1856
|
async () => managerBuilder.build({ startTime: process.hrtime(), options: fullOptions })
|
|
1389
|
-
), staticDirs && effects.push(
|
|
1390
|
-
|
|
1391
|
-
);
|
|
1392
|
-
let coreServerPublicDir = join4(resolvePackageDir("@aussieljk/forkbook"), "assets/browser");
|
|
1393
|
-
effects.push(cp2(coreServerPublicDir, options.outputDir, { recursive: !0, force: !0 }));
|
|
1857
|
+
), staticDirs && effects.push(copyAllStaticFilesRelativeToMain(staticDirs, outputDirPath, options.configDir));
|
|
1858
|
+
let coreServerPublicDir = join6(resolvePackageDir("@aussieljk/forkbook"), "assets/browser");
|
|
1859
|
+
effects.push(cp2(coreServerPublicDir, outputDirPath, { recursive: !0, force: !0 }));
|
|
1394
1860
|
let hasRegisteredServices = getRegisteredServices().length > 0, shouldWriteManifests = features?.componentsManifest;
|
|
1395
1861
|
(hasRegisteredServices || shouldWriteManifests) && effects.push(
|
|
1396
1862
|
(async () => {
|
|
1397
|
-
hasRegisteredServices && (logger4.info("Building open services.."), await writeOpenServiceStaticFiles(
|
|
1863
|
+
hasRegisteredServices && (logger4.info("Building open services.."), await writeOpenServiceStaticFiles(outputDirPath)), shouldWriteManifests && await writeManifests(outputDirPath, presets);
|
|
1398
1864
|
})()
|
|
1399
1865
|
);
|
|
1400
1866
|
let storyIndexGeneratorPromise = presets.apply("storyIndexGenerator");
|
|
1401
|
-
effects.push(writeIndexJson(
|
|
1402
|
-
|
|
1867
|
+
effects.push(writeIndexJson(join6(outputDirPath, "index.json"), storyIndexGeneratorPromise)), options.previewOnly || effects.push(
|
|
1868
|
+
(async () => {
|
|
1869
|
+
let index = await (await storyIndexGeneratorPromise)?.getIndex();
|
|
1870
|
+
index && (await writeRoutePages(outputDirPath, index), await copyThumbnails(outputDirPath, index, process.cwd()));
|
|
1871
|
+
})()
|
|
1403
1872
|
), options.debugWebpack && logConfig("Preview webpack config", await previewBuilder.getConfig(fullOptions)), logger4.info("Building preview..");
|
|
1404
1873
|
let startTime = process.hrtime();
|
|
1405
1874
|
if (await Promise.all([
|
|
@@ -1409,30 +1878,23 @@ async function buildStaticStandalone(options) {
|
|
|
1409
1878
|
}).then(async (previewStats) => {
|
|
1410
1879
|
logger4.trace({ message: "Preview built", time: process.hrtime(startTime) });
|
|
1411
1880
|
let statsOption = options.statsJson;
|
|
1412
|
-
|
|
1413
|
-
let target = statsOption === !0 ? options.outputDir : statsOption;
|
|
1414
|
-
await outputStats(target, previewStats);
|
|
1415
|
-
}
|
|
1881
|
+
statsOption && await outputStats(statsOption === !0 ? outputDirPath : statsOption, previewStats || void 0);
|
|
1416
1882
|
}).catch((error) => {
|
|
1417
1883
|
throw logger4.error("Failed to build the preview"), process.exitCode = 1, error;
|
|
1418
1884
|
}),
|
|
1419
1885
|
...effects
|
|
1420
1886
|
]), !options.test)
|
|
1421
1887
|
try {
|
|
1422
|
-
let storyIndex = await (await storyIndexGeneratorPromise)?.getIndex()
|
|
1423
|
-
|
|
1424
|
-
};
|
|
1425
|
-
storyIndex && Object.assign(payload, {
|
|
1426
|
-
storyIndex: summarizeIndex(storyIndex)
|
|
1427
|
-
}), await telemetry2("build", payload, { configDir: options.configDir });
|
|
1888
|
+
let storyIndex = await (await storyIndexGeneratorPromise)?.getIndex();
|
|
1889
|
+
await telemetry2("build", storyIndex ? { storyIndex: summarizeIndex(storyIndex) } : {});
|
|
1428
1890
|
} catch (e) {
|
|
1429
1891
|
logger4.debug?.(`Build telemetry failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
1430
1892
|
}
|
|
1431
|
-
logger4.step(`Output directory: ${
|
|
1893
|
+
logger4.step(`Output directory: ${outputDirPath}`);
|
|
1432
1894
|
}
|
|
1433
1895
|
|
|
1434
1896
|
// src/core-server/build-dev.ts
|
|
1435
|
-
import { readFile as
|
|
1897
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
1436
1898
|
import {
|
|
1437
1899
|
JsPackageManagerFactory,
|
|
1438
1900
|
getInterpretedFile,
|
|
@@ -1452,8 +1914,7 @@ import {
|
|
|
1452
1914
|
NoStatsForViteDevError
|
|
1453
1915
|
} from "@aussieljk/forkbook/internal/server-errors";
|
|
1454
1916
|
import { oneWayHash, telemetry as telemetry4 } from "@aussieljk/forkbook/internal/telemetry";
|
|
1455
|
-
import {
|
|
1456
|
-
import { join as join8, relative as relative4, resolve as resolve6 } from "pathe";
|
|
1917
|
+
import { join as join10, relative as relative5, resolve as resolve7 } from "pathe";
|
|
1457
1918
|
import { dedent as dedent5 } from "ts-dedent";
|
|
1458
1919
|
|
|
1459
1920
|
// src/channels/postmessage/index.ts
|
|
@@ -1525,7 +1986,7 @@ function build_default({ threshold = 1024, level = -1, brotli = !1, gzip = !0, m
|
|
|
1525
1986
|
|
|
1526
1987
|
// ../../node_modules/polka/build.mjs
|
|
1527
1988
|
import http from "node:http";
|
|
1528
|
-
import { setImmediate } from "node:timers";
|
|
1989
|
+
import { setImmediate as setImmediate2 } from "node:timers";
|
|
1529
1990
|
|
|
1530
1991
|
// ../../node_modules/regexparam/dist/index.mjs
|
|
1531
1992
|
function parse3(input, loose) {
|
|
@@ -1588,7 +2049,7 @@ function onError(err, req, res) {
|
|
|
1588
2049
|
}
|
|
1589
2050
|
var mount = (fn) => fn instanceof Polka ? fn.attach : fn, Polka = class _Polka extends Trouter {
|
|
1590
2051
|
constructor(opts = {}) {
|
|
1591
|
-
super(), this.parse = parse, this.server = opts.server, this.handler = this.handler.bind(this), this.onError = opts.onError || onError, this.onNoMatch = opts.onNoMatch || this.onError.bind(null, { status: 404 }), this.attach = (req, res) =>
|
|
2052
|
+
super(), this.parse = parse, this.server = opts.server, this.handler = this.handler.bind(this), this.onError = opts.onError || onError, this.onNoMatch = opts.onNoMatch || this.onError.bind(null, { status: 404 }), this.attach = (req, res) => setImmediate2(this.handler, req, res);
|
|
1592
2053
|
}
|
|
1593
2054
|
use(base, ...fns) {
|
|
1594
2055
|
return base === "/" ? super.use(base, fns.map(mount)) : typeof base == "function" || base instanceof _Polka ? super.use("/", [base, ...fns].map(mount)) : super.use(
|
|
@@ -1627,63 +2088,7 @@ function build_default2(opts) {
|
|
|
1627
2088
|
}
|
|
1628
2089
|
|
|
1629
2090
|
// src/core-server/change-detection/change-detection-service.ts
|
|
1630
|
-
import { join as
|
|
1631
|
-
|
|
1632
|
-
// ../../node_modules/dequal/dist/index.mjs
|
|
1633
|
-
var has = Object.prototype.hasOwnProperty;
|
|
1634
|
-
function find(iter, tar, key) {
|
|
1635
|
-
for (key of iter.keys())
|
|
1636
|
-
if (dequal(key, tar)) return key;
|
|
1637
|
-
}
|
|
1638
|
-
function dequal(foo, bar) {
|
|
1639
|
-
var ctor, len, tmp;
|
|
1640
|
-
if (foo === bar) return !0;
|
|
1641
|
-
if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
|
|
1642
|
-
if (ctor === Date) return foo.getTime() === bar.getTime();
|
|
1643
|
-
if (ctor === RegExp) return foo.toString() === bar.toString();
|
|
1644
|
-
if (ctor === Array) {
|
|
1645
|
-
if ((len = foo.length) === bar.length)
|
|
1646
|
-
for (; len-- && dequal(foo[len], bar[len]); ) ;
|
|
1647
|
-
return len === -1;
|
|
1648
|
-
}
|
|
1649
|
-
if (ctor === Set) {
|
|
1650
|
-
if (foo.size !== bar.size)
|
|
1651
|
-
return !1;
|
|
1652
|
-
for (len of foo)
|
|
1653
|
-
if (tmp = len, tmp && typeof tmp == "object" && (tmp = find(bar, tmp), !tmp) || !bar.has(tmp)) return !1;
|
|
1654
|
-
return !0;
|
|
1655
|
-
}
|
|
1656
|
-
if (ctor === Map) {
|
|
1657
|
-
if (foo.size !== bar.size)
|
|
1658
|
-
return !1;
|
|
1659
|
-
for (len of foo)
|
|
1660
|
-
if (tmp = len[0], tmp && typeof tmp == "object" && (tmp = find(bar, tmp), !tmp) || !dequal(len[1], bar.get(tmp)))
|
|
1661
|
-
return !1;
|
|
1662
|
-
return !0;
|
|
1663
|
-
}
|
|
1664
|
-
if (ctor === ArrayBuffer)
|
|
1665
|
-
foo = new Uint8Array(foo), bar = new Uint8Array(bar);
|
|
1666
|
-
else if (ctor === DataView) {
|
|
1667
|
-
if ((len = foo.byteLength) === bar.byteLength)
|
|
1668
|
-
for (; len-- && foo.getInt8(len) === bar.getInt8(len); ) ;
|
|
1669
|
-
return len === -1;
|
|
1670
|
-
}
|
|
1671
|
-
if (ArrayBuffer.isView(foo)) {
|
|
1672
|
-
if ((len = foo.byteLength) === bar.byteLength)
|
|
1673
|
-
for (; len-- && foo[len] === bar[len]; ) ;
|
|
1674
|
-
return len === -1;
|
|
1675
|
-
}
|
|
1676
|
-
if (!ctor || typeof foo == "object") {
|
|
1677
|
-
len = 0;
|
|
1678
|
-
for (ctor in foo)
|
|
1679
|
-
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor) || !(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return !1;
|
|
1680
|
-
return Object.keys(bar).length === len;
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
return foo !== foo && bar !== bar;
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
// src/core-server/change-detection/change-detection-service.ts
|
|
2091
|
+
import { join as join7, normalize as normalize2 } from "pathe";
|
|
1687
2092
|
import { logger as logger7 } from "@aussieljk/forkbook/internal/node-logger";
|
|
1688
2093
|
import { CHANGE_DETECTION_STATUS_TYPE_ID } from "@aussieljk/forkbook/internal/types";
|
|
1689
2094
|
|
|
@@ -1755,7 +2160,7 @@ function errorLikeToError(errorLike) {
|
|
|
1755
2160
|
return error.name = errorLike.name ?? error.name, errorLike.stack && (error.stack = errorLike.stack), error;
|
|
1756
2161
|
}
|
|
1757
2162
|
function isSameStatus(a, b) {
|
|
1758
|
-
return a ? a.storyId === b.storyId && a.typeId === b.typeId && a.value === b.value && a.title === b.title && a.description === b.description && a.sidebarContextMenu === b.sidebarContextMenu &&
|
|
2163
|
+
return a ? a.storyId === b.storyId && a.typeId === b.typeId && a.value === b.value && a.title === b.title && a.description === b.description && a.sidebarContextMenu === b.sidebarContextMenu && isEqual(a.data, b.data) : !1;
|
|
1759
2164
|
}
|
|
1760
2165
|
function mergeStatusValues(previousValue, nextValue) {
|
|
1761
2166
|
return previousValue === "status-value:new" || nextValue === "status-value:new" ? "status-value:new" : previousValue === "status-value:modified" || nextValue === "status-value:modified" ? "status-value:modified" : previousValue === "status-value:affected" || nextValue === "status-value:affected" ? "status-value:affected" : nextValue;
|
|
@@ -1917,9 +2322,9 @@ var ChangeDetectionService = class {
|
|
|
1917
2322
|
this.options.storyIndexGeneratorPromise,
|
|
1918
2323
|
this.getIndexBaselineService().getBaselineEntryIds()
|
|
1919
2324
|
]), changedFiles = new Set(
|
|
1920
|
-
Array.from(changes.changed).map((path) =>
|
|
2325
|
+
Array.from(changes.changed).map((path) => normalize2(join7(repoRoot, path)))
|
|
1921
2326
|
), newFiles = new Set(
|
|
1922
|
-
Array.from(changes.new).map((path) =>
|
|
2327
|
+
Array.from(changes.new).map((path) => normalize2(join7(repoRoot, path)))
|
|
1923
2328
|
), scannedFiles = /* @__PURE__ */ new Set([...changedFiles, ...newFiles]), storyIndex = await storyIndexGenerator.getIndex(), baselineStatuses = buildIndexBaselineStatuses(storyIndex, baselineEntryIds), storyIdsByFile = getStoryIdsByAbsolutePath(storyIndex, this.workingDir), statuses = /* @__PURE__ */ new Map(), scannedFilesArray = [...scannedFiles], lookupResults = await this.getModuleGraphIndex().queries.storiesForFiles.loaded({
|
|
1924
2329
|
files: scannedFilesArray
|
|
1925
2330
|
});
|
|
@@ -1977,8 +2382,114 @@ var ChangeDetectionService = class {
|
|
|
1977
2382
|
}
|
|
1978
2383
|
};
|
|
1979
2384
|
|
|
2385
|
+
// src/shared/test-provider-store/index.ts
|
|
2386
|
+
var UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS = {
|
|
2387
|
+
id: "@aussieljk/forkbook/test-provider",
|
|
2388
|
+
leader: !0,
|
|
2389
|
+
initialState: {}
|
|
2390
|
+
};
|
|
2391
|
+
function createTestProviderStore({
|
|
2392
|
+
universalTestProviderStore: universalTestProviderStore2,
|
|
2393
|
+
useUniversalStore
|
|
2394
|
+
}) {
|
|
2395
|
+
let baseStore = {
|
|
2396
|
+
settingsChanged: () => {
|
|
2397
|
+
universalTestProviderStore2.untilReady().then(() => {
|
|
2398
|
+
universalTestProviderStore2.send({ type: "settings-changed" });
|
|
2399
|
+
});
|
|
2400
|
+
},
|
|
2401
|
+
onRunAll: (listener) => universalTestProviderStore2.subscribe("run-all", listener),
|
|
2402
|
+
onClearAll: (listener) => universalTestProviderStore2.subscribe("clear-all", listener)
|
|
2403
|
+
}, fullTestProviderStore2 = {
|
|
2404
|
+
...baseStore,
|
|
2405
|
+
getFullState: universalTestProviderStore2.getState,
|
|
2406
|
+
setFullState: universalTestProviderStore2.setState,
|
|
2407
|
+
onSettingsChanged: (listener) => universalTestProviderStore2.subscribe("settings-changed", listener),
|
|
2408
|
+
runAll: async () => {
|
|
2409
|
+
await universalTestProviderStore2.untilReady(), universalTestProviderStore2.send({ type: "run-all" });
|
|
2410
|
+
},
|
|
2411
|
+
clearAll: async () => {
|
|
2412
|
+
await universalTestProviderStore2.untilReady(), universalTestProviderStore2.send({ type: "clear-all" });
|
|
2413
|
+
}
|
|
2414
|
+
}, getTestProviderStoreById2 = (testProviderId) => {
|
|
2415
|
+
let getStateForTestProvider = () => universalTestProviderStore2.getState()[testProviderId] ?? "test-provider-state:pending", setStateForTestProvider = (state) => {
|
|
2416
|
+
universalTestProviderStore2.untilReady().then(() => {
|
|
2417
|
+
universalTestProviderStore2.setState((currentState) => ({
|
|
2418
|
+
...currentState,
|
|
2419
|
+
[testProviderId]: state
|
|
2420
|
+
}));
|
|
2421
|
+
});
|
|
2422
|
+
};
|
|
2423
|
+
return {
|
|
2424
|
+
...baseStore,
|
|
2425
|
+
testProviderId,
|
|
2426
|
+
getState: getStateForTestProvider,
|
|
2427
|
+
setState: setStateForTestProvider,
|
|
2428
|
+
runWithState: async (callback) => {
|
|
2429
|
+
setStateForTestProvider("test-provider-state:running");
|
|
2430
|
+
try {
|
|
2431
|
+
await callback(), setStateForTestProvider("test-provider-state:succeeded");
|
|
2432
|
+
} catch {
|
|
2433
|
+
setStateForTestProvider("test-provider-state:crashed");
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
};
|
|
2437
|
+
};
|
|
2438
|
+
return useUniversalStore ? {
|
|
2439
|
+
getTestProviderStoreById: getTestProviderStoreById2,
|
|
2440
|
+
fullTestProviderStore: fullTestProviderStore2,
|
|
2441
|
+
universalTestProviderStore: universalTestProviderStore2,
|
|
2442
|
+
useTestProviderStore: (selector) => (
|
|
2443
|
+
// The hook also runs without a selector and then returns the whole state.
|
|
2444
|
+
useUniversalStore(
|
|
2445
|
+
universalTestProviderStore2,
|
|
2446
|
+
selector
|
|
2447
|
+
)[0]
|
|
2448
|
+
)
|
|
2449
|
+
} : {
|
|
2450
|
+
getTestProviderStoreById: getTestProviderStoreById2,
|
|
2451
|
+
fullTestProviderStore: fullTestProviderStore2,
|
|
2452
|
+
universalTestProviderStore: universalTestProviderStore2
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
// src/core-server/stores/test-provider.ts
|
|
2457
|
+
function createServerTestProviderStore(leader) {
|
|
2458
|
+
return createTestProviderStore({
|
|
2459
|
+
universalTestProviderStore: UniversalStore.create({
|
|
2460
|
+
...UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS,
|
|
2461
|
+
leader
|
|
2462
|
+
})
|
|
2463
|
+
});
|
|
2464
|
+
}
|
|
2465
|
+
var cache = {};
|
|
2466
|
+
function getTestProviderStoreBundle() {
|
|
2467
|
+
return getOrRecreateStore(
|
|
2468
|
+
UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS.id,
|
|
2469
|
+
cache,
|
|
2470
|
+
createServerTestProviderStore
|
|
2471
|
+
);
|
|
2472
|
+
}
|
|
2473
|
+
function startTestProviderStore() {
|
|
2474
|
+
getTestProviderStoreBundle();
|
|
2475
|
+
}
|
|
2476
|
+
var getTestProviderStoreById = (id) => getTestProviderStoreBundle().getTestProviderStoreById(id), fullTestProviderStore = new Proxy(
|
|
2477
|
+
{},
|
|
2478
|
+
{
|
|
2479
|
+
get(_target, prop) {
|
|
2480
|
+
let store = getTestProviderStoreBundle().fullTestProviderStore, value = Reflect.get(store, prop, store);
|
|
2481
|
+
return typeof value == "function" ? value.bind(store) : value;
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
), universalTestProviderStore = new Proxy({}, {
|
|
2485
|
+
get(_target, prop) {
|
|
2486
|
+
let store = getTestProviderStoreBundle().universalTestProviderStore, value = Reflect.get(store, prop, store);
|
|
2487
|
+
return typeof value == "function" ? value.bind(store) : value;
|
|
2488
|
+
}
|
|
2489
|
+
});
|
|
2490
|
+
|
|
1980
2491
|
// src/core-server/utils/doTelemetry.ts
|
|
1981
|
-
import {
|
|
2492
|
+
import { telemetry as telemetry3 } from "@aussieljk/forkbook/internal/telemetry";
|
|
1982
2493
|
|
|
1983
2494
|
// src/core-server/utils/versionStatus.ts
|
|
1984
2495
|
var versionStatus = (versionCheck) => versionCheck.error ? "error" : versionCheck.cached ? "cached" : "success";
|
|
@@ -1989,26 +2500,14 @@ async function doTelemetry(app, core, storyIndexGeneratorPromise, options) {
|
|
|
1989
2500
|
invariant(
|
|
1990
2501
|
!versionUpdates || versionUpdates && versionCheck,
|
|
1991
2502
|
"versionCheck should be defined when versionUpdates is true"
|
|
1992
|
-
), telemetry3(
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
}
|
|
2001
|
-
let payload = {
|
|
2002
|
-
precedingUpgrade: await getPrecedingUpgrade2()
|
|
2003
|
-
};
|
|
2004
|
-
return indexAndStats && Object.assign(payload, {
|
|
2005
|
-
versionStatus: versionUpdates && versionCheck ? versionStatus(versionCheck) : "disabled",
|
|
2006
|
-
storyIndex: summarizeIndex(indexAndStats.storyIndex),
|
|
2007
|
-
storyStats: indexAndStats.stats
|
|
2008
|
-
}), payload;
|
|
2009
|
-
},
|
|
2010
|
-
{ configDir: options.configDir }
|
|
2011
|
-
);
|
|
2503
|
+
), telemetry3("dev", async () => {
|
|
2504
|
+
let indexAndStats = await (await storyIndexGeneratorPromise)?.getIndexAndStats();
|
|
2505
|
+
return indexAndStats ? {
|
|
2506
|
+
versionStatus: versionUpdates && versionCheck ? versionStatus(versionCheck) : "disabled",
|
|
2507
|
+
storyIndex: summarizeIndex(indexAndStats.storyIndex),
|
|
2508
|
+
storyStats: indexAndStats.stats
|
|
2509
|
+
} : {};
|
|
2510
|
+
});
|
|
2012
2511
|
}
|
|
2013
2512
|
|
|
2014
2513
|
// src/core-server/utils/get-caching-middleware.ts
|
|
@@ -2055,11 +2554,11 @@ function isHostAllowedInternal(hostHeader, allowedHosts) {
|
|
|
2055
2554
|
if (allowedHost === hostname || allowedHost[0] === "." && (allowedHost.slice(1) === hostname || hostname.endsWith(allowedHost))) return !0;
|
|
2056
2555
|
return !1;
|
|
2057
2556
|
}
|
|
2058
|
-
var
|
|
2557
|
+
var cache2 = /* @__PURE__ */ new WeakMap();
|
|
2059
2558
|
function isHostAllowed(hostHeader, allowedHosts) {
|
|
2060
2559
|
if (hostHeader === void 0) return !0;
|
|
2061
2560
|
let cachedAllowedHosts;
|
|
2062
|
-
if (Object.isFrozen(allowedHosts) && (
|
|
2561
|
+
if (Object.isFrozen(allowedHosts) && (cache2.has(allowedHosts) || cache2.set(allowedHosts, /* @__PURE__ */ new Set()), cachedAllowedHosts = cache2.get(allowedHosts), cachedAllowedHosts.has(hostHeader)))
|
|
2063
2562
|
return !0;
|
|
2064
2563
|
let result = isHostAllowedInternal(hostHeader, allowedHosts);
|
|
2065
2564
|
return cachedAllowedHosts && result && cachedAllowedHosts.add(hostHeader), result;
|
|
@@ -2130,13 +2629,13 @@ function getSecurityHeadersMiddleware(security) {
|
|
|
2130
2629
|
|
|
2131
2630
|
// src/core-server/utils/middleware.ts
|
|
2132
2631
|
import { existsSync } from "node:fs";
|
|
2133
|
-
import { resolve as
|
|
2632
|
+
import { resolve as resolve5 } from "pathe";
|
|
2134
2633
|
var fileExists = (basename4) => [".js", ".mjs", ".cjs"].reduce((found, ext) => {
|
|
2135
2634
|
let filename = `${basename4}${ext}`;
|
|
2136
2635
|
return !found && existsSync(filename) ? filename : found;
|
|
2137
2636
|
}, "");
|
|
2138
2637
|
async function getMiddleware(configDir) {
|
|
2139
|
-
let middlewarePath = fileExists(
|
|
2638
|
+
let middlewarePath = fileExists(resolve5(configDir, "middleware"));
|
|
2140
2639
|
if (middlewarePath) {
|
|
2141
2640
|
let middlewareModule = await import("file://" + middlewarePath);
|
|
2142
2641
|
return middlewareModule.default ?? middlewareModule;
|
|
@@ -2153,7 +2652,7 @@ import { dedent } from "ts-dedent";
|
|
|
2153
2652
|
// src/core-server/utils/open-browser/opener.ts
|
|
2154
2653
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1), import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
2155
2654
|
import { execSync } from "node:child_process";
|
|
2156
|
-
import { join as
|
|
2655
|
+
import { join as join8 } from "node:path";
|
|
2157
2656
|
import { logger as logger8 } from "@aussieljk/forkbook/internal/node-logger";
|
|
2158
2657
|
import open from "open";
|
|
2159
2658
|
var OSX_CHROME = "google chrome";
|
|
@@ -2214,7 +2713,7 @@ function startBrowserProcess(browser, url, args) {
|
|
|
2214
2713
|
for (let chromiumBrowser of supportedChromiumBrowsers)
|
|
2215
2714
|
try {
|
|
2216
2715
|
execSync(`ps cax | grep "${chromiumBrowser}"`);
|
|
2217
|
-
let command = `osascript "${
|
|
2716
|
+
let command = `osascript "${join8(
|
|
2218
2717
|
resolvePackageDir("@aussieljk/forkbook"),
|
|
2219
2718
|
"assets",
|
|
2220
2719
|
"server",
|
|
@@ -2293,7 +2792,11 @@ Note: BROWSER environment variable is set to "${browserEnv}". To disable browser
|
|
|
2293
2792
|
var import_detect_port = __toESM(require_detect_port2(), 1);
|
|
2294
2793
|
import net3 from "node:net";
|
|
2295
2794
|
import os2 from "node:os";
|
|
2296
|
-
import {
|
|
2795
|
+
import {
|
|
2796
|
+
getChannelPath as getChannelPath2,
|
|
2797
|
+
joinBasePath as joinBasePath2,
|
|
2798
|
+
normalizeBasePath as normalizeBasePath2
|
|
2799
|
+
} from "@aussieljk/forkbook/internal/channels";
|
|
2297
2800
|
import { logger as logger10 } from "@aussieljk/forkbook/internal/node-logger";
|
|
2298
2801
|
import { NoFreePortError } from "@aussieljk/forkbook/internal/server-errors";
|
|
2299
2802
|
var getListenHost = (host) => host || "127.0.0.1", COVERS_LOOPBACK = /* @__PURE__ */ new Set(["127.0.0.1", "0.0.0.0", "::"]), addLoopbackListener = async (server) => {
|
|
@@ -2301,30 +2804,32 @@ var getListenHost = (host) => host || "127.0.0.1", COVERS_LOOPBACK = /* @__PURE_
|
|
|
2301
2804
|
if (COVERS_LOOPBACK.has(address))
|
|
2302
2805
|
return;
|
|
2303
2806
|
let loopback = net3.createServer((socket) => server.emit("connection", socket));
|
|
2304
|
-
return server.once("close", () => loopback.close()), await new Promise((
|
|
2305
|
-
loopback.once("error", reject), loopback.listen({ port, host: "127.0.0.1" },
|
|
2807
|
+
return server.once("close", () => loopback.close()), await new Promise((resolve10, reject) => {
|
|
2808
|
+
loopback.once("error", reject), loopback.listen({ port, host: "127.0.0.1" }, resolve10);
|
|
2306
2809
|
}), loopback;
|
|
2307
2810
|
};
|
|
2308
2811
|
function getServerAddresses(port, host, proto, initialPath) {
|
|
2309
2812
|
let address = new URL(`${proto}://127.0.0.1:${port}/`), networkAddress = new URL(`${proto}://${host || getLocalIp()}:${port}/`);
|
|
2310
|
-
if (initialPath) {
|
|
2311
|
-
let searchParams = `?path=${decodeURIComponent(
|
|
2312
|
-
initialPath.startsWith("/") ? initialPath : `/${initialPath}`
|
|
2313
|
-
)}`;
|
|
2314
|
-
address.search = searchParams, networkAddress.search = searchParams;
|
|
2315
|
-
}
|
|
2316
2813
|
return {
|
|
2317
|
-
address: address.href,
|
|
2318
|
-
networkAddress: networkAddress.href
|
|
2814
|
+
address: withInitialPath(address.href, initialPath),
|
|
2815
|
+
networkAddress: withInitialPath(networkAddress.href, initialPath)
|
|
2319
2816
|
};
|
|
2320
2817
|
}
|
|
2818
|
+
function withInitialPath(address, initialPath, basePath) {
|
|
2819
|
+
if (!initialPath && !basePath)
|
|
2820
|
+
return address;
|
|
2821
|
+
let url = new URL(address);
|
|
2822
|
+
return initialPath && (url.pathname = decodeURIComponent(
|
|
2823
|
+
initialPath.startsWith("/") ? initialPath : `/${initialPath}`
|
|
2824
|
+
).replace(/^\/(story|docs)\//, "/_$1/")), basePath && (url.pathname = joinBasePath2(basePath, url.pathname)), url.href;
|
|
2825
|
+
}
|
|
2321
2826
|
var getServerPort = (port, { exactPort } = {}) => (0, import_detect_port.default)(port).catch((error) => {
|
|
2322
2827
|
logger10.error(error), process.exit(-1);
|
|
2323
2828
|
}).then((freePort) => {
|
|
2324
2829
|
if (!freePort)
|
|
2325
2830
|
throw new NoFreePortError({ requestedPort: port });
|
|
2326
2831
|
return exactPort && port != null && freePort !== port && (logger10.error(`Port ${port} is not available. Exiting because --exact-port was provided.`), process.exit(-1)), freePort;
|
|
2327
|
-
}), getServerChannelUrl = (port, { https: https2 }) => `${https2 ? "wss" : "ws"}://127.0.0.1:${port}${
|
|
2832
|
+
}), getServerChannelUrl = (port, { https: https2, basePath }) => `${https2 ? "wss" : "ws"}://127.0.0.1:${port}${getChannelPath2(normalizeBasePath2(basePath))}`, getExternalIpv4Addresses = () => Object.values(os2.networkInterfaces()).flat().filter((ip) => ip && ip.family === "IPv4" && !ip.internal).map((ip) => ip.address), getLocalIp = () => getExternalIpv4Addresses()[0] ?? "0.0.0.0", getReachableNetworkAddresses = (networkAddress) => {
|
|
2328
2833
|
if (new URL(networkAddress).hostname !== "0.0.0.0")
|
|
2329
2834
|
return [networkAddress];
|
|
2330
2835
|
let addresses = getExternalIpv4Addresses().map((ip) => {
|
|
@@ -2336,10 +2841,16 @@ var getServerPort = (port, { exactPort } = {}) => (0, import_detect_port.default
|
|
|
2336
2841
|
|
|
2337
2842
|
// src/core-server/dev-server.ts
|
|
2338
2843
|
async function storybookDevServer(options, server) {
|
|
2339
|
-
let core = await options.presets.apply("core"), security = await options.presets.apply("security"), app = build_default2({ server }),
|
|
2844
|
+
let core = await options.presets.apply("core"), security = await options.presets.apply("security"), app = build_default2({ server }), basePath = normalizeBasePath(options.basePath), mountBasePath = createBasePathMount(basePath), handle = app.handler;
|
|
2845
|
+
app.attach = (req, res) => {
|
|
2846
|
+
mountBasePath(req, res) || setImmediate(handle, req, res);
|
|
2847
|
+
};
|
|
2848
|
+
let workingDir = process.cwd(), configDir = options.configDir, features = await options.presets.apply("features"), stories = await options.presets.apply("stories"), normalizedStories = normalizeStories(stories, {
|
|
2340
2849
|
configDir,
|
|
2341
2850
|
workingDir
|
|
2342
|
-
})
|
|
2851
|
+
});
|
|
2852
|
+
startTestProviderStore();
|
|
2853
|
+
let storyIndexGeneratorPromise = withSpan(
|
|
2343
2854
|
"forkbook.story-index",
|
|
2344
2855
|
{},
|
|
2345
2856
|
() => options.presets.apply("storyIndexGenerator")
|
|
@@ -2365,15 +2876,23 @@ async function storybookDevServer(options, server) {
|
|
|
2365
2876
|
channel: options.channel,
|
|
2366
2877
|
workingDir,
|
|
2367
2878
|
configDir
|
|
2368
|
-
}), (await getMiddleware(options.configDir))(app), await options.presets.apply("experimental_devServer", app), !core?.builder)
|
|
2879
|
+
}), registerThumbnailRoute(app, workingDir), (await getMiddleware(options.configDir))(app), await options.presets.apply("experimental_devServer", app), !core?.builder)
|
|
2369
2880
|
throw new MissingBuilderError();
|
|
2370
2881
|
let resolvedPreviewBuilder = typeof core?.builder == "string" ? core.builder : core?.builder?.name, [previewBuilder, managerBuilder] = await Promise.all([
|
|
2371
2882
|
getPreviewBuilder(resolvedPreviewBuilder),
|
|
2372
2883
|
getManagerBuilder(),
|
|
2373
2884
|
useStatics(app, options)
|
|
2374
|
-
])
|
|
2375
|
-
|
|
2376
|
-
|
|
2885
|
+
]), listening = new Promise((resolve10, reject) => {
|
|
2886
|
+
server.once("error", reject), app.listen({ port: options.port, host: getListenHost(options.host) }, resolve10);
|
|
2887
|
+
}).then(() => addLoopbackListener(server));
|
|
2888
|
+
listening.catch(() => {
|
|
2889
|
+
}), storyIndexGeneratorPromise.then((generator) => generator?.getIndex()).catch(() => {
|
|
2890
|
+
}), options.debugWebpack && logConfig2("Preview webpack config", await previewBuilder.getConfig(options));
|
|
2891
|
+
let bailBuilders = async () => {
|
|
2892
|
+
await disposeChangeDetectionRuntime(), await managerBuilder?.bail().catch(() => {
|
|
2893
|
+
}), await previewBuilder?.bail().catch(() => {
|
|
2894
|
+
});
|
|
2895
|
+
}, managerPromise = options.previewOnly ? Promise.resolve(void 0) : withSpan(
|
|
2377
2896
|
"forkbook.manager-start",
|
|
2378
2897
|
{},
|
|
2379
2898
|
() => managerBuilder.start({
|
|
@@ -2383,8 +2902,9 @@ async function storybookDevServer(options, server) {
|
|
|
2383
2902
|
server,
|
|
2384
2903
|
channel: options.channel
|
|
2385
2904
|
})
|
|
2386
|
-
)
|
|
2387
|
-
logger11.debug("Starting preview..")
|
|
2905
|
+
);
|
|
2906
|
+
logger11.debug("Starting preview..");
|
|
2907
|
+
let previewPromise = withSpan(
|
|
2388
2908
|
"forkbook.preview-start",
|
|
2389
2909
|
{},
|
|
2390
2910
|
() => previewBuilder.start({
|
|
@@ -2393,12 +2913,15 @@ async function storybookDevServer(options, server) {
|
|
|
2393
2913
|
router: app,
|
|
2394
2914
|
server,
|
|
2395
2915
|
channel: options.channel
|
|
2396
|
-
}).catch(async (e) => {
|
|
2397
|
-
throw logger11.error("Failed to build the preview"), process.exitCode = 1, await disposeChangeDetectionRuntime(), await managerBuilder?.bail().catch(() => {
|
|
2398
|
-
}), await previewBuilder?.bail().catch(() => {
|
|
2399
|
-
}), e;
|
|
2400
2916
|
})
|
|
2401
|
-
)
|
|
2917
|
+
).catch((e) => {
|
|
2918
|
+
throw logger11.error("Failed to build the preview"), process.exitCode = 1, e;
|
|
2919
|
+
}), managerResult, previewResult;
|
|
2920
|
+
try {
|
|
2921
|
+
[managerResult, previewResult] = await Promise.all([managerPromise, previewPromise]);
|
|
2922
|
+
} catch (e) {
|
|
2923
|
+
throw await bailBuilders(), e;
|
|
2924
|
+
}
|
|
2402
2925
|
let adapter;
|
|
2403
2926
|
try {
|
|
2404
2927
|
adapter = previewBuilder.changeDetectionAdapter?.();
|
|
@@ -2406,20 +2929,17 @@ async function storybookDevServer(options, server) {
|
|
|
2406
2929
|
logger11.warn("Change detection: adapter initialisation failed"), logger11.debug(err instanceof Error ? err.stack ?? err.message : String(err));
|
|
2407
2930
|
}
|
|
2408
2931
|
resolveChangeDetectionAdapter(adapter), changeDetectionService.start();
|
|
2409
|
-
let listening = new Promise((resolve9, reject) => {
|
|
2410
|
-
server.once("error", reject), app.listen({ port: options.port, host: getListenHost(options.host) }, resolve9);
|
|
2411
|
-
}).then(() => addLoopbackListener(server));
|
|
2412
2932
|
try {
|
|
2413
2933
|
let [indexGenerator] = await Promise.all([storyIndexGeneratorPromise, listening]);
|
|
2414
2934
|
if (indexGenerator && !options.ci && !options.smokeTest && options.open) {
|
|
2415
2935
|
let url = options.host && options.host !== "0.0.0.0" ? options.networkAddress : options.localAddress;
|
|
2416
|
-
openInBrowser(
|
|
2936
|
+
openInBrowser(
|
|
2937
|
+
options.previewOnly ? `${withInitialPath(url, "/iframe.html", basePath)}?navigator=true` : withInitialPath(url, options.initialPath, basePath)
|
|
2938
|
+
).catch(() => {
|
|
2417
2939
|
});
|
|
2418
2940
|
}
|
|
2419
2941
|
} catch (e) {
|
|
2420
|
-
throw await
|
|
2421
|
-
}), await previewBuilder?.bail().catch(() => {
|
|
2422
|
-
}), e;
|
|
2942
|
+
throw await bailBuilders(), e;
|
|
2423
2943
|
}
|
|
2424
2944
|
features?.componentsManifest && registerManifests({ app, presets: options.presets }), doTelemetry(app, core, storyIndexGeneratorPromise, options);
|
|
2425
2945
|
async function cancelTelemetry() {
|
|
@@ -2435,7 +2955,7 @@ async function storybookDevServer(options, server) {
|
|
|
2435
2955
|
});
|
|
2436
2956
|
} catch {
|
|
2437
2957
|
}
|
|
2438
|
-
await telemetry("canceled", payload
|
|
2958
|
+
await telemetry("canceled", payload);
|
|
2439
2959
|
} finally {
|
|
2440
2960
|
await disposeChangeDetectionRuntime(), process.exit(0);
|
|
2441
2961
|
}
|
|
@@ -2448,7 +2968,8 @@ var import_telejson2 = __toESM(require_dist(), 1);
|
|
|
2448
2968
|
import {
|
|
2449
2969
|
Channel as Channel3,
|
|
2450
2970
|
HEARTBEAT_INTERVAL as HEARTBEAT_INTERVAL2,
|
|
2451
|
-
|
|
2971
|
+
getChannelPath as getChannelPath3,
|
|
2972
|
+
normalizeBasePath as normalizeBasePath3,
|
|
2452
2973
|
setChannel as setChannel2
|
|
2453
2974
|
} from "@aussieljk/forkbook/internal/channels";
|
|
2454
2975
|
import { WebSocket, WebSocketServer } from "ws";
|
|
@@ -2457,6 +2978,7 @@ import { WebSocket, WebSocketServer } from "ws";
|
|
|
2457
2978
|
import events from "@aussieljk/forkbook/internal/core-events";
|
|
2458
2979
|
var CORE_EVENT_SENDERS = {
|
|
2459
2980
|
[events.CHANNEL_WS_DISCONNECT]: "any",
|
|
2981
|
+
[events.CHANNEL_WS_RECONNECT]: "any",
|
|
2460
2982
|
[events.CHANNEL_CREATED]: "manager",
|
|
2461
2983
|
[events.CONFIG_ERROR]: "preview",
|
|
2462
2984
|
[events.STORY_INDEX_INVALIDATED]: "server",
|
|
@@ -2497,6 +3019,7 @@ var CORE_EVENT_SENDERS = {
|
|
|
2497
3019
|
[events.STORIES_COLLAPSE_ALL]: "manager",
|
|
2498
3020
|
[events.STORIES_EXPAND_ALL]: "manager",
|
|
2499
3021
|
[events.DOCS_RENDERED]: "preview",
|
|
3022
|
+
[events.DOCS_PAGE_IN_VIEW]: "preview",
|
|
2500
3023
|
[events.SHARED_STATE_CHANGED]: "any",
|
|
2501
3024
|
[events.SHARED_STATE_SET]: "any",
|
|
2502
3025
|
[events.NAVIGATE_URL]: "any",
|
|
@@ -2545,14 +3068,16 @@ var ServerChannelTransport = class {
|
|
|
2545
3068
|
}), this.socket.close(() => process.exit(0));
|
|
2546
3069
|
};
|
|
2547
3070
|
this.rejectedEvents = /* @__PURE__ */ new Set();
|
|
2548
|
-
this.socket = new WebSocketServer({ noServer: !0 })
|
|
3071
|
+
this.socket = new WebSocketServer({ noServer: !0 });
|
|
3072
|
+
let channelPath = getChannelPath3(normalizeBasePath3(options.basePath));
|
|
3073
|
+
server.on("upgrade", (request, socket, head) => {
|
|
2549
3074
|
try {
|
|
2550
3075
|
let url = request.url && new URL(request.url, options.localAddress);
|
|
2551
|
-
if (!url || url.pathname !==
|
|
3076
|
+
if (!url || url.pathname !== channelPath)
|
|
2552
3077
|
return;
|
|
2553
3078
|
if (!options.skipValidation) {
|
|
2554
|
-
let { origin } = request.headers;
|
|
2555
|
-
if (
|
|
3079
|
+
let { origin } = request.headers, originHost = origin ? new URL(origin).host : void 0;
|
|
3080
|
+
if (originHost && !isValidHost(originHost, options) && !isForwardedForOrigin(request, originHost)) {
|
|
2556
3081
|
socket.end(`HTTP/1.1 403 Forbidden\r
|
|
2557
3082
|
Connection: close\r
|
|
2558
3083
|
\r
|
|
@@ -2642,10 +3167,10 @@ function prepareHeadlessUniversalStores() {
|
|
|
2642
3167
|
}
|
|
2643
3168
|
|
|
2644
3169
|
// src/core-server/utils/host-validation-warning.ts
|
|
2645
|
-
import { cache as
|
|
3170
|
+
import { cache as cache3, isCI } from "@aussieljk/forkbook/internal/common";
|
|
2646
3171
|
import { logger as logger12, prompt } from "@aussieljk/forkbook/internal/node-logger";
|
|
2647
3172
|
import { dedent as dedent2 } from "ts-dedent";
|
|
2648
|
-
var DOCS_URL = "https://
|
|
3173
|
+
var DOCS_URL = "https://forkbook.ljk.dev/docs/api/main-config/main-config-core#allowedhosts", getHostValidationWarning = ({
|
|
2649
3174
|
host,
|
|
2650
3175
|
allowedHosts
|
|
2651
3176
|
}) => {
|
|
@@ -2678,7 +3203,7 @@ async function warnOnDisabledHostValidation(options) {
|
|
|
2678
3203
|
if (!warning || (logger12.warn(warning.message), options.ci || options.smokeTest || !isInteractiveTerminal()))
|
|
2679
3204
|
return;
|
|
2680
3205
|
let skipPromptKey = `host-validation-prompt-skipped-${warning.id}-${options.cacheKey}`;
|
|
2681
|
-
if (await
|
|
3206
|
+
if (await cache3.get(skipPromptKey).catch(() => !1))
|
|
2682
3207
|
return;
|
|
2683
3208
|
let choice = await prompt.select({
|
|
2684
3209
|
message: "How do you want to proceed?",
|
|
@@ -2697,54 +3222,55 @@ async function warnOnDisabledHostValidation(options) {
|
|
|
2697
3222
|
],
|
|
2698
3223
|
initialValue: "continue"
|
|
2699
3224
|
});
|
|
2700
|
-
choice === "abort" && process.exit(1), choice === "dont-ask" && await
|
|
3225
|
+
choice === "abort" && process.exit(1), choice === "dont-ask" && await cache3.set(skipPromptKey, !0).catch(() => {
|
|
2701
3226
|
});
|
|
2702
3227
|
}
|
|
2703
3228
|
|
|
2704
3229
|
// src/core-server/utils/output-startup-information.ts
|
|
2705
|
-
var import_picocolors6 = __toESM(require_picocolors(), 1)
|
|
2706
|
-
import { CLI_COLORS, logger as logger13 } from "@aussieljk/forkbook/internal/node-logger";
|
|
3230
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
3231
|
+
import { CLI_COLORS, logger as logger13, prettyTime } from "@aussieljk/forkbook/internal/node-logger";
|
|
2707
3232
|
import { dedent as dedent4 } from "ts-dedent";
|
|
2708
3233
|
|
|
2709
3234
|
// src/core-server/utils/update-check.ts
|
|
2710
3235
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
2711
|
-
import { cache as
|
|
3236
|
+
import { cache as cache4 } from "@aussieljk/forkbook/internal/common";
|
|
2712
3237
|
import { colors } from "@aussieljk/forkbook/internal/node-logger";
|
|
2713
3238
|
import semver from "semver";
|
|
2714
3239
|
import { dedent as dedent3 } from "ts-dedent";
|
|
2715
|
-
var { FORKBOOK_VERSION_BASE = "https://
|
|
3240
|
+
var { FORKBOOK_VERSION_BASE = "https://forkbook.ljk.dev", CI } = process.env, updateCheck = async (version) => {
|
|
2716
3241
|
let result, time = Date.now();
|
|
2717
3242
|
try {
|
|
2718
|
-
let fromCache = await
|
|
3243
|
+
let fromCache = await cache4.get("lastUpdateCheck", { success: !1, time: 0 });
|
|
2719
3244
|
time - 864e5 > fromCache.time && !CI ? (result = { success: !0, cached: !1, data: await (await Promise.race([
|
|
2720
3245
|
fetch(`${FORKBOOK_VERSION_BASE}/versions.json?current=${version}`),
|
|
2721
3246
|
// if fetch is too slow, we won't wait for it
|
|
2722
3247
|
new Promise((res, rej) => global.setTimeout(rej, 1500))
|
|
2723
|
-
])).json(), time }, await
|
|
3248
|
+
])).json(), time }, await cache4.set("lastUpdateCheck", result)) : result = { ...fromCache, cached: !0 };
|
|
2724
3249
|
} catch (error) {
|
|
2725
3250
|
result = { success: !1, cached: !1, error, time };
|
|
2726
3251
|
}
|
|
2727
3252
|
return result;
|
|
2728
3253
|
};
|
|
2729
3254
|
function createUpdateMessage(updateInfo, version) {
|
|
2730
|
-
let
|
|
3255
|
+
let latestVersion = updateInfo.data?.latest?.version;
|
|
3256
|
+
if (!updateInfo.success || !latestVersion)
|
|
3257
|
+
return "";
|
|
2731
3258
|
try {
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
3259
|
+
if (!semver.lt(version, latestVersion))
|
|
3260
|
+
return "";
|
|
3261
|
+
let upgradeCommand = `npx @aussieljk/forkbook@${semver.prerelease(latestVersion) ? "next" : "latest"} upgrade`;
|
|
3262
|
+
return dedent3`
|
|
3263
|
+
${colors.orange(`A new version (${import_picocolors5.default.bold(latestVersion)}) is available!`)}
|
|
2737
3264
|
|
|
2738
|
-
|
|
3265
|
+
${import_picocolors5.default.gray("Upgrade now:")} ${colors.green(upgradeCommand)}
|
|
2739
3266
|
|
|
2740
|
-
|
|
2741
|
-
import_picocolors5.default.underline("https://github.com/
|
|
3267
|
+
${import_picocolors5.default.gray("Read full changelog:")} ${import_picocolors5.default.gray(
|
|
3268
|
+
import_picocolors5.default.underline("https://github.com/aussieljk/forkbook/commits/master")
|
|
2742
3269
|
)}
|
|
2743
|
-
|
|
3270
|
+
`;
|
|
2744
3271
|
} catch {
|
|
2745
|
-
|
|
3272
|
+
return "";
|
|
2746
3273
|
}
|
|
2747
|
-
return updateMessage;
|
|
2748
3274
|
}
|
|
2749
3275
|
|
|
2750
3276
|
// src/core-server/utils/output-startup-information.ts
|
|
@@ -2781,8 +3307,8 @@ ${updateMessage}` : ""}
|
|
|
2781
3307
|
}
|
|
2782
3308
|
);
|
|
2783
3309
|
let timeStatement = [
|
|
2784
|
-
managerTotalTime && `${import_picocolors6.default.underline((
|
|
2785
|
-
previewTotalTime && `${import_picocolors6.default.underline((
|
|
3310
|
+
managerTotalTime && `${import_picocolors6.default.underline(prettyTime(managerTotalTime))} for manager`,
|
|
3311
|
+
previewTotalTime && `${import_picocolors6.default.underline(prettyTime(previewTotalTime))} for preview`
|
|
2786
3312
|
].filter(Boolean).join(" and ");
|
|
2787
3313
|
logger13.info(timeStatement);
|
|
2788
3314
|
}
|
|
@@ -2791,10 +3317,10 @@ ${updateMessage}` : ""}
|
|
|
2791
3317
|
import { execFile } from "node:child_process";
|
|
2792
3318
|
import { randomUUID } from "node:crypto";
|
|
2793
3319
|
import { existsSync as existsSync2, rmSync } from "node:fs";
|
|
2794
|
-
import { chmod, mkdir as
|
|
3320
|
+
import { chmod, mkdir as mkdir4, readFile as readFile3, readdir, rename, rm as rm2, stat, writeFile as writeFile3 } from "node:fs/promises";
|
|
2795
3321
|
import { homedir, userInfo } from "node:os";
|
|
2796
3322
|
import { findStorybookPackageRoot, normalizeAddonName } from "@aussieljk/forkbook/internal/common";
|
|
2797
|
-
import { join as
|
|
3323
|
+
import { join as join9, resolve as resolve6 } from "pathe";
|
|
2798
3324
|
var FORKBOOK_MCP_ADDON = "@aussieljk/forkbook/addon-mcp", DEFAULT_MCP_ENDPOINT = "/mcp", ONE_DAY_MS = 1440 * 60 * 1e3, SEVEN_DAYS_MS = 7 * ONE_DAY_MS, REGISTRY_DIR_MODE = 448, RECORD_FILE_MODE = 384;
|
|
2799
3325
|
function execFileAsync(file, args) {
|
|
2800
3326
|
return new Promise((resolveExec, rejectExec) => {
|
|
@@ -2821,7 +3347,7 @@ async function restrictOwnerAccess(targetPath, mode) {
|
|
|
2821
3347
|
}
|
|
2822
3348
|
}
|
|
2823
3349
|
function getDefaultRuntimeInstanceRegistryDir() {
|
|
2824
|
-
return
|
|
3350
|
+
return join9(homedir(), ".forkbook", "instances");
|
|
2825
3351
|
}
|
|
2826
3352
|
function getStorybookBaseUrl(address) {
|
|
2827
3353
|
let url = new URL(address);
|
|
@@ -2855,8 +3381,8 @@ function createRuntimeInstanceRecord({
|
|
|
2855
3381
|
schemaVersion: 1,
|
|
2856
3382
|
instanceId,
|
|
2857
3383
|
pid,
|
|
2858
|
-
cwd:
|
|
2859
|
-
...configDir ? { configDir:
|
|
3384
|
+
cwd: resolve6(cwd),
|
|
3385
|
+
...configDir ? { configDir: resolve6(cwd, configDir) } : {},
|
|
2860
3386
|
url: storybookBaseUrl,
|
|
2861
3387
|
port,
|
|
2862
3388
|
...token ? { token } : {},
|
|
@@ -2869,8 +3395,8 @@ function createRuntimeInstanceRecord({
|
|
|
2869
3395
|
};
|
|
2870
3396
|
}
|
|
2871
3397
|
async function writeRuntimeInstanceRecord(record, registryDir = getDefaultRuntimeInstanceRegistryDir()) {
|
|
2872
|
-
await
|
|
2873
|
-
let recordPath =
|
|
3398
|
+
await mkdir4(registryDir, { recursive: !0, mode: REGISTRY_DIR_MODE }), await restrictOwnerAccess(registryDir, REGISTRY_DIR_MODE), await cleanupRuntimeInstanceRegistry(registryDir);
|
|
3399
|
+
let recordPath = join9(registryDir, `${record.instanceId}.json`), tempPath = join9(
|
|
2874
3400
|
registryDir,
|
|
2875
3401
|
`${record.instanceId}.${record.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`
|
|
2876
3402
|
);
|
|
@@ -2936,7 +3462,7 @@ async function cleanupRuntimeInstanceRegistry(registryDir) {
|
|
|
2936
3462
|
entries.map(async (entry) => {
|
|
2937
3463
|
if (!entry.isFile())
|
|
2938
3464
|
return;
|
|
2939
|
-
let recordPath =
|
|
3465
|
+
let recordPath = join9(registryDir, entry.name);
|
|
2940
3466
|
try {
|
|
2941
3467
|
let { mtimeMs } = await stat(recordPath);
|
|
2942
3468
|
if (entry.name.endsWith(".tmp")) {
|
|
@@ -2952,7 +3478,7 @@ async function cleanupRuntimeInstanceRegistry(registryDir) {
|
|
|
2952
3478
|
}
|
|
2953
3479
|
if (!entry.name.endsWith(".json"))
|
|
2954
3480
|
return;
|
|
2955
|
-
let content = await
|
|
3481
|
+
let content = await readFile3(recordPath, "utf-8"), record;
|
|
2956
3482
|
try {
|
|
2957
3483
|
record = JSON.parse(content);
|
|
2958
3484
|
} catch {
|
|
@@ -3024,7 +3550,7 @@ async function writeStorybookRuntimeInstanceRecord({
|
|
|
3024
3550
|
}
|
|
3025
3551
|
|
|
3026
3552
|
// src/core-server/utils/server-init.ts
|
|
3027
|
-
import { readFile as
|
|
3553
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
3028
3554
|
import { logger as logger14 } from "@aussieljk/forkbook/internal/node-logger";
|
|
3029
3555
|
import http2 from "http";
|
|
3030
3556
|
import https from "https";
|
|
@@ -3033,9 +3559,9 @@ async function getServer(options) {
|
|
|
3033
3559
|
return http2.createServer();
|
|
3034
3560
|
options.sslCert || (logger14.error("Error: --ssl-cert is required with --https"), process.exit(-1)), options.sslKey || (logger14.error("Error: --ssl-key is required with --https"), process.exit(-1));
|
|
3035
3561
|
let sslOptions = {
|
|
3036
|
-
ca: await Promise.all((options.sslCa || []).map((ca) =>
|
|
3037
|
-
cert: await
|
|
3038
|
-
key: await
|
|
3562
|
+
ca: await Promise.all((options.sslCa || []).map((ca) => readFile4(ca, { encoding: "utf8" }))),
|
|
3563
|
+
cert: await readFile4(options.sslCert, { encoding: "utf8" }),
|
|
3564
|
+
key: await readFile4(options.sslKey, { encoding: "utf8" })
|
|
3039
3565
|
};
|
|
3040
3566
|
return https.createServer(sslOptions);
|
|
3041
3567
|
}
|
|
@@ -3050,7 +3576,7 @@ function stripCommentsAndStrings(code) {
|
|
|
3050
3576
|
|
|
3051
3577
|
// src/core-server/build-dev.ts
|
|
3052
3578
|
async function buildDevStandalone(options) {
|
|
3053
|
-
let { packageJson, versionUpdates } = options, { storybookVersion } = options, configDir =
|
|
3579
|
+
let { packageJson, versionUpdates } = options, { storybookVersion } = options, configDir = resolve7(options.configDir);
|
|
3054
3580
|
packageJson ? (invariant(
|
|
3055
3581
|
packageJson.version !== void 0,
|
|
3056
3582
|
`Expected package.json#version to be defined in the "${packageJson.name}" package}`
|
|
@@ -3066,17 +3592,26 @@ async function buildDevStandalone(options) {
|
|
|
3066
3592
|
`,
|
|
3067
3593
|
initialValue: !0
|
|
3068
3594
|
}) || process.exit(1));
|
|
3069
|
-
let cacheKey = oneWayHash(
|
|
3595
|
+
let cacheKey = oneWayHash(relative5(getProjectRoot(), configDir));
|
|
3070
3596
|
invariant(port, "expected options to have a port");
|
|
3071
3597
|
let { address: localAddress, networkAddress } = getServerAddresses(
|
|
3072
3598
|
port,
|
|
3073
3599
|
options.host,
|
|
3074
|
-
options.https ? "https" : "http"
|
|
3075
|
-
|
|
3076
|
-
),
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3600
|
+
options.https ? "https" : "http"
|
|
3601
|
+
), cacheOutputDir = resolvePathInStorybookCache2("public", cacheKey), outputDir = resolve7(options.outputDir || cacheOutputDir);
|
|
3602
|
+
options.smokeTest && (outputDir = cacheOutputDir), options.port = port, options.versionCheck = versionCheck, options.configType = "DEVELOPMENT", options.configDir = configDir, options.cacheKey = cacheKey, options.outputDir = outputDir, options.localAddress = localAddress, options.networkAddress = networkAddress;
|
|
3603
|
+
let config = await loadMainConfig2(options), { core, framework } = config;
|
|
3604
|
+
options.basePath = resolveBasePath(
|
|
3605
|
+
options.basePath,
|
|
3606
|
+
typeof core == "object" ? core.basePath : void 0
|
|
3607
|
+
), options.serverChannelUrl = getServerChannelUrl(port, options), watchParentProcess();
|
|
3608
|
+
let corePresets = [], frameworkName = typeof framework == "string" ? framework : framework?.name;
|
|
3609
|
+
validateFrameworkName(frameworkName), frameworkName && corePresets.push(join10(frameworkName, "preset")), (config.addons ?? []).some(
|
|
3610
|
+
(addon) => (typeof addon == "string" ? addon : addon.name).includes("addon-comments")
|
|
3611
|
+
) || corePresets.push({
|
|
3612
|
+
name: "@aussieljk/forkbook/addon-comments/preset",
|
|
3613
|
+
options: { forkbookDefaultComments: !0 }
|
|
3614
|
+
}), frameworkName = frameworkName || "custom";
|
|
3080
3615
|
let packageManager = JsPackageManagerFactory.getPackageManager({
|
|
3081
3616
|
configDir: options.configDir
|
|
3082
3617
|
}), server = await getServer(options), presets = await loadAllPresets2({
|
|
@@ -3110,11 +3645,11 @@ async function buildDevStandalone(options) {
|
|
|
3110
3645
|
]);
|
|
3111
3646
|
if (resolvedPreviewBuilder.includes("builder-vite")) {
|
|
3112
3647
|
let deprecationMessage = dedent5(`Using CommonJS in your main configuration file is deprecated with Vite.
|
|
3113
|
-
- Refer to the migration guide at https://
|
|
3114
|
-
|
|
3648
|
+
- Refer to the migration guide at https://forkbook.ljk.dev/docs/migration#commonjs-with-vite-is-deprecated`), mainJsPath = getInterpretedFile(
|
|
3649
|
+
resolve7(options.configDir || defaultConfigDir(), "main")
|
|
3115
3650
|
);
|
|
3116
3651
|
/\.c[jt]s$/.test(mainJsPath) && deprecate(deprecationMessage);
|
|
3117
|
-
let mainJsContent = await
|
|
3652
|
+
let mainJsContent = await readFile5(mainJsPath, { encoding: "utf8" }), CJS_CONTENT_REGEX = /\bmodule\.exports\b|\bexports[.[]|\brequire\s*\(|\bObject\.(?:defineProperty|defineProperties|assign)\s*\(\s*exports\b/, strippedContent = stripCommentsAndStrings(mainJsContent);
|
|
3118
3653
|
CJS_CONTENT_REGEX.test(strippedContent) && deprecate(deprecationMessage);
|
|
3119
3654
|
}
|
|
3120
3655
|
let resolvedRenderer = renderer && resolveAddonName2(options.configDir, renderer, options), channel = getServerChannel(server, {
|
|
@@ -3123,11 +3658,12 @@ async function buildDevStandalone(options) {
|
|
|
3123
3658
|
allowedHosts,
|
|
3124
3659
|
skipValidation: isWebContainer(),
|
|
3125
3660
|
localAddress,
|
|
3126
|
-
networkAddress
|
|
3661
|
+
networkAddress,
|
|
3662
|
+
basePath: options.basePath
|
|
3127
3663
|
});
|
|
3128
3664
|
presets = await loadAllPresets2({
|
|
3129
3665
|
corePresets: [
|
|
3130
|
-
|
|
3666
|
+
join10(resolvePackageDir("@aussieljk/forkbook"), "dist/core-server/presets/common-preset.js"),
|
|
3131
3667
|
...managerBuilder.corePresets || [],
|
|
3132
3668
|
...previewBuilder.corePresets || [],
|
|
3133
3669
|
...resolvedRenderer ? [resolvedRenderer] : [],
|
|
@@ -3141,7 +3677,7 @@ async function buildDevStandalone(options) {
|
|
|
3141
3677
|
channel
|
|
3142
3678
|
});
|
|
3143
3679
|
let features = await presets.apply("features");
|
|
3144
|
-
|
|
3680
|
+
global2.FEATURES = features, await presets.apply("experimental_serverChannel", channel);
|
|
3145
3681
|
let fullOptions = {
|
|
3146
3682
|
...options,
|
|
3147
3683
|
presets,
|
|
@@ -3151,7 +3687,7 @@ async function buildDevStandalone(options) {
|
|
|
3151
3687
|
async () => storybookDevServer(fullOptions, server)
|
|
3152
3688
|
), mcp = getMcpMetadataFromMainConfig(config);
|
|
3153
3689
|
await writeStorybookRuntimeInstanceRecord({
|
|
3154
|
-
address: localAddress
|
|
3690
|
+
address: `${new URL(localAddress).origin}${joinBasePath(options.basePath)}`,
|
|
3155
3691
|
configDir: options.configDir,
|
|
3156
3692
|
mcp,
|
|
3157
3693
|
port,
|
|
@@ -3185,9 +3721,9 @@ async function buildDevStandalone(options) {
|
|
|
3185
3721
|
updateInfo: versionCheck,
|
|
3186
3722
|
version: storybookVersion,
|
|
3187
3723
|
name,
|
|
3188
|
-
address: localAddress,
|
|
3724
|
+
address: withInitialPath(localAddress, options.initialPath, options.basePath),
|
|
3189
3725
|
host: options.host,
|
|
3190
|
-
networkAddress,
|
|
3726
|
+
networkAddress: withInitialPath(networkAddress, options.initialPath, options.basePath),
|
|
3191
3727
|
allowedHosts,
|
|
3192
3728
|
managerTotalTime,
|
|
3193
3729
|
previewTotalTime
|
|
@@ -3195,6 +3731,18 @@ async function buildDevStandalone(options) {
|
|
|
3195
3731
|
}
|
|
3196
3732
|
return { port, address: localAddress, networkAddress };
|
|
3197
3733
|
}
|
|
3734
|
+
function watchParentProcess() {
|
|
3735
|
+
let parentPid = Number(process.env.FORKBOOK_PARENT_PID);
|
|
3736
|
+
if (!Number.isInteger(parentPid) || parentPid <= 0)
|
|
3737
|
+
return;
|
|
3738
|
+
globalThis.setInterval(() => {
|
|
3739
|
+
try {
|
|
3740
|
+
process.kill(parentPid, 0);
|
|
3741
|
+
} catch {
|
|
3742
|
+
process.exit(0);
|
|
3743
|
+
}
|
|
3744
|
+
}, 2e3).unref?.();
|
|
3745
|
+
}
|
|
3198
3746
|
|
|
3199
3747
|
// src/core-server/build-index.ts
|
|
3200
3748
|
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
@@ -3212,15 +3760,14 @@ import {
|
|
|
3212
3760
|
validateFrameworkName as validateFrameworkName2
|
|
3213
3761
|
} from "@aussieljk/forkbook/internal/common";
|
|
3214
3762
|
import { oneWayHash as oneWayHash2 } from "@aussieljk/forkbook/internal/telemetry";
|
|
3215
|
-
import {
|
|
3216
|
-
import { dirname, isAbsolute, join as join9, relative as relative5, resolve as resolve7 } from "pathe";
|
|
3763
|
+
import { dirname as dirname3, isAbsolute as isAbsolute2, join as join11, relative as relative6, resolve as resolve8 } from "pathe";
|
|
3217
3764
|
async function loadStorybook(options) {
|
|
3218
|
-
let configDir =
|
|
3765
|
+
let configDir = resolve8(options.configDir), cacheKey = oneWayHash2(relative6(getProjectRoot2(), configDir));
|
|
3219
3766
|
options.configType = "DEVELOPMENT", options.configDir = configDir, options.cacheKey = cacheKey;
|
|
3220
3767
|
let channel = options.channel ?? new Channel4({});
|
|
3221
3768
|
setChannel3(channel);
|
|
3222
3769
|
let config = await loadMainConfig3(options), { framework } = config, corePresets = [], frameworkName = typeof framework == "string" ? framework : framework?.name;
|
|
3223
|
-
validateFrameworkName2(frameworkName), frameworkName && corePresets.push(
|
|
3770
|
+
validateFrameworkName2(frameworkName), frameworkName && corePresets.push(join11(frameworkName, "preset")), frameworkName = frameworkName || "custom";
|
|
3224
3771
|
let presets = await loadAllPresets3({
|
|
3225
3772
|
corePresets,
|
|
3226
3773
|
overridePresets: [
|
|
@@ -3231,12 +3778,12 @@ async function loadStorybook(options) {
|
|
|
3231
3778
|
channel
|
|
3232
3779
|
}), { renderer, builder } = await presets.apply("core", {}), resolvedRenderer = renderer && resolveAddonName3(options.configDir, renderer, options), builderName = typeof builder == "string" ? builder : builder?.name;
|
|
3233
3780
|
if (builderName) {
|
|
3234
|
-
let builderEntry = builderName.startsWith("file:") ? fileURLToPath(builderName) : builderName, builderPresetDir =
|
|
3781
|
+
let builderEntry = builderName.startsWith("file:") ? fileURLToPath(builderName) : builderName, builderPresetDir = isAbsolute2(builderEntry) ? dirname3(builderEntry) : resolvePackageDir(builderEntry), builderPreset = safeResolveModule({ specifier: join11(builderPresetDir, "preset.js") });
|
|
3235
3782
|
builderPreset && corePresets.push(builderPreset);
|
|
3236
3783
|
}
|
|
3237
3784
|
presets = await loadAllPresets3({
|
|
3238
3785
|
corePresets: [
|
|
3239
|
-
|
|
3786
|
+
join11(resolvePackageDir("@aussieljk/forkbook"), "dist/core-server/presets/common-preset.js"),
|
|
3240
3787
|
...resolvedRenderer ? [resolvedRenderer] : [],
|
|
3241
3788
|
...corePresets
|
|
3242
3789
|
],
|
|
@@ -3247,7 +3794,7 @@ async function loadStorybook(options) {
|
|
|
3247
3794
|
channel
|
|
3248
3795
|
});
|
|
3249
3796
|
let features = await presets.apply("features");
|
|
3250
|
-
return
|
|
3797
|
+
return global2.FEATURES = features, await applyServicesPresetOnce(presets), {
|
|
3251
3798
|
...options,
|
|
3252
3799
|
// the resolved channel — the one the presets received — never the possibly-absent option
|
|
3253
3800
|
channel,
|
|
@@ -3258,8 +3805,8 @@ async function loadStorybook(options) {
|
|
|
3258
3805
|
|
|
3259
3806
|
// src/core-server/utils/StoryIndexGenerator.ts
|
|
3260
3807
|
import { existsSync as existsSync3 } from "node:fs";
|
|
3261
|
-
import { readFile as
|
|
3262
|
-
import { dirname as
|
|
3808
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
3809
|
+
import { dirname as dirname4, extname, join as join12, normalize as normalize3, relative as relative7, resolve as resolve9, sep as sep2 } from "node:path";
|
|
3263
3810
|
import {
|
|
3264
3811
|
commonGlobOptions as commonGlobOptions2,
|
|
3265
3812
|
getProjectRoot as getProjectRoot3,
|
|
@@ -3267,19 +3814,63 @@ import {
|
|
|
3267
3814
|
normalizeStoryPath
|
|
3268
3815
|
} from "@aussieljk/forkbook/internal/common";
|
|
3269
3816
|
import { combineTags, storyNameFromExport, toId } from "@aussieljk/forkbook/internal/csf/csf-utils";
|
|
3270
|
-
import { loadConfig } from "@aussieljk/forkbook/internal/csf-tools";
|
|
3271
|
-
import { logger as logger16, once } from "@aussieljk/forkbook/internal/node-logger";
|
|
3817
|
+
import { loadConfig as loadConfig2 } from "@aussieljk/forkbook/internal/csf-tools";
|
|
3818
|
+
import { logger as logger16, once as once2 } from "@aussieljk/forkbook/internal/node-logger";
|
|
3272
3819
|
import { isExampleStoryId as isExampleStoryId2 } from "@aussieljk/forkbook/internal/telemetry";
|
|
3273
3820
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
3274
3821
|
var TsconfigPaths = __toESM(require_lib(), 1);
|
|
3275
|
-
import { dedent as
|
|
3822
|
+
import { dedent as dedent8 } from "ts-dedent";
|
|
3276
3823
|
|
|
3277
3824
|
// src/docs-tools/shared.ts
|
|
3278
3825
|
var ADDON_ID = "@aussieljk/forkbook/docs", PANEL_ID = `${ADDON_ID}/panel`;
|
|
3279
3826
|
var anchorBlockIdFromId = (storyId) => `anchor--${storyId}`, SNIPPET_RENDERED = `${ADDON_ID}/snippet-rendered`;
|
|
3280
3827
|
|
|
3281
|
-
// src/
|
|
3828
|
+
// src/core-server/utils/get-story-sort-parameter.ts
|
|
3829
|
+
import { generate } from "@aussieljk/forkbook/internal/babel";
|
|
3830
|
+
import { loadConfig } from "@aussieljk/forkbook/internal/csf-tools";
|
|
3831
|
+
import { once } from "@aussieljk/forkbook/internal/node-logger";
|
|
3832
|
+
import { transformSync } from "rolldown/utils";
|
|
3282
3833
|
import { dedent as dedent6 } from "ts-dedent";
|
|
3834
|
+
var STORY_SORT_PATH = ["parameters", "options", "storySort"];
|
|
3835
|
+
function getStorySortParameter(previewCode) {
|
|
3836
|
+
if (!previewCode || !previewCode.includes("storySort"))
|
|
3837
|
+
return;
|
|
3838
|
+
let node, config;
|
|
3839
|
+
try {
|
|
3840
|
+
config = loadConfig(previewCode).parse(), node = config.get(STORY_SORT_PATH);
|
|
3841
|
+
} catch {
|
|
3842
|
+
return;
|
|
3843
|
+
}
|
|
3844
|
+
if (!node)
|
|
3845
|
+
return;
|
|
3846
|
+
let nodeType = node.type;
|
|
3847
|
+
if (nodeType === "ArrowFunctionExpression" || nodeType === "FunctionExpression" || nodeType === "ObjectMethod")
|
|
3848
|
+
try {
|
|
3849
|
+
let source = generate(node).code, wrapped = `export default (${nodeType === "ObjectMethod" ? `function ${source}` : source});`, { code, errors } = transformSync("story-sort.tsx", wrapped, { lang: "tsx" });
|
|
3850
|
+
if (errors.length)
|
|
3851
|
+
throw new Error(errors[0].message);
|
|
3852
|
+
let body = code.replace(/export default\s*/, "return ");
|
|
3853
|
+
return new Function(body)();
|
|
3854
|
+
} catch (err) {
|
|
3855
|
+
once.warn(dedent6`
|
|
3856
|
+
Unable to evaluate parameters.options.storySort from the preview file. The function must
|
|
3857
|
+
not use imports or variables from outside its body.
|
|
3858
|
+
|
|
3859
|
+
${String(err)}
|
|
3860
|
+
`);
|
|
3861
|
+
return;
|
|
3862
|
+
}
|
|
3863
|
+
let value = config.getValue(STORY_SORT_PATH);
|
|
3864
|
+
if (value && typeof value == "object")
|
|
3865
|
+
return value;
|
|
3866
|
+
once.warn(dedent6`
|
|
3867
|
+
Unable to read parameters.options.storySort from the preview file. Use an inline object, for
|
|
3868
|
+
example { order: ['Intro', 'Components'] }, or an inline function.
|
|
3869
|
+
`);
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
// src/shared/story-index/sortStories.ts
|
|
3873
|
+
import { dedent as dedent7 } from "ts-dedent";
|
|
3283
3874
|
|
|
3284
3875
|
// src/shared/story-index/storySort.ts
|
|
3285
3876
|
var STORY_KIND_PATH_SEPARATOR = /\s*\/\s*/, storySort = (options = {}) => (a, b) => {
|
|
@@ -3330,14 +3921,14 @@ var toComparator = (storySortParameter) => typeof storySortParameter == "functio
|
|
|
3330
3921
|
try {
|
|
3331
3922
|
return sortStoriesCommon(stories, storySortParameter, fileNameOrder);
|
|
3332
3923
|
} catch (err) {
|
|
3333
|
-
throw new Error(
|
|
3924
|
+
throw new Error(dedent7`
|
|
3334
3925
|
Error sorting stories with sort parameter ${storySortParameter}:
|
|
3335
3926
|
|
|
3336
3927
|
> ${err.message}
|
|
3337
3928
|
|
|
3338
3929
|
Are you using a V6-style sort function in V7 mode?
|
|
3339
3930
|
|
|
3340
|
-
More info: https://
|
|
3931
|
+
More info: https://forkbook.ljk.dev/docs/migration#v7-style-story-sort
|
|
3341
3932
|
`);
|
|
3342
3933
|
}
|
|
3343
3934
|
};
|
|
@@ -3519,7 +4110,7 @@ var addStats = (stat2, acc) => {
|
|
|
3519
4110
|
};
|
|
3520
4111
|
|
|
3521
4112
|
// src/core-server/utils/StoryIndexGenerator.ts
|
|
3522
|
-
var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.startsWith(".") ? slash(
|
|
4113
|
+
var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.startsWith(".") ? slash(resolve9(workingDir, normalizeStoryPath(join12(dirname4(normalizedPath), otherImport)))) : otherImport, StoryIndexGenerator = class _StoryIndexGenerator {
|
|
3523
4114
|
constructor(specifiers, options) {
|
|
3524
4115
|
this.specifiers = specifiers;
|
|
3525
4116
|
this.options = options;
|
|
@@ -3547,20 +4138,21 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3547
4138
|
let cacheKey = this.getFindMatchingFilesCacheKey(specifier, workingDir, ignoreWarnings), cached = this.findMatchingFilesCache.get(cacheKey);
|
|
3548
4139
|
if (cached)
|
|
3549
4140
|
return cached;
|
|
3550
|
-
let pathToSubIndex = {}, globCwd = slash(
|
|
4141
|
+
let pathToSubIndex = {}, globCwd = slash(resolve9(workingDir, specifier.directory)), globPattern = specifier.files.startsWith("!") ? `./${specifier.files}` : specifier.files, { glob: glob2 } = await import("../_node-chunks/dist-Q2XNFC24.js"), files = await glob2(globPattern, {
|
|
3551
4142
|
absolute: !0,
|
|
4143
|
+
expandDirectories: !1,
|
|
3552
4144
|
cwd: globCwd,
|
|
3553
4145
|
...commonGlobOptions2(globPattern),
|
|
3554
4146
|
onlyFiles: !0
|
|
3555
4147
|
});
|
|
3556
|
-
return files.length === 0 && !ignoreWarnings &&
|
|
4148
|
+
return files.length === 0 && !ignoreWarnings && once2.warn(
|
|
3557
4149
|
`No story files found for the specified pattern: ${import_picocolors7.default.blue(
|
|
3558
|
-
|
|
4150
|
+
join12(specifier.directory, specifier.files)
|
|
3559
4151
|
)}`
|
|
3560
4152
|
), files.sort().forEach((absolutePath) => {
|
|
3561
4153
|
let ext = extname(absolutePath);
|
|
3562
4154
|
if (ext === ".storyshot") {
|
|
3563
|
-
let relativePath =
|
|
4155
|
+
let relativePath = relative7(workingDir, absolutePath);
|
|
3564
4156
|
logger16.info(`Skipping ${ext} file ${relativePath}`);
|
|
3565
4157
|
return;
|
|
3566
4158
|
}
|
|
@@ -3584,7 +4176,7 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3584
4176
|
this.specifiers,
|
|
3585
4177
|
this.options.workingDir
|
|
3586
4178
|
)).forEach(
|
|
3587
|
-
([specifier,
|
|
4179
|
+
([specifier, cache5]) => this.specifierToCache.set(specifier, cache5)
|
|
3588
4180
|
);
|
|
3589
4181
|
let previewCode = await this.getPreviewCode(), projectTags = this.getProjectTags(previewCode);
|
|
3590
4182
|
await this.ensureExtracted({ projectTags });
|
|
@@ -3605,7 +4197,7 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3605
4197
|
try {
|
|
3606
4198
|
entry[absolutePath] = await updater(specifier, absolutePath, entry[absolutePath]);
|
|
3607
4199
|
} catch (err) {
|
|
3608
|
-
let relativePath = `.${sep2}${
|
|
4200
|
+
let relativePath = `.${sep2}${relative7(this.options.workingDir, absolutePath)}`;
|
|
3609
4201
|
entry[absolutePath] = {
|
|
3610
4202
|
type: "error",
|
|
3611
4203
|
err: new IndexingError(
|
|
@@ -3633,13 +4225,13 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3633
4225
|
);
|
|
3634
4226
|
let statsSummary = {};
|
|
3635
4227
|
return { entries: this.specifiers.flatMap((specifier) => {
|
|
3636
|
-
let
|
|
4228
|
+
let cache5 = this.specifierToCache.get(specifier);
|
|
3637
4229
|
return invariant(
|
|
3638
|
-
|
|
4230
|
+
cache5,
|
|
3639
4231
|
`specifier does not have a matching cache entry in specifierToCache: ${JSON.stringify(
|
|
3640
4232
|
specifier
|
|
3641
4233
|
)}`
|
|
3642
|
-
), Object.values(
|
|
4234
|
+
), Object.values(cache5).flatMap((entry) => entry ? entry.type === "docs" ? [entry] : entry.type === "error" ? [entry] : entry.entries.map((item) => {
|
|
3643
4235
|
if (item.type === "docs")
|
|
3644
4236
|
return item;
|
|
3645
4237
|
isExampleStoryId2(item.id) || addStats(item.extra.stats, statsSummary);
|
|
@@ -3650,7 +4242,7 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3650
4242
|
}
|
|
3651
4243
|
findDependencies(absoluteImports) {
|
|
3652
4244
|
return [...this.specifierToCache.values()].flatMap(
|
|
3653
|
-
(
|
|
4245
|
+
(cache5) => Object.entries(cache5).filter(([fileName, cacheEntry]) => !cacheEntry || cacheEntry.type !== "stories" ? !1 : !!absoluteImports.find(
|
|
3654
4246
|
(storyImport) => fileName.match(
|
|
3655
4247
|
new RegExp(`^${storyImport.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(\\.[^.]+)?$`)
|
|
3656
4248
|
)
|
|
@@ -3666,15 +4258,15 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3666
4258
|
resolveComponentPath(rawComponentPath, absolutePath, matchPath) {
|
|
3667
4259
|
let matchedPath = matchPath?.(rawComponentPath, void 0, void 0, supportedExtensions) ?? rawComponentPath, resolved;
|
|
3668
4260
|
try {
|
|
3669
|
-
resolved = resolveImport(matchedPath, { basedir:
|
|
4261
|
+
resolved = resolveImport(matchedPath, { basedir: dirname4(absolutePath) });
|
|
3670
4262
|
} catch {
|
|
3671
4263
|
return matchedPath;
|
|
3672
4264
|
}
|
|
3673
|
-
let relativePath =
|
|
4265
|
+
let relativePath = relative7(this.options.workingDir, resolved);
|
|
3674
4266
|
return slash(normalizeStoryPath(relativePath));
|
|
3675
4267
|
}
|
|
3676
4268
|
async extractStories(specifier, absolutePath, projectTags = []) {
|
|
3677
|
-
let relativePath =
|
|
4269
|
+
let relativePath = relative7(this.options.workingDir, absolutePath), importPath = slash(normalizeStoryPath(relativePath)), defaultMakeTitle = (userTitle) => {
|
|
3678
4270
|
let title = userOrAutoTitleFromSpecifier(importPath, specifier, userTitle);
|
|
3679
4271
|
return invariant(
|
|
3680
4272
|
title,
|
|
@@ -3693,7 +4285,7 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3693
4285
|
tsconfig.paths,
|
|
3694
4286
|
["browser", "module", "main"]
|
|
3695
4287
|
));
|
|
3696
|
-
let toImportPath = (path) => path ? path.startsWith("virtual:") ? path : slash(normalizeStoryPath(
|
|
4288
|
+
let toImportPath = (path) => path ? path.startsWith("virtual:") ? path : slash(normalizeStoryPath(relative7(this.options.workingDir, path))) : importPath, storyEntries = indexInputs.map((input) => {
|
|
3697
4289
|
let name = input.name ?? storyNameFromExport(input.exportName), componentPath = input.rawComponentPath && this.resolveComponentPath(input.rawComponentPath, absolutePath, matchPath), title = input.title ?? defaultMakeTitle(), id = input.__id ?? toId(input.metaId ?? title, storyNameFromExport(input.exportName)), tags = combineTags(...projectTags, ...input.tags ?? []), subtype = input.subtype ?? "story", entry = {
|
|
3698
4290
|
type: "story",
|
|
3699
4291
|
subtype,
|
|
@@ -3708,7 +4300,9 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3708
4300
|
componentPath,
|
|
3709
4301
|
tags
|
|
3710
4302
|
};
|
|
3711
|
-
|
|
4303
|
+
subtype === "test" && (entry.parent = input.parent, entry.parentName = input.parentName), input.exportName && (entry.exportName = input.exportName);
|
|
4304
|
+
let thumbnail = resolveThumbnail(input.thumbnail, absolutePath, this.options.workingDir);
|
|
4305
|
+
return thumbnail && (entry.thumbnail = thumbnail), entry;
|
|
3712
4306
|
});
|
|
3713
4307
|
if (storyEntries.some((entry) => entry.tags.includes(Tag.AUTODOCS)) && !!this.options.docs && this.options.build?.test?.disableAutoDocs !== !0) {
|
|
3714
4308
|
let name = this.options.docs?.defaultName ?? "Docs", { metaId } = indexInputs[0], entry = storyEntries[0], id = toId(metaId ?? entry.title, name), tags = combineTags(...projectTags, ...indexInputs[0].tags ?? []);
|
|
@@ -3738,9 +4332,9 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3738
4332
|
};
|
|
3739
4333
|
}
|
|
3740
4334
|
async extractDocs(specifier, absolutePath, projectTags = []) {
|
|
3741
|
-
let relativePath =
|
|
4335
|
+
let relativePath = relative7(this.options.workingDir, absolutePath);
|
|
3742
4336
|
try {
|
|
3743
|
-
let normalizedPath = normalizeStoryPath(relativePath), importPath = slash(normalizedPath), content = await
|
|
4337
|
+
let normalizedPath = normalizeStoryPath(relativePath), importPath = slash(normalizedPath), content = await readFile6(absolutePath, { encoding: "utf8" }), result = await analyzeMdx(content);
|
|
3744
4338
|
if (result.isTemplate)
|
|
3745
4339
|
return !1;
|
|
3746
4340
|
let absoluteImports = result.imports.map(
|
|
@@ -3751,8 +4345,8 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3751
4345
|
dependencies.forEach((dep) => {
|
|
3752
4346
|
if (dep.entries.length > 0) {
|
|
3753
4347
|
let first = dep.entries.find((e) => e.type !== "docs");
|
|
3754
|
-
|
|
3755
|
-
|
|
4348
|
+
normalize3(resolve9(this.options.workingDir, first.importPath)).startsWith(
|
|
4349
|
+
normalize3(absoluteOf)
|
|
3756
4350
|
) && (csfEntry = first, metaDependency = dep);
|
|
3757
4351
|
}
|
|
3758
4352
|
}), metaDependency && (sortedDependencies = [
|
|
@@ -3760,7 +4354,7 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3760
4354
|
...dependencies.filter((d) => d !== metaDependency)
|
|
3761
4355
|
]), invariant(
|
|
3762
4356
|
csfEntry,
|
|
3763
|
-
|
|
4357
|
+
dedent8`
|
|
3764
4358
|
Could not find or load CSF file at path "${result.of}" referenced by \`of={}\` in docs file "${relativePath}".
|
|
3765
4359
|
|
|
3766
4360
|
- Does that file exist?
|
|
@@ -3797,7 +4391,7 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3797
4391
|
} catch (err) {
|
|
3798
4392
|
throw err && err.source?.match(/mdast-util-mdx-jsx/g) && logger16.warn(
|
|
3799
4393
|
`\u{1F4A1} This seems to be an MDX2 syntax error. Please refer to the MDX section in the following resource for assistance on how to fix this: ${import_picocolors7.default.yellow(
|
|
3800
|
-
"https://
|
|
4394
|
+
"https://forkbook.ljk.dev/docs/migration#mdx2-upgrade"
|
|
3801
4395
|
)}`
|
|
3802
4396
|
), err;
|
|
3803
4397
|
}
|
|
@@ -3854,6 +4448,45 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3854
4448
|
async getIndex() {
|
|
3855
4449
|
return (await this.getIndexAndStats()).storyIndex;
|
|
3856
4450
|
}
|
|
4451
|
+
/**
|
|
4452
|
+
* Like `getIndex`, but when some story files fail to index, return the entries of the other files
|
|
4453
|
+
* and list the bad files in `errors`. Errors that affect the whole index (for example duplicate
|
|
4454
|
+
* story ids) still throw.
|
|
4455
|
+
*/
|
|
4456
|
+
async getIndexWithFileErrors() {
|
|
4457
|
+
try {
|
|
4458
|
+
return await this.getIndex();
|
|
4459
|
+
} catch (err) {
|
|
4460
|
+
if (this.lastPartialIndex)
|
|
4461
|
+
return this.lastPartialIndex;
|
|
4462
|
+
throw err;
|
|
4463
|
+
}
|
|
4464
|
+
}
|
|
4465
|
+
async buildPartialIndex(storiesList, projectTags, fileErrors) {
|
|
4466
|
+
let indexEntries = {};
|
|
4467
|
+
try {
|
|
4468
|
+
for (let entry of storiesList) {
|
|
4469
|
+
if (entry.type === "error")
|
|
4470
|
+
continue;
|
|
4471
|
+
let existing = indexEntries[entry.id];
|
|
4472
|
+
indexEntries[entry.id] = existing ? this.chooseDuplicate(existing, entry, projectTags ?? []) : entry;
|
|
4473
|
+
}
|
|
4474
|
+
return {
|
|
4475
|
+
v: 5,
|
|
4476
|
+
entries: await this.sortStories(
|
|
4477
|
+
indexEntries,
|
|
4478
|
+
combineStorySorts(this.options.storySorts ?? [])
|
|
4479
|
+
),
|
|
4480
|
+
errors: fileErrors.map((err) => ({
|
|
4481
|
+
importPath: slash(err.importPaths[0] ?? ""),
|
|
4482
|
+
importPaths: err.importPaths.map((path) => slash(path)),
|
|
4483
|
+
message: err.message
|
|
4484
|
+
}))
|
|
4485
|
+
};
|
|
4486
|
+
} catch {
|
|
4487
|
+
return null;
|
|
4488
|
+
}
|
|
4489
|
+
}
|
|
3857
4490
|
async getIndexAndStats() {
|
|
3858
4491
|
if (this.lastIndex && this.lastStats)
|
|
3859
4492
|
return { storyIndex: this.lastIndex, stats: this.lastStats };
|
|
@@ -3862,8 +4495,10 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3862
4495
|
let previewCode = await this.getPreviewCode(), projectTags = this.getProjectTags(previewCode), { entries: storiesList, stats } = await this.ensureExtracted({ projectTags });
|
|
3863
4496
|
try {
|
|
3864
4497
|
let errorEntries = storiesList.filter((entry) => entry.type === "error");
|
|
3865
|
-
if (errorEntries.length)
|
|
3866
|
-
|
|
4498
|
+
if (errorEntries.length) {
|
|
4499
|
+
let fileErrors = errorEntries.map((entry) => entry.err);
|
|
4500
|
+
throw this.lastPartialIndex = await this.buildPartialIndex(storiesList, projectTags, fileErrors), new MultipleIndexingError(fileErrors);
|
|
4501
|
+
}
|
|
3867
4502
|
let duplicateErrors = [], indexEntries = {};
|
|
3868
4503
|
if (storiesList.forEach((entry) => {
|
|
3869
4504
|
try {
|
|
@@ -3874,9 +4509,12 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3874
4509
|
}
|
|
3875
4510
|
}), duplicateErrors.length)
|
|
3876
4511
|
throw new MultipleIndexingError(duplicateErrors);
|
|
3877
|
-
let sorted = await this.sortStories(
|
|
4512
|
+
let previewStorySort = getStorySortParameter(previewCode), sorted = await this.sortStories(
|
|
3878
4513
|
indexEntries,
|
|
3879
|
-
combineStorySorts(
|
|
4514
|
+
combineStorySorts([
|
|
4515
|
+
...this.options.storySorts ?? [],
|
|
4516
|
+
...previewStorySort ? [previewStorySort] : []
|
|
4517
|
+
])
|
|
3880
4518
|
);
|
|
3881
4519
|
return this.lastStats = stats, this.lastIndex = {
|
|
3882
4520
|
v: 5,
|
|
@@ -3887,26 +4525,26 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3887
4525
|
}
|
|
3888
4526
|
}
|
|
3889
4527
|
invalidateAll() {
|
|
3890
|
-
this.specifierToCache.forEach((
|
|
3891
|
-
Object.keys(
|
|
3892
|
-
|
|
4528
|
+
this.specifierToCache.forEach((cache5) => {
|
|
4529
|
+
Object.keys(cache5).forEach((key) => {
|
|
4530
|
+
cache5[key] = !1;
|
|
3893
4531
|
});
|
|
3894
|
-
}), this.lastIndex = null, this.lastError = null, this.invalidationListeners.forEach((listener) => listener());
|
|
4532
|
+
}), this.lastIndex = null, this.lastError = null, this.lastPartialIndex = null, this.invalidationListeners.forEach((listener) => listener());
|
|
3895
4533
|
}
|
|
3896
4534
|
invalidate(importPath, removed) {
|
|
3897
|
-
let absolutePath = slash(
|
|
4535
|
+
let added = !1, wasRemoved = !1, absolutePath = slash(resolve9(this.options.workingDir, importPath)), specifier = Array.from(this.specifierToCache.keys()).find(
|
|
3898
4536
|
(ns) => ns.importPathMatcher.exec(importPath)
|
|
3899
4537
|
);
|
|
3900
4538
|
if (!specifier)
|
|
3901
4539
|
return;
|
|
3902
|
-
let
|
|
4540
|
+
let cache5 = this.specifierToCache.get(specifier);
|
|
3903
4541
|
invariant(
|
|
3904
|
-
|
|
4542
|
+
cache5,
|
|
3905
4543
|
`specifier does not have a matching cache entry in specifierToCache: ${JSON.stringify(
|
|
3906
4544
|
specifier
|
|
3907
4545
|
)}`
|
|
3908
4546
|
);
|
|
3909
|
-
let cacheEntry =
|
|
4547
|
+
let cacheEntry = cache5[absolutePath];
|
|
3910
4548
|
if (cacheEntry && cacheEntry.type === "stories") {
|
|
3911
4549
|
let { dependents } = cacheEntry, invalidated = /* @__PURE__ */ new Set();
|
|
3912
4550
|
this.specifierToCache.forEach((otherCache) => {
|
|
@@ -3918,16 +4556,18 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3918
4556
|
if (removed) {
|
|
3919
4557
|
if (cacheEntry && cacheEntry.type === "docs") {
|
|
3920
4558
|
let absoluteImports = cacheEntry.storiesImports.map(
|
|
3921
|
-
(p) =>
|
|
4559
|
+
(p) => resolve9(this.options.workingDir, p)
|
|
3922
4560
|
);
|
|
3923
4561
|
this.findDependencies(absoluteImports).forEach(
|
|
3924
4562
|
(dep) => dep.dependents.splice(dep.dependents.indexOf(absolutePath), 1)
|
|
3925
4563
|
);
|
|
3926
4564
|
}
|
|
3927
|
-
delete
|
|
4565
|
+
wasRemoved = absolutePath in cache5, delete cache5[absolutePath];
|
|
3928
4566
|
} else
|
|
3929
|
-
|
|
3930
|
-
this.lastIndex = null, this.lastError = null, this.
|
|
4567
|
+
added = !(absolutePath in cache5), cache5[absolutePath] = !1;
|
|
4568
|
+
this.lastIndex = null, this.lastError = null, this.lastPartialIndex = null;
|
|
4569
|
+
let event = { importPath, added, removed: wasRemoved };
|
|
4570
|
+
this.invalidationListeners.forEach((listener) => listener(event));
|
|
3931
4571
|
}
|
|
3932
4572
|
onInvalidated(listener) {
|
|
3933
4573
|
return this.invalidationListeners.add(listener), () => {
|
|
@@ -3935,14 +4575,14 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3935
4575
|
};
|
|
3936
4576
|
}
|
|
3937
4577
|
async getPreviewCode() {
|
|
3938
|
-
let previewFile = ["js", "jsx", "ts", "tsx", "mjs", "cjs", "mts"].map((ext) =>
|
|
3939
|
-
return previewFile && (await
|
|
4578
|
+
let previewFile = ["js", "jsx", "ts", "tsx", "mjs", "cjs", "mts"].map((ext) => join12(this.options.configDir, `preview.${ext}`)).find((fname) => existsSync3(fname));
|
|
4579
|
+
return previewFile && (await readFile6(previewFile, { encoding: "utf8" })).toString();
|
|
3940
4580
|
}
|
|
3941
4581
|
getProjectTags(previewCode) {
|
|
3942
4582
|
let projectTags = [], defaultTags = [Tag.DEV, Tag.TEST, Tag.MANIFEST];
|
|
3943
4583
|
if (previewCode)
|
|
3944
4584
|
try {
|
|
3945
|
-
let projectAnnotations =
|
|
4585
|
+
let projectAnnotations = loadConfig2(previewCode).parse(), tags = projectAnnotations.getValue(["tags"]) ?? [];
|
|
3946
4586
|
invariant(
|
|
3947
4587
|
!projectAnnotations.mutationDiagnostics.some(
|
|
3948
4588
|
({ code }) => code === "unsupported-value"
|
|
@@ -3950,7 +4590,7 @@ var makeAbsolute = (otherImport, normalizedPath, workingDir) => otherImport.star
|
|
|
3950
4590
|
"Preview tags must be a static array of strings"
|
|
3951
4591
|
), projectTags = tags;
|
|
3952
4592
|
} catch {
|
|
3953
|
-
|
|
4593
|
+
once2.warn(dedent8`
|
|
3954
4594
|
Unable to parse tags from project configuration. If defined, tags should be specified inline, e.g.
|
|
3955
4595
|
|
|
3956
4596
|
export default {
|
|
@@ -4032,7 +4672,7 @@ var getStoriesPathsFromConfig = async ({
|
|
|
4032
4672
|
workingDir,
|
|
4033
4673
|
!0
|
|
4034
4674
|
)).flatMap(
|
|
4035
|
-
([specifier,
|
|
4675
|
+
([specifier, cache5]) => StoryIndexGenerator.storyFileNames(/* @__PURE__ */ new Map([[specifier, cache5]]))
|
|
4036
4676
|
);
|
|
4037
4677
|
};
|
|
4038
4678
|
|
|
@@ -4065,7 +4705,7 @@ function createWorkerGatedStoryDocsProvider({
|
|
|
4065
4705
|
|
|
4066
4706
|
// src/shared/universal-store/mock.ts
|
|
4067
4707
|
import { Channel as Channel5 } from "@aussieljk/forkbook/internal/channels";
|
|
4068
|
-
import { dedent as
|
|
4708
|
+
import { dedent as dedent9 } from "ts-dedent";
|
|
4069
4709
|
var MockUniversalStore = class _MockUniversalStore extends UniversalStore {
|
|
4070
4710
|
constructor(options, testUtils) {
|
|
4071
4711
|
UniversalStore.isInternalConstructing = !0, super(
|
|
@@ -4074,13 +4714,14 @@ var MockUniversalStore = class _MockUniversalStore extends UniversalStore {
|
|
|
4074
4714
|
), UniversalStore.isInternalConstructing = !1, typeof testUtils?.fn == "function" && (this.testUtils = testUtils, this.getState = testUtils.fn(this.getState), this.setState = testUtils.fn(this.setState), this.subscribe = testUtils.fn(this.subscribe), this.onStateChange = testUtils.fn(this.onStateChange), this.send = testUtils.fn(this.send));
|
|
4075
4715
|
}
|
|
4076
4716
|
/** Create a mock universal store. This is just an alias for the constructor */
|
|
4717
|
+
// `State = any`: as in `UniversalStore.create`, a store made without a state type takes any state.
|
|
4077
4718
|
static create(options, testUtils) {
|
|
4078
4719
|
return new _MockUniversalStore(options, testUtils);
|
|
4079
4720
|
}
|
|
4080
4721
|
unsubscribeAll() {
|
|
4081
4722
|
if (!this.testUtils)
|
|
4082
4723
|
throw new Error(
|
|
4083
|
-
|
|
4724
|
+
dedent9`Cannot call unsubscribeAll on a store that does not have testUtils.
|
|
4084
4725
|
Please provide testUtils as the second argument when creating the store.`
|
|
4085
4726
|
);
|
|
4086
4727
|
let callReturnedUnsubscribeFn = (result) => {
|
|
@@ -4092,10 +4733,486 @@ var MockUniversalStore = class _MockUniversalStore extends UniversalStore {
|
|
|
4092
4733
|
this.subscribe.mock?.results.forEach(callReturnedUnsubscribeFn), this.onStateChange.mock?.results.forEach(callReturnedUnsubscribeFn);
|
|
4093
4734
|
}
|
|
4094
4735
|
};
|
|
4736
|
+
|
|
4737
|
+
// src/core-server/utils/ghost-stories/get-candidates.ts
|
|
4738
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
4739
|
+
import { babelParse, traverse } from "@aussieljk/forkbook/internal/babel";
|
|
4740
|
+
|
|
4741
|
+
// src/core-server/utils/ghost-stories/component-analyzer.ts
|
|
4742
|
+
var COMPLEXITY_CONFIG = {
|
|
4743
|
+
/** Weight applied to non-empty lines */
|
|
4744
|
+
locWeight: 1,
|
|
4745
|
+
/** Imports can be cheap, so they get a lower weight */
|
|
4746
|
+
importWeight: 0.5,
|
|
4747
|
+
/**
|
|
4748
|
+
* Defines what raw complexity value should map to the upper bound of a "simple" file For instance
|
|
4749
|
+
* 30 LOC + 4 imports = 32. This would result in a score of 0.3
|
|
4750
|
+
*/
|
|
4751
|
+
simpleBaseline: 32,
|
|
4752
|
+
simpleScore: 0.3
|
|
4753
|
+
}, getComponentComplexity = (fileContent) => {
|
|
4754
|
+
let lines = fileContent.split(`
|
|
4755
|
+
`), 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);
|
|
4756
|
+
return Math.min(normalizedScore, 1);
|
|
4757
|
+
};
|
|
4758
|
+
|
|
4759
|
+
// src/core-server/utils/ghost-stories/get-candidates.ts
|
|
4760
|
+
function isValidCandidate(source) {
|
|
4761
|
+
let ast = babelParse(source), hasJSX = !1, hasExport = !1;
|
|
4762
|
+
return traverse(ast, {
|
|
4763
|
+
JSXElement(path) {
|
|
4764
|
+
hasJSX = !0, hasExport && path.stop();
|
|
4765
|
+
},
|
|
4766
|
+
JSXFragment(path) {
|
|
4767
|
+
hasJSX = !0, hasExport && path.stop();
|
|
4768
|
+
},
|
|
4769
|
+
ExportNamedDeclaration(path) {
|
|
4770
|
+
hasExport = !0, hasJSX && path.stop();
|
|
4771
|
+
},
|
|
4772
|
+
ExportDefaultDeclaration(path) {
|
|
4773
|
+
hasExport = !0, hasJSX && path.stop();
|
|
4774
|
+
},
|
|
4775
|
+
ExportAllDeclaration(path) {
|
|
4776
|
+
hasExport = !0, hasJSX && path.stop();
|
|
4777
|
+
}
|
|
4778
|
+
}), hasJSX && hasExport;
|
|
4779
|
+
}
|
|
4780
|
+
async function getCandidatesForStorybook(files, sampleCount) {
|
|
4781
|
+
let simpleCandidates = [], analyzedCandidates = [];
|
|
4782
|
+
for (let file of files) {
|
|
4783
|
+
let source;
|
|
4784
|
+
try {
|
|
4785
|
+
if (source = await readFile7(file, "utf-8"), !isValidCandidate(source))
|
|
4786
|
+
continue;
|
|
4787
|
+
} catch {
|
|
4788
|
+
continue;
|
|
4789
|
+
}
|
|
4790
|
+
let complexity = getComponentComplexity(source);
|
|
4791
|
+
if (analyzedCandidates.push({ file, complexity }), complexity < 0.3 && (simpleCandidates.push({ file, complexity }), simpleCandidates.length >= sampleCount))
|
|
4792
|
+
break;
|
|
4793
|
+
}
|
|
4794
|
+
let selectedCandidates = [];
|
|
4795
|
+
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);
|
|
4796
|
+
let avgComplexity = selectedCandidates.length > 0 ? Number(
|
|
4797
|
+
(selectedCandidates.reduce((acc, curr) => acc + curr.complexity, 0) / selectedCandidates.length).toFixed(2)
|
|
4798
|
+
) : 0;
|
|
4799
|
+
return {
|
|
4800
|
+
candidates: selectedCandidates.map(({ file }) => file),
|
|
4801
|
+
analyzedCount: analyzedCandidates.length,
|
|
4802
|
+
avgComplexity
|
|
4803
|
+
};
|
|
4804
|
+
}
|
|
4805
|
+
async function getComponentCandidates({
|
|
4806
|
+
sampleSize = 20,
|
|
4807
|
+
globPattern = "**/*.{tsx,jsx}",
|
|
4808
|
+
cwd = process.cwd()
|
|
4809
|
+
} = {}) {
|
|
4810
|
+
let globMatchCount = 0;
|
|
4811
|
+
try {
|
|
4812
|
+
let files = [];
|
|
4813
|
+
if (files = await glob(globPattern, {
|
|
4814
|
+
cwd,
|
|
4815
|
+
absolute: !0,
|
|
4816
|
+
expandDirectories: !1,
|
|
4817
|
+
ignore: [
|
|
4818
|
+
"**/node_modules/**",
|
|
4819
|
+
"**/.git/**",
|
|
4820
|
+
"**/dist/**",
|
|
4821
|
+
"**/__mocks__/**",
|
|
4822
|
+
"**/build/**",
|
|
4823
|
+
"**/forkbook-static/**",
|
|
4824
|
+
"**/*.test.*",
|
|
4825
|
+
"**/*.d.*",
|
|
4826
|
+
"**/*.config.*",
|
|
4827
|
+
"**/*.spec.*",
|
|
4828
|
+
"**/*.stories.*",
|
|
4829
|
+
// skip example story files that come from the CLI
|
|
4830
|
+
"**/stories/{Button,Header,Page}.*",
|
|
4831
|
+
"**/stories/{button,header,page}.*"
|
|
4832
|
+
]
|
|
4833
|
+
}), globMatchCount = files.length, globMatchCount === 0)
|
|
4834
|
+
return {
|
|
4835
|
+
candidates: [],
|
|
4836
|
+
globMatchCount
|
|
4837
|
+
};
|
|
4838
|
+
let { analyzedCount, avgComplexity, candidates } = await getCandidatesForStorybook(
|
|
4839
|
+
files,
|
|
4840
|
+
sampleSize
|
|
4841
|
+
);
|
|
4842
|
+
return {
|
|
4843
|
+
analyzedCount,
|
|
4844
|
+
avgComplexity,
|
|
4845
|
+
candidates,
|
|
4846
|
+
globMatchCount
|
|
4847
|
+
};
|
|
4848
|
+
} catch {
|
|
4849
|
+
return {
|
|
4850
|
+
candidates: [],
|
|
4851
|
+
error: "Failed to find candidates",
|
|
4852
|
+
globMatchCount
|
|
4853
|
+
};
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
|
|
4857
|
+
// src/core-server/utils/ghost-stories/run-story-tests.ts
|
|
4858
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
4859
|
+
import { mkdir as mkdir5, readFile as readFile8 } from "node:fs/promises";
|
|
4860
|
+
import { executeCommand, resolvePathInStorybookCache as resolvePathInStorybookCache3 } from "@aussieljk/forkbook/internal/common";
|
|
4861
|
+
import { join as join13 } from "pathe";
|
|
4862
|
+
|
|
4863
|
+
// src/shared/utils/ecosystem-identifier.ts
|
|
4864
|
+
var STYLING_PACKAGES = [
|
|
4865
|
+
"postcss",
|
|
4866
|
+
"tailwindcss",
|
|
4867
|
+
"autoprefixer",
|
|
4868
|
+
"sass",
|
|
4869
|
+
"less",
|
|
4870
|
+
"styled-components",
|
|
4871
|
+
"@stylexjs/*",
|
|
4872
|
+
"bootstrap",
|
|
4873
|
+
"goober",
|
|
4874
|
+
"stylus",
|
|
4875
|
+
"jss",
|
|
4876
|
+
"linaria",
|
|
4877
|
+
"bulma",
|
|
4878
|
+
"aphrodite",
|
|
4879
|
+
"semantic-ui",
|
|
4880
|
+
"foundation-sites",
|
|
4881
|
+
"fela"
|
|
4882
|
+
], STATE_MANAGEMENT_PACKAGES = [
|
|
4883
|
+
"*redux*",
|
|
4884
|
+
"@reduxjs/*",
|
|
4885
|
+
"zustand",
|
|
4886
|
+
"jotai",
|
|
4887
|
+
"recoil",
|
|
4888
|
+
"mobx*",
|
|
4889
|
+
"valtio",
|
|
4890
|
+
"xstate",
|
|
4891
|
+
"@xstate/*",
|
|
4892
|
+
"effector",
|
|
4893
|
+
"effector-react",
|
|
4894
|
+
"easy-peasy"
|
|
4895
|
+
];
|
|
4896
|
+
var I18N_PACKAGES = ["*i18n*", "*intl", "@lingui/*"], ROUTER_PACKAGES = [
|
|
4897
|
+
"react-router",
|
|
4898
|
+
"react-router-dom",
|
|
4899
|
+
"react-easy-router",
|
|
4900
|
+
"@remix-run/router",
|
|
4901
|
+
"expo-router",
|
|
4902
|
+
"@tanstack/*-router",
|
|
4903
|
+
"wouter",
|
|
4904
|
+
"@reach/router"
|
|
4905
|
+
];
|
|
4906
|
+
function globToRegex(pattern) {
|
|
4907
|
+
let regexPattern = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
4908
|
+
return new RegExp(`^${regexPattern}$`);
|
|
4909
|
+
}
|
|
4910
|
+
function matchesPackagePattern(dependencyName, patterns) {
|
|
4911
|
+
return patterns.some((pattern) => globToRegex(pattern).test(dependencyName));
|
|
4912
|
+
}
|
|
4913
|
+
function isStateManagementPackage(dependencyName) {
|
|
4914
|
+
return matchesPackagePattern(dependencyName, STATE_MANAGEMENT_PACKAGES);
|
|
4915
|
+
}
|
|
4916
|
+
function isStylingPackage(dependencyName) {
|
|
4917
|
+
return matchesPackagePattern(dependencyName, STYLING_PACKAGES);
|
|
4918
|
+
}
|
|
4919
|
+
function isRouterPackage(dependencyName) {
|
|
4920
|
+
return matchesPackagePattern(dependencyName, ROUTER_PACKAGES);
|
|
4921
|
+
}
|
|
4922
|
+
function isI18nPackage(dependencyName) {
|
|
4923
|
+
return matchesPackagePattern(dependencyName, I18N_PACKAGES);
|
|
4924
|
+
}
|
|
4925
|
+
|
|
4926
|
+
// src/shared/utils/categorize-render-errors.ts
|
|
4927
|
+
var ERROR_CATEGORIES = {
|
|
4928
|
+
MISSING_PROVIDER: "MISSING_PROVIDER",
|
|
4929
|
+
MISSING_STATE_PROVIDER: "MISSING_STATE_PROVIDER",
|
|
4930
|
+
MISSING_ROUTER_PROVIDER: "MISSING_ROUTER_PROVIDER",
|
|
4931
|
+
MISSING_THEME_PROVIDER: "MISSING_THEME_PROVIDER",
|
|
4932
|
+
MISSING_TRANSLATION_PROVIDER: "MISSING_TRANSLATION_PROVIDER",
|
|
4933
|
+
MISSING_PORTAL_ROOT: "MISSING_PORTAL_ROOT",
|
|
4934
|
+
HOOK_USAGE_ERROR: "HOOK_USAGE_ERROR",
|
|
4935
|
+
MODULE_IMPORT_ERROR: "MODULE_IMPORT_ERROR",
|
|
4936
|
+
COMPONENT_RENDER_ERROR: "COMPONENT_RENDER_ERROR",
|
|
4937
|
+
SERVER_COMPONENTS_ERROR: "SERVER_COMPONENTS_ERROR",
|
|
4938
|
+
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
4939
|
+
// Vite related errors
|
|
4940
|
+
DYNAMIC_MODULE_IMPORT_ERROR: "DYNAMIC_MODULE_IMPORT_ERROR",
|
|
4941
|
+
// Vitest test run related errors
|
|
4942
|
+
TEST_FILE_IMPORT_ERROR: "TEST_FILE_IMPORT_ERROR"
|
|
4943
|
+
};
|
|
4944
|
+
function buildErrorContext(message, stack) {
|
|
4945
|
+
let normalizedMessage = message.toLowerCase(), normalizedStack = (stack ?? "").toLowerCase(), stackDeps = /* @__PURE__ */ new Set(), stackLines = normalizedStack.split(`
|
|
4946
|
+
`).filter(Boolean);
|
|
4947
|
+
for (let line of stackLines) {
|
|
4948
|
+
let depMatch = line.match(/\/deps\/([^:]+)\.js/);
|
|
4949
|
+
depMatch && stackDeps.add(depMatch[1]);
|
|
4950
|
+
}
|
|
4951
|
+
return {
|
|
4952
|
+
message,
|
|
4953
|
+
stack,
|
|
4954
|
+
normalizedMessage,
|
|
4955
|
+
normalizedStack,
|
|
4956
|
+
stackDeps
|
|
4957
|
+
};
|
|
4958
|
+
}
|
|
4959
|
+
var CATEGORIZATION_RULES = [
|
|
4960
|
+
{
|
|
4961
|
+
category: ERROR_CATEGORIES.MODULE_IMPORT_ERROR,
|
|
4962
|
+
priority: 100,
|
|
4963
|
+
match: (ctx) => ctx.normalizedMessage.includes("cannot find module") || ctx.normalizedMessage.includes("module not found") || ctx.normalizedMessage.includes("cannot resolve module")
|
|
4964
|
+
},
|
|
4965
|
+
{
|
|
4966
|
+
category: ERROR_CATEGORIES.TEST_FILE_IMPORT_ERROR,
|
|
4967
|
+
priority: 95,
|
|
4968
|
+
match: (ctx) => ctx.normalizedMessage.includes("failed to import test file")
|
|
4969
|
+
},
|
|
4970
|
+
{
|
|
4971
|
+
category: ERROR_CATEGORIES.DYNAMIC_MODULE_IMPORT_ERROR,
|
|
4972
|
+
priority: 95,
|
|
4973
|
+
match: (ctx) => ctx.normalizedMessage.includes("failed to fetch dynamically imported module")
|
|
4974
|
+
},
|
|
4975
|
+
{
|
|
4976
|
+
category: ERROR_CATEGORIES.HOOK_USAGE_ERROR,
|
|
4977
|
+
priority: 90,
|
|
4978
|
+
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")
|
|
4979
|
+
},
|
|
4980
|
+
{
|
|
4981
|
+
category: ERROR_CATEGORIES.MISSING_STATE_PROVIDER,
|
|
4982
|
+
priority: 85,
|
|
4983
|
+
match: (ctx) => Array.from(ctx.stackDeps).some(isStateManagementPackage) && (ctx.normalizedMessage.includes("context") || ctx.normalizedMessage.includes("undefined") || ctx.normalizedMessage.includes("null"))
|
|
4984
|
+
},
|
|
4985
|
+
{
|
|
4986
|
+
category: ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER,
|
|
4987
|
+
priority: 85,
|
|
4988
|
+
match: (ctx) => Array.from(ctx.stackDeps).some(isRouterPackage) || ctx.normalizedMessage.includes("usenavigate") || ctx.normalizedMessage.includes("router")
|
|
4989
|
+
},
|
|
4990
|
+
{
|
|
4991
|
+
category: ERROR_CATEGORIES.SERVER_COMPONENTS_ERROR,
|
|
4992
|
+
priority: 85,
|
|
4993
|
+
match: (ctx) => ctx.normalizedMessage.includes("server components") || ctx.normalizedMessage.includes("use client") || ctx.normalizedMessage.includes("async/await") && ctx.normalizedMessage.includes("not supported")
|
|
4994
|
+
},
|
|
4995
|
+
{
|
|
4996
|
+
category: ERROR_CATEGORIES.MISSING_THEME_PROVIDER,
|
|
4997
|
+
priority: 80,
|
|
4998
|
+
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")
|
|
4999
|
+
},
|
|
5000
|
+
{
|
|
5001
|
+
category: ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER,
|
|
5002
|
+
priority: 80,
|
|
5003
|
+
match: (ctx) => Array.from(ctx.stackDeps).some(isI18nPackage) || ctx.normalizedMessage.includes("i18n") || ctx.normalizedMessage.includes("translation") || ctx.normalizedMessage.includes("locale")
|
|
5004
|
+
},
|
|
5005
|
+
{
|
|
5006
|
+
category: ERROR_CATEGORIES.MISSING_PORTAL_ROOT,
|
|
5007
|
+
priority: 70,
|
|
5008
|
+
match: (ctx) => ctx.normalizedMessage.includes("target container is not a dom element") || ctx.normalizedMessage.includes("portal") && (ctx.normalizedMessage.includes("container") || ctx.normalizedMessage.includes("root"))
|
|
5009
|
+
},
|
|
5010
|
+
{
|
|
5011
|
+
category: ERROR_CATEGORIES.MISSING_PROVIDER,
|
|
5012
|
+
priority: 60,
|
|
5013
|
+
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"))
|
|
5014
|
+
},
|
|
5015
|
+
{
|
|
5016
|
+
category: ERROR_CATEGORIES.COMPONENT_RENDER_ERROR,
|
|
5017
|
+
priority: 10,
|
|
5018
|
+
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")
|
|
5019
|
+
}
|
|
5020
|
+
], RULES = CATEGORIZATION_RULES.sort((a, b) => b.priority - a.priority);
|
|
5021
|
+
function categorizeError(message, stack) {
|
|
5022
|
+
let ctx = buildErrorContext(message, stack), rule = RULES.find((r) => r.match(ctx));
|
|
5023
|
+
if (!rule)
|
|
5024
|
+
return { category: ERROR_CATEGORIES.UNKNOWN_ERROR, matchedDependencies: [] };
|
|
5025
|
+
let matchedDependencies = getMatchedDependencies(rule.category, ctx);
|
|
5026
|
+
return { category: rule.category, matchedDependencies };
|
|
5027
|
+
}
|
|
5028
|
+
function getMatchedDependencies(category, ctx) {
|
|
5029
|
+
switch (category) {
|
|
5030
|
+
case ERROR_CATEGORIES.MISSING_STATE_PROVIDER:
|
|
5031
|
+
return Array.from(ctx.stackDeps).filter(isStateManagementPackage);
|
|
5032
|
+
case ERROR_CATEGORIES.MISSING_ROUTER_PROVIDER:
|
|
5033
|
+
return Array.from(ctx.stackDeps).filter(isRouterPackage);
|
|
5034
|
+
case ERROR_CATEGORIES.MISSING_THEME_PROVIDER:
|
|
5035
|
+
return Array.from(ctx.stackDeps).filter(isStylingPackage);
|
|
5036
|
+
case ERROR_CATEGORIES.MISSING_TRANSLATION_PROVIDER:
|
|
5037
|
+
return Array.from(ctx.stackDeps).filter(isI18nPackage);
|
|
5038
|
+
default:
|
|
5039
|
+
return [];
|
|
5040
|
+
}
|
|
5041
|
+
}
|
|
5042
|
+
|
|
5043
|
+
// src/shared/utils/analyze-test-results.ts
|
|
5044
|
+
function extractCategorizedErrors(testResults) {
|
|
5045
|
+
let failed = testResults.filter((r) => r.status === "FAIL" && r.error), map = /* @__PURE__ */ new Map(), uniqueErrorMessages = /* @__PURE__ */ new Set();
|
|
5046
|
+
for (let r of failed) {
|
|
5047
|
+
let { category, matchedDependencies } = categorizeError(r.error, r.stack);
|
|
5048
|
+
map.has(category) || map.set(category, { count: 0, uniqueErrors: /* @__PURE__ */ new Set(), matchedDependencies: /* @__PURE__ */ new Set() });
|
|
5049
|
+
let data = map.get(category);
|
|
5050
|
+
data.count++, matchedDependencies.forEach((dep) => data.matchedDependencies.add(dep)), uniqueErrorMessages.add(r.error), data.uniqueErrors.add(r.error);
|
|
5051
|
+
}
|
|
5052
|
+
let categorizedErrors = Array.from(map.entries()).reduce(
|
|
5053
|
+
(acc, [category, data]) => (acc[category] = {
|
|
5054
|
+
uniqueCount: data.uniqueErrors.size,
|
|
5055
|
+
count: data.count,
|
|
5056
|
+
matchedDependencies: Array.from(data.matchedDependencies).sort()
|
|
5057
|
+
}, acc),
|
|
5058
|
+
{}
|
|
5059
|
+
);
|
|
5060
|
+
return {
|
|
5061
|
+
totalErrors: failed.length,
|
|
5062
|
+
uniqueErrorCount: uniqueErrorMessages.size,
|
|
5063
|
+
categorizedErrors
|
|
5064
|
+
};
|
|
5065
|
+
}
|
|
5066
|
+
var CSS_CHECK_STORY_ID_SUFFIX = "--css-check";
|
|
5067
|
+
function summarizeResults(results) {
|
|
5068
|
+
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(
|
|
5069
|
+
(r) => r.storyId.toLowerCase().endsWith(CSS_CHECK_STORY_ID_SUFFIX)
|
|
5070
|
+
), cssCheck = cssCheckMatch?.status === "PASS" ? "pass" : cssCheckMatch?.status === "FAIL" ? "fail" : "not-run";
|
|
5071
|
+
return {
|
|
5072
|
+
total,
|
|
5073
|
+
passed,
|
|
5074
|
+
passedButEmptyRender,
|
|
5075
|
+
successRate,
|
|
5076
|
+
successRateWithoutEmptyRender,
|
|
5077
|
+
uniqueErrorCount: errorClassification.uniqueErrorCount,
|
|
5078
|
+
categorizedErrors: errorClassification.categorizedErrors,
|
|
5079
|
+
cssCheck
|
|
5080
|
+
};
|
|
5081
|
+
}
|
|
5082
|
+
function analyzeTestResults(results, cumulativeResults) {
|
|
5083
|
+
let run = summarizeResults(results), analysis = {
|
|
5084
|
+
total: run.total,
|
|
5085
|
+
passed: run.passed,
|
|
5086
|
+
passedButEmptyRender: run.passedButEmptyRender,
|
|
5087
|
+
successRate: run.successRate,
|
|
5088
|
+
successRateWithoutEmptyRender: run.successRateWithoutEmptyRender,
|
|
5089
|
+
uniqueErrorCount: run.uniqueErrorCount,
|
|
5090
|
+
categorizedErrors: run.categorizedErrors,
|
|
5091
|
+
cssCheck: run.cssCheck
|
|
5092
|
+
};
|
|
5093
|
+
if (cumulativeResults) {
|
|
5094
|
+
let cumulative = summarizeResults(cumulativeResults);
|
|
5095
|
+
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;
|
|
5096
|
+
}
|
|
5097
|
+
return analysis;
|
|
5098
|
+
}
|
|
5099
|
+
|
|
5100
|
+
// src/shared/utils/to-story-test-result.ts
|
|
5101
|
+
var DEBUG_BANNER_RE = /^\n(?:\x1B\[\d+m)?Click to debug\b[^\n]*\n\n/;
|
|
5102
|
+
function extractErrorMessage(message, stack) {
|
|
5103
|
+
return (message ?? "").replace(DEBUG_BANNER_RE, "").split(`
|
|
5104
|
+
`)[0] || stack?.split(`
|
|
5105
|
+
`)[0] || "unknown error";
|
|
5106
|
+
}
|
|
5107
|
+
function detectEmptyRender(reports) {
|
|
5108
|
+
return reports?.some(
|
|
5109
|
+
(report) => report.type === "render-analysis" && report.result?.emptyRender === !0
|
|
5110
|
+
) ?? !1;
|
|
5111
|
+
}
|
|
5112
|
+
function normalizeStatus(statusRaw) {
|
|
5113
|
+
return statusRaw === "passed" ? "PASS" : statusRaw === "failed" ? "FAIL" : "PENDING";
|
|
5114
|
+
}
|
|
5115
|
+
function toStoryTestResult(input) {
|
|
5116
|
+
if (!input.storyId)
|
|
5117
|
+
return null;
|
|
5118
|
+
let status = normalizeStatus(input.statusRaw), emptyRender = status === "PASS" && detectEmptyRender(input.reports), error, stack;
|
|
5119
|
+
if (input.errors && input.errors.length > 0) {
|
|
5120
|
+
let firstError = input.errors[0];
|
|
5121
|
+
error = extractErrorMessage(firstError.message, firstError.stack), stack = firstError.stack ?? firstError.message;
|
|
5122
|
+
}
|
|
5123
|
+
return {
|
|
5124
|
+
storyId: input.storyId,
|
|
5125
|
+
status,
|
|
5126
|
+
error,
|
|
5127
|
+
stack,
|
|
5128
|
+
emptyRender: emptyRender || void 0
|
|
5129
|
+
};
|
|
5130
|
+
}
|
|
5131
|
+
|
|
5132
|
+
// src/core-server/utils/ghost-stories/parse-vitest-report.ts
|
|
5133
|
+
function parseVitestResults(report) {
|
|
5134
|
+
let storyTestResults = [];
|
|
5135
|
+
for (let testSuite of report.testResults)
|
|
5136
|
+
for (let assertion of testSuite.assertionResults) {
|
|
5137
|
+
let result = toStoryTestResult({
|
|
5138
|
+
storyId: assertion.meta?.storyId ?? assertion.fullName,
|
|
5139
|
+
statusRaw: assertion.status,
|
|
5140
|
+
reports: assertion.meta?.reports,
|
|
5141
|
+
errors: assertion.failureMessages?.map((message) => ({ stack: message }))
|
|
5142
|
+
});
|
|
5143
|
+
result && storyTestResults.push(result);
|
|
5144
|
+
}
|
|
5145
|
+
return {
|
|
5146
|
+
summary: analyzeTestResults(storyTestResults)
|
|
5147
|
+
};
|
|
5148
|
+
}
|
|
5149
|
+
|
|
5150
|
+
// src/core-server/utils/ghost-stories/run-story-tests.ts
|
|
5151
|
+
async function runStoryTests(componentFilePaths, options) {
|
|
5152
|
+
let cwd = options?.cwd;
|
|
5153
|
+
try {
|
|
5154
|
+
let cacheDir = resolvePathInStorybookCache3("story-tests");
|
|
5155
|
+
await mkdir5(cacheDir, { recursive: !0 });
|
|
5156
|
+
let timestamp = Date.now(), outputFile = join13(cacheDir, `test-results-${timestamp}.json`), startTime = Date.now(), testFailureMessage;
|
|
5157
|
+
try {
|
|
5158
|
+
await executeCommand({
|
|
5159
|
+
command: "npx",
|
|
5160
|
+
args: [
|
|
5161
|
+
"vitest",
|
|
5162
|
+
"run",
|
|
5163
|
+
"--reporter=json",
|
|
5164
|
+
"--testTimeout=1000",
|
|
5165
|
+
`--outputFile=${outputFile}`,
|
|
5166
|
+
...componentFilePaths
|
|
5167
|
+
],
|
|
5168
|
+
cwd,
|
|
5169
|
+
stdio: "pipe",
|
|
5170
|
+
env: {
|
|
5171
|
+
FORKBOOK_INTERNAL_TEST_RUN: "1",
|
|
5172
|
+
...options?.ghostRun ? { FORKBOOK_COMPONENT_PATHS: componentFilePaths.join(";") } : {}
|
|
5173
|
+
}
|
|
5174
|
+
});
|
|
5175
|
+
} catch (error) {
|
|
5176
|
+
let errorMessage = (error.stderr || String(error) || "").toLowerCase();
|
|
5177
|
+
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");
|
|
5178
|
+
}
|
|
5179
|
+
let duration = Date.now() - startTime;
|
|
5180
|
+
if (testFailureMessage)
|
|
5181
|
+
return {
|
|
5182
|
+
duration,
|
|
5183
|
+
runError: testFailureMessage
|
|
5184
|
+
};
|
|
5185
|
+
if (!existsSync4(outputFile))
|
|
5186
|
+
return {
|
|
5187
|
+
duration,
|
|
5188
|
+
runError: "JSON report not found"
|
|
5189
|
+
};
|
|
5190
|
+
let vitestReport;
|
|
5191
|
+
try {
|
|
5192
|
+
let resultsJson = await readFile8(outputFile, "utf8");
|
|
5193
|
+
vitestReport = JSON.parse(resultsJson);
|
|
5194
|
+
} catch {
|
|
5195
|
+
return {
|
|
5196
|
+
duration,
|
|
5197
|
+
runError: "Failed to read or parse JSON report"
|
|
5198
|
+
};
|
|
5199
|
+
}
|
|
5200
|
+
return !vitestReport.testResults || vitestReport.testResults.length === 0 ? {
|
|
5201
|
+
duration,
|
|
5202
|
+
runError: "No tests found"
|
|
5203
|
+
} : { ...parseVitestResults(vitestReport), duration };
|
|
5204
|
+
} catch {
|
|
5205
|
+
return {
|
|
5206
|
+
runError: "Uncaught error running story tests",
|
|
5207
|
+
duration: 0
|
|
5208
|
+
};
|
|
5209
|
+
}
|
|
5210
|
+
}
|
|
4095
5211
|
export {
|
|
4096
5212
|
ChangeDetectionFailureError,
|
|
4097
5213
|
ChangeDetectionService,
|
|
4098
5214
|
ChangeDetectionUnavailableError,
|
|
5215
|
+
DEFAULT_STATIC_OUTPUT_DIR,
|
|
4099
5216
|
MDX_SERVICE_ID,
|
|
4100
5217
|
StoryIndexGenerator,
|
|
4101
5218
|
Tag,
|
|
@@ -4156,6 +5273,7 @@ export {
|
|
|
4156
5273
|
registerToolset,
|
|
4157
5274
|
resolveChangeDetectionAdapter,
|
|
4158
5275
|
resolveSkillInputs,
|
|
5276
|
+
resolveStaticOutputDir,
|
|
4159
5277
|
reviewToolset,
|
|
4160
5278
|
runStoryTests,
|
|
4161
5279
|
sendTelemetryError,
|