@aussieljk/forkbook 0.0.0-stage → 0.0.1-2
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 +22 -0
- package/README.md +77 -2
- package/assets/addon-vitest/templates/vitest.config.4.template.ts +36 -0
- package/assets/browser/favicon-wrapper.svg +46 -0
- package/assets/browser/favicon.svg +1 -0
- 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/assets/builder-vite/iframe.html +99 -0
- package/assets/create/rendererAssets/.eslintrc.json +16 -0
- package/assets/create/rendererAssets/common/Configure.mdx +388 -0
- package/assets/create/rendererAssets/common/assets/accessibility.png +0 -0
- package/assets/create/rendererAssets/common/assets/accessibility.svg +1 -0
- package/assets/create/rendererAssets/common/assets/addon-library.png +0 -0
- package/assets/create/rendererAssets/common/assets/assets.png +0 -0
- package/assets/create/rendererAssets/common/assets/avif-test-image.avif +0 -0
- package/assets/create/rendererAssets/common/assets/context.png +0 -0
- package/assets/create/rendererAssets/common/assets/discord.svg +1 -0
- package/assets/create/rendererAssets/common/assets/docs.png +0 -0
- package/assets/create/rendererAssets/common/assets/figma-plugin.png +0 -0
- package/assets/create/rendererAssets/common/assets/github.svg +1 -0
- package/assets/create/rendererAssets/common/assets/share.png +0 -0
- package/assets/create/rendererAssets/common/assets/styling.png +0 -0
- package/assets/create/rendererAssets/common/assets/testing.png +0 -0
- package/assets/create/rendererAssets/common/assets/theming.png +0 -0
- package/assets/create/rendererAssets/common/assets/tutorials.svg +1 -0
- package/assets/create/rendererAssets/common/assets/youtube.svg +1 -0
- package/assets/create/rendererAssets/common/button.css +30 -0
- package/assets/create/rendererAssets/common/header.css +32 -0
- package/assets/create/rendererAssets/common/page.css +68 -0
- package/assets/create/templates/react-native/index.expo.js +20 -0
- package/assets/create/templates/react-native/index.js +25 -0
- package/assets/docs/addon-backgrounds.gif +0 -0
- package/assets/docs/addon-controls-args-annotated.png +0 -0
- package/assets/docs/addon-controls-args-background-color.png +0 -0
- package/assets/docs/addon-controls-args-background-string.png +0 -0
- package/assets/docs/addon-controls-args-docs.png +0 -0
- package/assets/docs/addon-controls-args-logging.png +0 -0
- package/assets/docs/addon-controls-args-no-annotation.png +0 -0
- package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
- package/assets/docs/addon-controls-args-reflow.png +0 -0
- package/assets/docs/addon-controls-args-template.png +0 -0
- package/assets/docs/addon-controls-expanded.png +0 -0
- package/assets/docs/addon-controls-hero.gif +0 -0
- package/assets/docs/addon-controls-install.png +0 -0
- package/assets/docs/hero.gif +0 -0
- package/assets/docs/highlight.png +0 -0
- package/assets/docs/message-reference.png +0 -0
- package/assets/docs/viewport.png +0 -0
- package/assets/react-native/metro-env.d.ts +69 -0
- package/assets/server/addon.tsconfig.json +6 -0
- package/assets/server/base-preview-body.html +116 -0
- package/assets/server/base-preview-head.html +494 -0
- package/assets/server/openBrowser.applescript +94 -0
- package/assets/server/template.ejs +87 -0
- package/dist/.build-stamp +0 -0
- package/dist/_browser-chunks/Color-PCLE2J36.js +1025 -0
- package/dist/_browser-chunks/DocsRenderer-JXND3PVQ.js +10 -0
- package/dist/_browser-chunks/WithTooltip-XSQFTBMB.js +1619 -0
- package/dist/_browser-chunks/chunk-2JDQ35OA.js +247 -0
- package/dist/_browser-chunks/chunk-2JT76G3E.js +104 -0
- package/dist/_browser-chunks/chunk-2MEPHP35.js +17 -0
- package/dist/_browser-chunks/chunk-2SCZVUKW.js +24 -0
- package/dist/_browser-chunks/chunk-46Z7NGAS.js +41 -0
- package/dist/_browser-chunks/chunk-4ATQOMJB.js +30 -0
- package/dist/_browser-chunks/chunk-52CW7FF7.js +49 -0
- package/dist/_browser-chunks/chunk-5I7E4GMO.js +62 -0
- package/dist/_browser-chunks/chunk-5P4QA6MY.js +20 -0
- package/dist/_browser-chunks/chunk-5WMXI5GW.js +816 -0
- package/dist/_browser-chunks/chunk-66OCZ54D.js +2604 -0
- package/dist/_browser-chunks/chunk-6SXYJQST.js +253 -0
- package/dist/_browser-chunks/chunk-AYRF6EJB.js +36 -0
- package/dist/_browser-chunks/chunk-B4AUNNU4.js +156 -0
- package/dist/_browser-chunks/chunk-BCP2FFXF.js +369 -0
- package/dist/_browser-chunks/chunk-C3D4HEFY.js +3396 -0
- package/dist/_browser-chunks/chunk-CFAOWGL7.js +43 -0
- package/dist/_browser-chunks/chunk-CFWWCCZV.js +223 -0
- package/dist/_browser-chunks/chunk-CNED6RYH.js +18 -0
- package/dist/_browser-chunks/chunk-DRQKCCAG.js +136 -0
- package/dist/_browser-chunks/chunk-ECQ75MKQ.js +0 -0
- package/dist/_browser-chunks/chunk-EIYAKDGP.js +302 -0
- package/dist/_browser-chunks/chunk-ENKK74N4.js +12 -0
- package/dist/_browser-chunks/chunk-FENFYI4X.js +698 -0
- package/dist/_browser-chunks/chunk-FJGWSWL5.js +155 -0
- package/dist/_browser-chunks/chunk-FVSEPWWX.js +2810 -0
- package/dist/_browser-chunks/chunk-GNZY6LOW.js +10116 -0
- package/dist/_browser-chunks/chunk-IE4ULIOQ.js +14 -0
- package/dist/_browser-chunks/chunk-IMSF75WX.js +42 -0
- package/dist/_browser-chunks/chunk-IWQGIXJS.js +14 -0
- package/dist/_browser-chunks/chunk-JMC7AIKT.js +108 -0
- package/dist/_browser-chunks/chunk-JPUOQJUI.js +8 -0
- package/dist/_browser-chunks/chunk-JSBKXXXF.js +218 -0
- package/dist/_browser-chunks/chunk-JWSKPMPC.js +73 -0
- package/dist/_browser-chunks/chunk-JYVGARBG.js +2943 -0
- package/dist/_browser-chunks/chunk-KBK7GKBN.js +35 -0
- package/dist/_browser-chunks/chunk-KQ7CRO2B.js +108 -0
- package/dist/_browser-chunks/chunk-LAWXTSXK.js +18 -0
- package/dist/_browser-chunks/chunk-LE2LTDW3.js +14 -0
- package/dist/_browser-chunks/chunk-LEVSOOLQ.js +48 -0
- package/dist/_browser-chunks/chunk-LV5PIKV4.js +93 -0
- package/dist/_browser-chunks/chunk-MDOL7KML.js +56 -0
- package/dist/_browser-chunks/chunk-MFMDGWP6.js +34 -0
- package/dist/_browser-chunks/chunk-MLBOOZL4.js +67 -0
- package/dist/_browser-chunks/chunk-NQUD4B7H.js +91 -0
- package/dist/_browser-chunks/chunk-NULBREPZ.js +43 -0
- package/dist/_browser-chunks/chunk-NZMVUW5T.js +7 -0
- package/dist/_browser-chunks/chunk-OD6IBQCC.js +117 -0
- package/dist/_browser-chunks/chunk-ODVJ3XZJ.js +157 -0
- package/dist/_browser-chunks/chunk-OQWFVDIN.js +386 -0
- package/dist/_browser-chunks/chunk-OVH3USFB.js +20 -0
- package/dist/_browser-chunks/chunk-OZZPSYQR.js +14 -0
- package/dist/_browser-chunks/chunk-P6PK47TQ.js +1970 -0
- package/dist/_browser-chunks/chunk-PFRNG3UC.js +22 -0
- package/dist/_browser-chunks/chunk-PJSMZ27A.js +13 -0
- package/dist/_browser-chunks/chunk-QC4HFS6K.js +41 -0
- package/dist/_browser-chunks/chunk-QDXFODK4.js +274 -0
- package/dist/_browser-chunks/chunk-RBCHTR7C.js +28 -0
- package/dist/_browser-chunks/chunk-RMYQ3QN3.js +294 -0
- package/dist/_browser-chunks/chunk-RNTIV5CE.js +411 -0
- package/dist/_browser-chunks/chunk-RSPAQWVJ.js +80 -0
- package/dist/_browser-chunks/chunk-S6TK43XQ.js +836 -0
- package/dist/_browser-chunks/chunk-SC67XZST.js +18 -0
- package/dist/_browser-chunks/chunk-SFVA4SBT.js +683 -0
- package/dist/_browser-chunks/chunk-SZYFOQMT.js +25 -0
- package/dist/_browser-chunks/chunk-TBJCJXK4.js +18 -0
- package/dist/_browser-chunks/chunk-UMDO3KB7.js +205 -0
- package/dist/_browser-chunks/chunk-V2G23FV7.js +11 -0
- package/dist/_browser-chunks/chunk-V5M7Q4HT.js +88 -0
- package/dist/_browser-chunks/chunk-W5M6NPS3.js +198 -0
- package/dist/_browser-chunks/chunk-W7NE2JXW.js +84 -0
- package/dist/_browser-chunks/chunk-WGVAAM43.js +1110 -0
- package/dist/_browser-chunks/chunk-WHQRNHXD.js +8 -0
- package/dist/_browser-chunks/chunk-WOSOWBCA.js +12 -0
- package/dist/_browser-chunks/chunk-WZ7KR7SH.js +85 -0
- package/dist/_browser-chunks/chunk-YEKO6BHJ.js +20 -0
- package/dist/_browser-chunks/chunk-YI2IBIQS.js +7 -0
- package/dist/_browser-chunks/chunk-YTIT5NA5.js +1966 -0
- package/dist/_browser-chunks/chunk-ZEHRUHTA.js +6 -0
- package/dist/_browser-chunks/chunk-ZTQ5MEJ5.js +203 -0
- package/dist/_browser-chunks/matchers-YLBYSYAF.js +1263 -0
- package/dist/_browser-chunks/react-dom-client-4OHE3QDV.js +9 -0
- package/dist/_node-chunks/attached-runtime-I2G4WLJI.js +282 -0
- package/dist/_node-chunks/builder-manager-VVHYQXCH.js +1661 -0
- package/dist/_node-chunks/chunk-2BUPBPFB.js +82 -0
- package/dist/_node-chunks/chunk-2DSIDINN.js +884 -0
- package/dist/_node-chunks/chunk-2RU7BKEW.js +23 -0
- package/dist/_node-chunks/chunk-34EO2PUT.js +26 -0
- package/dist/_node-chunks/chunk-3BKIBF5S.js +3008 -0
- package/dist/_node-chunks/chunk-3SDUYDXH.js +98 -0
- package/dist/_node-chunks/chunk-3T4ZSNPH.js +662 -0
- package/dist/_node-chunks/chunk-3W7F2B7P.js +79 -0
- package/dist/_node-chunks/chunk-3Y6AAY5H.js +80 -0
- package/dist/_node-chunks/chunk-42UWAGPW.js +1193 -0
- package/dist/_node-chunks/chunk-4FEANXWU.js +1986 -0
- package/dist/_node-chunks/chunk-5DQFEZEA.js +40 -0
- package/dist/_node-chunks/chunk-6KEHV53S.js +1218 -0
- package/dist/_node-chunks/chunk-6LMWA44H.js +3837 -0
- package/dist/_node-chunks/chunk-6YKBRP72.js +20 -0
- package/dist/_node-chunks/chunk-7GUDZVRQ.js +110 -0
- package/dist/_node-chunks/chunk-B5J7Q7J4.js +21 -0
- package/dist/_node-chunks/chunk-BS2WMZMR.js +90 -0
- package/dist/_node-chunks/chunk-BSKFCWQD.js +47 -0
- package/dist/_node-chunks/chunk-BXVYT7SB.js +36 -0
- package/dist/_node-chunks/chunk-CCOTJ4FC.js +688 -0
- package/dist/_node-chunks/chunk-CQKMLL5J.js +33 -0
- package/dist/_node-chunks/chunk-CXRU72ET.js +63 -0
- package/dist/_node-chunks/chunk-DC7DKR5K.js +20 -0
- package/dist/_node-chunks/chunk-DHJFTB4K.js +25 -0
- package/dist/_node-chunks/chunk-DUR55DJJ.js +1094 -0
- package/dist/_node-chunks/chunk-E6YESGLX.js +7032 -0
- package/dist/_node-chunks/chunk-EHUNOMDD.js +52345 -0
- package/dist/_node-chunks/chunk-ET7PWEO7.js +298 -0
- package/dist/_node-chunks/chunk-EWOX7HPJ.js +20 -0
- package/dist/_node-chunks/chunk-F3ZFKBHY.js +844 -0
- package/dist/_node-chunks/chunk-FK7KGTV7.js +26 -0
- package/dist/_node-chunks/chunk-FPZB5OI7.js +35 -0
- package/dist/_node-chunks/chunk-FW2HQUBQ.js +25 -0
- package/dist/_node-chunks/chunk-FY6UXW6G.js +11 -0
- package/dist/_node-chunks/chunk-GEFQN7K3.js +499 -0
- package/dist/_node-chunks/chunk-GRBLDJCR.js +989 -0
- package/dist/_node-chunks/chunk-H32DYT6P.js +87 -0
- package/dist/_node-chunks/chunk-H4PPVMP5.js +23 -0
- package/dist/_node-chunks/chunk-HMP2G23X.js +25 -0
- package/dist/_node-chunks/chunk-ICPBH3E7.js +59 -0
- package/dist/_node-chunks/chunk-IDEL2J23.js +23 -0
- package/dist/_node-chunks/chunk-IK4FGZLR.js +223 -0
- package/dist/_node-chunks/chunk-JDXXX6LB.js +68 -0
- package/dist/_node-chunks/chunk-JGGFYIG5.js +5468 -0
- package/dist/_node-chunks/chunk-JPAZLYJ3.js +29 -0
- package/dist/_node-chunks/chunk-JZOO7GGC.js +48 -0
- package/dist/_node-chunks/chunk-KISMCCP5.js +4744 -0
- package/dist/_node-chunks/chunk-LCK4ZQKG.js +115 -0
- package/dist/_node-chunks/chunk-LO56I6E2.js +132 -0
- package/dist/_node-chunks/chunk-LXBD4UL4.js +104 -0
- package/dist/_node-chunks/chunk-MA24JW6C.js +7162 -0
- package/dist/_node-chunks/chunk-MK2KYAI6.js +5414 -0
- package/dist/_node-chunks/chunk-NDWKJ4CL.js +2102 -0
- package/dist/_node-chunks/chunk-NIBT7XDZ.js +168 -0
- package/dist/_node-chunks/chunk-NPO45IMH.js +33 -0
- package/dist/_node-chunks/chunk-OISX4AGQ.js +414 -0
- package/dist/_node-chunks/chunk-OUW6R7C3.js +26 -0
- package/dist/_node-chunks/chunk-OWNFOGTA.js +194 -0
- package/dist/_node-chunks/chunk-Q7QNUM5H.js +49 -0
- package/dist/_node-chunks/chunk-QEQLR22M.js +1877 -0
- package/dist/_node-chunks/chunk-RRN2V55B.js +45 -0
- package/dist/_node-chunks/chunk-RWFIFGO5.js +144 -0
- package/dist/_node-chunks/chunk-RXNJDRGO.js +209 -0
- package/dist/_node-chunks/chunk-RZMQ7S3L.js +92 -0
- package/dist/_node-chunks/chunk-SIEXZVCR.js +51 -0
- package/dist/_node-chunks/chunk-SLWQNBGO.js +2034 -0
- package/dist/_node-chunks/chunk-SVTBJ7Q3.js +35 -0
- package/dist/_node-chunks/chunk-SWO5CDYU.js +32 -0
- package/dist/_node-chunks/chunk-TD5PLLQG.js +121 -0
- package/dist/_node-chunks/chunk-TEQGGSP7.js +33 -0
- package/dist/_node-chunks/chunk-TFCEV2XX.js +155 -0
- package/dist/_node-chunks/chunk-TFEWM4E3.js +1073 -0
- package/dist/_node-chunks/chunk-TINO74G5.js +21 -0
- package/dist/_node-chunks/chunk-TNJIXE37.js +40 -0
- package/dist/_node-chunks/chunk-TWI4GVH7.js +19 -0
- package/dist/_node-chunks/chunk-U5W53R2J.js +1011 -0
- package/dist/_node-chunks/chunk-UBOGWBEA.js +148 -0
- package/dist/_node-chunks/chunk-UMUBKI6E.js +3787 -0
- package/dist/_node-chunks/chunk-UVINFLGY.js +56 -0
- package/dist/_node-chunks/chunk-V2DY426G.js +1133 -0
- package/dist/_node-chunks/chunk-VLOXOXXE.js +45 -0
- package/dist/_node-chunks/chunk-W4OMYLSP.js +1297 -0
- package/dist/_node-chunks/chunk-WAXVSN3O.js +18 -0
- package/dist/_node-chunks/chunk-WCULS5TP.js +3767 -0
- package/dist/_node-chunks/chunk-WNZ2UMFM.js +153 -0
- package/dist/_node-chunks/chunk-WZJF2OUH.js +74 -0
- package/dist/_node-chunks/chunk-XGIUVY52.js +611 -0
- package/dist/_node-chunks/chunk-XHL2LVBM.js +415 -0
- package/dist/_node-chunks/chunk-XI6B6P47.js +59 -0
- package/dist/_node-chunks/chunk-XLP2ZKXV.js +60 -0
- package/dist/_node-chunks/chunk-YCMRA6RX.js +95 -0
- package/dist/_node-chunks/chunk-YZFWBA5L.js +2700 -0
- package/dist/_node-chunks/chunk-ZMAMXQKP.js +4731 -0
- package/dist/_node-chunks/chunk-ZWBCQ4MJ.js +110 -0
- package/dist/_node-chunks/dist-VTSTZKUB.js +16 -0
- package/dist/_node-chunks/globby-OEMHPBFY.js +2884 -0
- package/dist/_node-chunks/jiti-NFX6UU74.js +3848 -0
- package/dist/_node-chunks/lib-MDVARD7W.js +366 -0
- package/dist/_node-chunks/local-runtime-NTKIN2QT.js +78 -0
- package/dist/_node-chunks/mdx-plugin-MWISDWDQ.js +5680 -0
- package/dist/_node-chunks/monorepo-LIRFMQXE.js +121 -0
- package/dist/_node-chunks/monorepo-optimized-tests-relaxed-limits-no-story-deletion-CPDW4XTW.js +121 -0
- package/dist/_node-chunks/optimized-tests-HDOLR3EY.js +22 -0
- package/dist/_node-chunks/pattern-copy-play-EKHIUAU2.js +807 -0
- package/dist/_node-chunks/postinstallAddon-GYGMWDL6.js +20 -0
- package/dist/_node-chunks/rehype-external-links-BUN3HUCO.js +121 -0
- package/dist/_node-chunks/rehype-slug-PLADX223.js +52 -0
- package/dist/_node-chunks/relaxed-limits-GBHW6KIQ.js +117 -0
- package/dist/_node-chunks/run-KDTIZNSY.js +103 -0
- package/dist/_node-chunks/run-NL66VTNR.js +4532 -0
- package/dist/_node-chunks/session-id-KIIVOQLR.js +23 -0
- package/dist/_node-chunks/setup-MGC7BQO6.js +278 -0
- package/dist/_node-chunks/vitest.config.4.template-JH2THZFG.js +54 -0
- package/dist/actions/decorator.d.ts +7 -0
- package/dist/actions/decorator.js +43 -0
- package/dist/actions/index.d.ts +67 -0
- package/dist/actions/index.js +28 -0
- package/dist/addon-a11y/index.d.ts +52 -0
- package/dist/addon-a11y/index.js +16 -0
- package/dist/addon-a11y/manager.js +1429 -0
- package/dist/addon-a11y/preset.js +18 -0
- package/dist/addon-a11y/preview.d.ts +17 -0
- package/dist/addon-a11y/preview.js +15 -0
- package/dist/addon-docs/blocks.d.ts +1061 -0
- package/dist/addon-docs/blocks.js +2461 -0
- package/dist/addon-docs/index.d.ts +236 -0
- package/dist/addon-docs/index.js +16 -0
- package/dist/addon-docs/manager.js +90 -0
- package/dist/addon-docs/mdx-react-shim.d.ts +1 -0
- package/dist/addon-docs/mdx-react-shim.js +2 -0
- package/dist/addon-docs/preset.js +378 -0
- package/dist/addon-docs/preview.d.ts +4 -0
- package/dist/addon-docs/preview.js +7 -0
- package/dist/addon-links/index.d.ts +22 -0
- package/dist/addon-links/index.js +20 -0
- package/dist/addon-links/manager.js +14 -0
- package/dist/addon-links/preview.d.ts +6 -0
- package/dist/addon-links/preview.js +9 -0
- package/dist/addon-links/react/index.d.ts +25 -0
- package/dist/addon-links/react/index.js +52 -0
- package/dist/addon-mcp/preset.js +1345 -0
- package/dist/addon-mcp/preview.js +29 -0
- package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +1153 -0
- package/dist/addon-ondevice-actions/index.d.ts +4 -0
- package/dist/addon-ondevice-actions/index.js +7 -0
- package/dist/addon-ondevice-actions/register.js +7 -0
- package/dist/addon-ondevice-controls/index.d.ts +6 -0
- package/dist/addon-ondevice-controls/index.js +14 -0
- package/dist/addon-ondevice-controls/register.js +10 -0
- package/dist/addon-pseudo-states/index.d.ts +35 -0
- package/dist/addon-pseudo-states/index.js +15 -0
- package/dist/addon-pseudo-states/manager.js +53 -0
- package/dist/addon-pseudo-states/preview.d.ts +9 -0
- package/dist/addon-pseudo-states/preview.js +10 -0
- package/dist/addon-themes/index.d.ts +80 -0
- package/dist/addon-themes/index.js +104 -0
- package/dist/addon-themes/manager.js +97 -0
- package/dist/addon-themes/postinstall.js +33 -0
- package/dist/addon-themes/preview.d.ts +6 -0
- package/dist/addon-themes/preview.js +8 -0
- package/dist/addon-vitest/constants.d.ts +132 -0
- package/dist/addon-vitest/constants.js +66 -0
- package/dist/addon-vitest/index.d.ts +4 -0
- package/dist/addon-vitest/index.js +8 -0
- package/dist/addon-vitest/manager.js +665 -0
- package/dist/addon-vitest/node/coverage-reporter.js +1284 -0
- package/dist/addon-vitest/node/vitest.js +674 -0
- package/dist/addon-vitest/postinstall.js +24 -0
- package/dist/addon-vitest/preset.js +943 -0
- package/dist/addon-vitest/vitest-plugin/global-setup.js +162 -0
- package/dist/addon-vitest/vitest-plugin/index.d.ts +56 -0
- package/dist/addon-vitest/vitest-plugin/index.js +463 -0
- package/dist/addon-vitest/vitest-plugin/setup-file-with-project-annotations.js +9 -0
- package/dist/addon-vitest/vitest-plugin/setup-file.browser.4.js +20 -0
- package/dist/addon-vitest/vitest-plugin/setup-file.js +50 -0
- package/dist/addon-vitest/vitest-plugin/test-utils.js +128 -0
- package/dist/babel/index.d.ts +2301 -0
- package/dist/babel/index.js +61 -0
- package/dist/backgrounds/index.d.ts +6 -0
- package/dist/backgrounds/index.js +15 -0
- package/dist/bin/core.js +1705 -0
- package/dist/bin/dispatcher.js +43 -0
- package/dist/bin/loader.js +115 -0
- package/dist/builder-vite/index.d.ts +50 -0
- package/dist/builder-vite/index.js +245 -0
- package/dist/builder-vite/preset.js +27 -0
- package/dist/channels/index.d.ts +2 -0
- package/dist/channels/index.js +352 -0
- package/dist/chunk-B2t1tGRh.d.ts +284 -0
- package/dist/chunk-BCoJQE-f.d.ts +602 -0
- package/dist/chunk-BGkgZp-H.d.ts +214 -0
- package/dist/chunk-BTVrWliM.d.ts +115 -0
- package/dist/chunk-BXLImeLy.d.ts +197 -0
- package/dist/chunk-BfBzpgct.d.ts +916 -0
- package/dist/chunk-Bpi2tz-6.d.ts +511 -0
- package/dist/chunk-BxWufQms.d.ts +142 -0
- package/dist/chunk-C-bavsOH.d.ts +34 -0
- package/dist/chunk-C2p5r3Vt.d.ts +13001 -0
- package/dist/chunk-C6PAgHLT.d.ts +12 -0
- package/dist/chunk-CMeX4WRe.d.ts +179 -0
- package/dist/chunk-Ct9xd6IM.d.ts +65 -0
- package/dist/chunk-CwQKNaYL.d.ts +15 -0
- package/dist/chunk-D7DwV41f.d.ts +3622 -0
- package/dist/chunk-DEVFdzxR.d.ts +253 -0
- package/dist/chunk-DaVb55-_.d.ts +124 -0
- package/dist/chunk-DgRNfmj_.d.ts +40 -0
- package/dist/chunk-DoIGKY33.d.ts +666 -0
- package/dist/chunk-Dr3R0DXk.d.ts +40 -0
- package/dist/chunk-DtHByo32.d.ts +55 -0
- package/dist/chunk-Dw1z1Pki.d.ts +933 -0
- package/dist/chunk-DzuY9DXg.d.ts +79 -0
- package/dist/chunk-FjDVzZTj.d.ts +62 -0
- package/dist/chunk-Kt1tW-D1.d.ts +59 -0
- package/dist/chunk-XP8oHzpE.d.ts +6 -0
- package/dist/chunk-gCX81nOr.d.ts +61 -0
- package/dist/chunk-pcFXCimE.d.ts +741 -0
- package/dist/cli/index.d.ts +1174 -0
- package/dist/cli/index.js +5613 -0
- package/dist/cli/skills/content/index.d.ts +72 -0
- package/dist/cli/skills/content/index.js +335 -0
- package/dist/cli/tools/sdk/child-host.d.ts +61 -0
- package/dist/cli/tools/sdk/child-host.js +131 -0
- package/dist/cli/tools/sdk/index.d.ts +137 -0
- package/dist/cli/tools/sdk/index.js +44 -0
- package/dist/cli-commands/bin/index.js +25 -0
- package/dist/client-logger/index.d.ts +31 -0
- package/dist/client-logger/index.js +63 -0
- package/dist/common/index.d.ts +1103 -0
- package/dist/common/index.js +364 -0
- package/dist/components/index.d.ts +1924 -0
- package/dist/components/index.js +13759 -0
- package/dist/core-events/index.d.ts +155 -0
- package/dist/core-events/index.js +136 -0
- package/dist/core-server/index.d.ts +2200 -0
- package/dist/core-server/index.js +4165 -0
- package/dist/core-server/presets/common-manager.css +170 -0
- package/dist/core-server/presets/common-manager.js +4168 -0
- package/dist/core-server/presets/common-override-preset.js +81 -0
- package/dist/core-server/presets/common-preset.js +2187 -0
- package/dist/create/bin/index.js +23 -0
- package/dist/create/index.js +25 -0
- package/dist/csf/csf-utils.d.ts +2 -0
- package/dist/csf/csf-utils.js +19 -0
- package/dist/csf/index.d.ts +7 -0
- package/dist/csf/index.js +2142 -0
- package/dist/csf-tools/index.d.ts +1157 -0
- package/dist/csf-tools/index.js +736 -0
- package/dist/docs-tools/index.d.ts +197 -0
- package/dist/docs-tools/index.js +61 -0
- package/dist/highlight/index.d.ts +10 -0
- package/dist/highlight/index.js +15 -0
- package/dist/instrumenter/index.d.ts +113 -0
- package/dist/instrumenter/index.js +2595 -0
- package/dist/manager/_manager-chunks/globals-runtime-8HkdnU2F.js +6144 -0
- package/dist/manager/_manager-chunks/globals-runtime-BIKBO23x.js +3389 -0
- package/dist/manager/_manager-chunks/globals-runtime-BdGkqNEt.js +45 -0
- package/dist/manager/_manager-chunks/globals-runtime-BmphMP6z.js +1190 -0
- package/dist/manager/_manager-chunks/globals-runtime-BvM-NY2g.js +13307 -0
- package/dist/manager/_manager-chunks/globals-runtime-C02fvgcd.js +9243 -0
- package/dist/manager/_manager-chunks/globals-runtime-DkAPXCvc.js +9766 -0
- package/dist/manager/_manager-chunks/globals-runtime-DpNYC-qi.js +5564 -0
- package/dist/manager/_manager-chunks/globals-runtime-DtcOnYHR.js +5357 -0
- package/dist/manager/_manager-chunks/globals-runtime-DwFqpqya.js +722 -0
- package/dist/manager/_manager-chunks/globals-runtime-FC201B7s.js +6837 -0
- package/dist/manager/_manager-chunks/globals-runtime-Rp_zjGnh.js +121 -0
- package/dist/manager/_manager-chunks/globals-runtime-ZHrQFa3-.js +10463 -0
- package/dist/manager/_manager-chunks/globals-runtime-eLPTIfX-.js +7759 -0
- package/dist/manager/_manager-chunks/globals-runtime-qKvCZHFY.js +4468 -0
- package/dist/manager/_manager-chunks/globals-runtime-sGpNlIJ1.js +5102 -0
- package/dist/manager/_manager-chunks/runtime-B1L9TH89.js +452 -0
- package/dist/manager/_manager-chunks/runtime-BK0zF7FN.js +22 -0
- package/dist/manager/_manager-chunks/runtime-BhkT2CXl.js +1408 -0
- package/dist/manager/_manager-chunks/runtime-Bly6WJLN.js +998 -0
- package/dist/manager/_manager-chunks/runtime-D0UOWx0U.js +979 -0
- package/dist/manager/_manager-chunks/runtime-D94Vq3oR.js +4014 -0
- package/dist/manager/_manager-chunks/runtime-DMig8mT7.js +77 -0
- package/dist/manager/_manager-chunks/runtime-EITvVbkG.js +46 -0
- package/dist/manager/_manager-chunks/runtime-cp5pazY2.js +8936 -0
- package/dist/manager/_manager-chunks/runtime-eDVAYF7N.js +6860 -0
- package/dist/manager/_manager-chunks/runtime-i-PDAHLR.js +2493 -0
- package/dist/manager/globals-runtime.js +2 -0
- package/dist/manager/globals.d.ts +23 -0
- package/dist/manager/globals.js +26 -0
- package/dist/manager/manager-stores.d.ts +2 -0
- package/dist/manager/manager-stores.js +19 -0
- package/dist/manager/runtime.js +2 -0
- package/dist/manager-api/index.d.ts +2 -0
- package/dist/manager-api/index.js +3257 -0
- package/dist/manager-errors.d.ts +89 -0
- package/dist/manager-errors.js +20 -0
- package/dist/mcp/index.d.ts +270 -0
- package/dist/mcp/index.js +305 -0
- package/dist/mocking-utils/index.d.ts +689 -0
- package/dist/mocking-utils/index.js +521 -0
- package/dist/mocking-utils/mocker-runtime.js +1254 -0
- package/dist/nextjs-vite/config/preview.js +3 -0
- package/dist/nextjs-vite/export-mocks/cache/index.d.ts +25 -0
- package/dist/nextjs-vite/export-mocks/cache/index.js +29 -0
- package/dist/nextjs-vite/export-mocks/headers/index.d.ts +37 -0
- package/dist/nextjs-vite/export-mocks/headers/index.js +54 -0
- package/dist/nextjs-vite/export-mocks/link/index.d.ts +9 -0
- package/dist/nextjs-vite/export-mocks/link/index.js +59 -0
- package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +28 -0
- package/dist/nextjs-vite/export-mocks/navigation/index.js +58 -0
- package/dist/nextjs-vite/export-mocks/router/index.d.ts +34 -0
- package/dist/nextjs-vite/export-mocks/router/index.js +63 -0
- package/dist/nextjs-vite/index.d.ts +92 -0
- package/dist/nextjs-vite/index.js +58 -0
- package/dist/nextjs-vite/node/index.d.ts +6 -0
- package/dist/nextjs-vite/node/index.js +20 -0
- package/dist/nextjs-vite/preset.js +648 -0
- package/dist/nextjs-vite/preview.d.ts +20 -0
- package/dist/nextjs-vite/preview.js +11 -0
- package/dist/nextjs-vite/vite-plugin/index.d.ts +6 -0
- package/dist/nextjs-vite/vite-plugin/index.js +19 -0
- package/dist/nextjs-vite-plugin/index.d.ts +28 -0
- package/dist/nextjs-vite-plugin/index.js +923 -0
- package/dist/nextjs-vite-plugin/mocks/storybook.global.js +29 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-context.js +8 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-default-loader.js +23 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-image.js +28 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-legacy-image.js +17 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/cache/index.js +29 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/dynamic/index.js +40 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/headers/index.js +55 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/link/index.js +63 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/navigation/index.js +71 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +74 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/rsc/server-only.js +7 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/safe-stable-stringify/index.js +13 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/compatibility/draft-mode.compat.js +7 -0
- package/dist/node-logger/index.d.ts +495 -0
- package/dist/node-logger/index.js +42 -0
- package/dist/oxc-parser/index.d.ts +99 -0
- package/dist/oxc-parser/index.js +275 -0
- package/dist/oxc-parser/worker.js +37 -0
- package/dist/preview/_chunks/runtime-BIzIdDbb.js +10263 -0
- package/dist/preview/_chunks/runtime-BTPtVY1p.js +1102 -0
- package/dist/preview/_chunks/runtime-BZSnICCg.js +8484 -0
- package/dist/preview/_chunks/runtime-BdGkqNEt.js +45 -0
- package/dist/preview/_chunks/runtime-BwSxqk3t.js +63 -0
- package/dist/preview/_chunks/runtime-CqHxptiK.js +6143 -0
- package/dist/preview/_chunks/runtime-CsV4HZPV.js +5064 -0
- package/dist/preview/_chunks/runtime-CxZK_Ln3.js +284 -0
- package/dist/preview/_chunks/runtime-DZToXfvO.js +9767 -0
- package/dist/preview/_chunks/runtime-DrTjJkPY.js +3872 -0
- package/dist/preview/_chunks/runtime-DuHdxMFA.js +387 -0
- package/dist/preview/_chunks/runtime-iXdo8CR8.js +3635 -0
- package/dist/preview/_chunks/runtime-q3wt0e_N.js +6838 -0
- package/dist/preview/globals.d.ts +16 -0
- package/dist/preview/globals.js +20 -0
- package/dist/preview/runtime.js +6 -0
- package/dist/preview-api/index.d.ts +4 -0
- package/dist/preview-api/index.js +147 -0
- package/dist/preview-errors.d.ts +186 -0
- package/dist/preview-errors.js +56 -0
- package/dist/react/docgen/docgen-worker.js +38 -0
- package/dist/react/entry-preview-argtypes.js +9 -0
- package/dist/react/entry-preview-docs.js +12 -0
- package/dist/react/entry-preview-rsc.js +11 -0
- package/dist/react/entry-preview.js +21 -0
- package/dist/react/index.d.ts +119 -0
- package/dist/react/index.js +26 -0
- package/dist/react/preset.js +301 -0
- package/dist/react/preview.d.ts +2 -0
- package/dist/react/preview.js +11 -0
- package/dist/react-native/bin/get-stories.js +34 -0
- package/dist/react-native/index.d.ts +160 -0
- package/dist/react-native/index.js +1547 -0
- package/dist/react-native/metro/node.d.ts +83 -0
- package/dist/react-native/metro/node.js +21 -0
- package/dist/react-native/metro/withStorybook.d.ts +2269 -0
- package/dist/react-native/metro/withStorybook.js +138 -0
- package/dist/react-native/preview.d.ts +6 -0
- package/dist/react-native/preview.js +20 -0
- package/dist/react-native/scripts/generate.d.ts +22 -0
- package/dist/react-native/scripts/generate.js +18 -0
- package/dist/react-native/stub.js +20 -0
- package/dist/react-native-theming/index.d.ts +175 -0
- package/dist/react-native-theming/index.js +2591 -0
- package/dist/react-native-ui/index.d.ts +130 -0
- package/dist/react-native-ui/index.js +1448 -0
- package/dist/react-native-ui-common/index.d.ts +230 -0
- package/dist/react-native-ui-common/index.js +514 -0
- package/dist/react-vite/index.d.ts +4 -0
- package/dist/react-vite/index.js +8 -0
- package/dist/react-vite/node/index.d.ts +6 -0
- package/dist/react-vite/node/index.js +20 -0
- package/dist/react-vite/preset.d.ts +6 -0
- package/dist/react-vite/preset.js +21 -0
- package/dist/router/index.d.ts +141 -0
- package/dist/router/index.js +1217 -0
- package/dist/server-errors.d.ts +2 -0
- package/dist/server-errors.js +149 -0
- package/dist/shared/open-service/index.d.ts +3 -0
- package/dist/shared/open-service/index.js +115 -0
- package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +75 -0
- package/dist/shared/open-service/toolsets/docs/public.d.ts +1296 -0
- package/dist/shared/open-service/toolsets/docs/public.js +991 -0
- package/dist/telemetry/index.d.ts +314 -0
- package/dist/telemetry/index.js +103 -0
- package/dist/test/index.d.ts +158 -0
- package/dist/test/index.js +19421 -0
- package/dist/theming/create.d.ts +15 -0
- package/dist/theming/create.js +11 -0
- package/dist/theming/index.d.ts +54 -0
- package/dist/theming/index.js +511 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +48 -0
- package/dist/viewport/index.d.ts +275 -0
- package/dist/viewport/index.js +21 -0
- package/package.json +1054 -4
- package/template/nextjs-vite/cli/.eslintrc.json +6 -0
- package/template/nextjs-vite/cli/js/Button.jsx +42 -0
- package/template/nextjs-vite/cli/js/Button.stories.js +49 -0
- package/template/nextjs-vite/cli/js/Configure.mdx +470 -0
- package/template/nextjs-vite/cli/js/Header.jsx +58 -0
- package/template/nextjs-vite/cli/js/Header.stories.js +30 -0
- package/template/nextjs-vite/cli/js/Page.jsx +68 -0
- package/template/nextjs-vite/cli/js/Page.stories.js +28 -0
- package/template/nextjs-vite/cli/ts/Button.stories.ts +54 -0
- package/template/nextjs-vite/cli/ts/Button.tsx +39 -0
- package/template/nextjs-vite/cli/ts/Configure.mdx +446 -0
- package/template/nextjs-vite/cli/ts/Header.stories.ts +34 -0
- package/template/nextjs-vite/cli/ts/Header.tsx +54 -0
- package/template/nextjs-vite/cli/ts/Page.stories.ts +33 -0
- package/template/nextjs-vite/cli/ts/Page.tsx +73 -0
- package/template/react/cli/.eslintrc.json +5 -0
- package/template/react/cli/js/Button.jsx +39 -0
- package/template/react/cli/js/Button.stories.js +49 -0
- package/template/react/cli/js/Header.jsx +56 -0
- package/template/react/cli/js/Header.stories.js +29 -0
- package/template/react/cli/js/Page.jsx +69 -0
- package/template/react/cli/js/Page.stories.js +28 -0
- package/template/react/cli/ts/Button.stories.ts +54 -0
- package/template/react/cli/ts/Button.tsx +37 -0
- package/template/react/cli/ts/Header.stories.ts +34 -0
- package/template/react/cli/ts/Header.tsx +56 -0
- package/template/react/cli/ts/Page.stories.ts +33 -0
- package/template/react/cli/ts/Page.tsx +73 -0
- package/template/react-vite/cli/.eslintrc.json +5 -0
- package/template/react-vite/cli/js/Button.jsx +39 -0
- package/template/react-vite/cli/js/Button.stories.js +49 -0
- package/template/react-vite/cli/js/Header.jsx +56 -0
- package/template/react-vite/cli/js/Header.stories.js +29 -0
- package/template/react-vite/cli/js/Page.jsx +69 -0
- package/template/react-vite/cli/js/Page.stories.js +28 -0
- package/template/react-vite/cli/ts/Button.stories.ts +54 -0
- package/template/react-vite/cli/ts/Button.tsx +37 -0
- package/template/react-vite/cli/ts/Header.stories.ts +34 -0
- package/template/react-vite/cli/ts/Header.tsx +56 -0
- package/template/react-vite/cli/ts/Page.stories.ts +33 -0
- package/template/react-vite/cli/ts/Page.tsx +73 -0
|
@@ -0,0 +1,923 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ro17f80mg6k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ro17f80mg6k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ro17f80mg6k from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ro17f80mg6k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ro17f80mg6k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ro17f80mg6k.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Forkbook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
VITEST_PLUGIN_NAME,
|
|
14
|
+
getAlias,
|
|
15
|
+
getExecutionEnvironment,
|
|
16
|
+
getNextjsMajorVersion,
|
|
17
|
+
getViteMajorVersion,
|
|
18
|
+
isVitestEnv,
|
|
19
|
+
vitePluginNextMocks
|
|
20
|
+
} from "../_node-chunks/chunk-ZWBCQ4MJ.js";
|
|
21
|
+
import "../_node-chunks/chunk-CXRU72ET.js";
|
|
22
|
+
|
|
23
|
+
// src/nextjs-vite-plugin/index.ts
|
|
24
|
+
import { dirname, resolve as resolve3 } from "pathe";
|
|
25
|
+
import { createRequire as createRequire3 } from "node:module";
|
|
26
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
27
|
+
|
|
28
|
+
// src/nextjs-vite-plugin/plugins/next-env/plugin.ts
|
|
29
|
+
import { resolve } from "pathe";
|
|
30
|
+
|
|
31
|
+
// src/nextjs-vite-plugin/utils/nextjs.ts
|
|
32
|
+
import * as nextEnv from "@next/env";
|
|
33
|
+
import Log from "next/dist/build/output/log.js";
|
|
34
|
+
import { loadBindings, lockfilePatchPromise } from "next/dist/build/swc/index.js";
|
|
35
|
+
import { findPagesDir } from "next/dist/lib/find-pages-dir.js";
|
|
36
|
+
import path, { join } from "pathe";
|
|
37
|
+
var nextDistPath = /(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/, { loadEnvConfig } = nextEnv.default || nextEnv;
|
|
38
|
+
async function loadEnvironmentConfig(dir, dev) {
|
|
39
|
+
return loadEnvConfig(dir, dev, Log);
|
|
40
|
+
}
|
|
41
|
+
async function loadSWCBindingsEagerly(nextConfig) {
|
|
42
|
+
await loadBindings(nextConfig?.experimental?.useWasmBinary), lockfilePatchPromise.cur && await lockfilePatchPromise.cur;
|
|
43
|
+
}
|
|
44
|
+
function shouldOutputCommonJs(filename) {
|
|
45
|
+
return filename.endsWith(".cjs") || nextDistPath.test(filename);
|
|
46
|
+
}
|
|
47
|
+
function findNextDirectories(dir) {
|
|
48
|
+
try {
|
|
49
|
+
return findPagesDir(dir);
|
|
50
|
+
} catch {
|
|
51
|
+
return {
|
|
52
|
+
appDir: path.join(dir, "app"),
|
|
53
|
+
pagesDir: path.join(dir, "pages")
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/nextjs-vite-plugin/plugins/next-env/plugin.ts
|
|
59
|
+
async function vitePluginNextEnv(rootDir, nextConfigResolver) {
|
|
60
|
+
let envConfig, isDev, resolvedDir = resolve(rootDir), getDefineEnv, isNext1540 = !1;
|
|
61
|
+
try {
|
|
62
|
+
getDefineEnv = (await import("next/dist/build/define-env.js")).getDefineEnv, isNext1540 = !0;
|
|
63
|
+
} catch {
|
|
64
|
+
getDefineEnv = // @ts-expect-error - TODO: Ignoring because types are for >= 15.4.0
|
|
65
|
+
(await import("next/dist/build/webpack/plugins/define-env-plugin.js")).getDefineEnv;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
name: "vite-plugin-storybook-nextjs-env",
|
|
69
|
+
enforce: "pre",
|
|
70
|
+
async config(config, env) {
|
|
71
|
+
isDev = env.mode !== "production", envConfig = (await loadEnvironmentConfig(resolvedDir, isDev)).combinedEnv;
|
|
72
|
+
let nextConfig = await nextConfigResolver.promise, finalConfig = {
|
|
73
|
+
...Object.fromEntries(
|
|
74
|
+
Object.entries(envConfig).filter(([key]) => key.startsWith("NEXT_PUBLIC_")).map(([key, value]) => [`process.env.${key}`, JSON.stringify(value)])
|
|
75
|
+
),
|
|
76
|
+
...getDefineEnv({
|
|
77
|
+
isTurbopack: !1,
|
|
78
|
+
config: nextConfig,
|
|
79
|
+
isClient: !0,
|
|
80
|
+
isEdgeServer: !1,
|
|
81
|
+
isNodeServer: !1,
|
|
82
|
+
clientRouterFilters: void 0,
|
|
83
|
+
dev: isDev,
|
|
84
|
+
middlewareMatchers: void 0,
|
|
85
|
+
hasRewrites: !1,
|
|
86
|
+
distDir: nextConfig.distDir,
|
|
87
|
+
fetchCacheKeyPrefix: nextConfig?.experimental?.fetchCacheKeyPrefix,
|
|
88
|
+
...isNext1540 ? {
|
|
89
|
+
projectPath: rootDir
|
|
90
|
+
} : {
|
|
91
|
+
isNodeOrEdgeCompilation: !1
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
return delete process.env.__NEXT_IMAGE_OPTS, delete finalConfig["process.env.__NEXT_IMAGE_OPTS"], {
|
|
96
|
+
define: finalConfig,
|
|
97
|
+
test: {
|
|
98
|
+
deps: {
|
|
99
|
+
optimizer: {
|
|
100
|
+
ssr: {
|
|
101
|
+
include: ["next"]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// src/nextjs-vite-plugin/plugins/next-font/plugin.ts
|
|
112
|
+
import fs from "node:fs/promises";
|
|
113
|
+
import path2 from "pathe";
|
|
114
|
+
|
|
115
|
+
// src/nextjs-vite-plugin/plugins/next-font/google/get-font-face-declarations.ts
|
|
116
|
+
import { fetchCSSFromGoogleFonts } from "next/dist/compiled/@next/font/dist/google/fetch-css-from-google-fonts.js";
|
|
117
|
+
import { getFontAxes } from "next/dist/compiled/@next/font/dist/google/get-font-axes.js";
|
|
118
|
+
import { getGoogleFontsUrl } from "next/dist/compiled/@next/font/dist/google/get-google-fonts-url.js";
|
|
119
|
+
import { validateGoogleFontFunctionCall } from "next/dist/compiled/@next/font/dist/google/validate-google-font-function-call.js";
|
|
120
|
+
import loaderUtils from "next/dist/compiled/loader-utils3/index.js";
|
|
121
|
+
var cssCache = /* @__PURE__ */ new Map();
|
|
122
|
+
async function getFontFaceDeclarations(options) {
|
|
123
|
+
let { fontFamily, weights, styles, selectedVariableAxes, display, variable } = validateGoogleFontFunctionCall(options.fontFamily, options.props), fontAxes = getFontAxes(fontFamily, weights, styles, selectedVariableAxes), url = getGoogleFontsUrl(fontFamily, fontAxes, display);
|
|
124
|
+
try {
|
|
125
|
+
let hasCachedCSS = cssCache.has(url), fontFaceCSS = hasCachedCSS ? cssCache.get(url) : await fetchCSSFromGoogleFonts(url, fontFamily, !0).catch(() => null);
|
|
126
|
+
if (hasCachedCSS ? cssCache.delete(url) : cssCache.set(url, fontFaceCSS), fontFaceCSS === null)
|
|
127
|
+
throw new Error(`Failed to fetch \`${fontFamily}\` from Google Fonts with URL: \`${url}\``);
|
|
128
|
+
return {
|
|
129
|
+
id: loaderUtils.getHashDigest(url, "md5", "hex", 6),
|
|
130
|
+
fontFamily,
|
|
131
|
+
fontFaceCSS,
|
|
132
|
+
weights,
|
|
133
|
+
styles,
|
|
134
|
+
variable
|
|
135
|
+
};
|
|
136
|
+
} catch {
|
|
137
|
+
throw new Error(`Failed to fetch \`${fontFamily}\` from Google Fonts with URL: \`${url}\``);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// src/nextjs-vite-plugin/plugins/next-font/local/get-font-face-declarations.ts
|
|
142
|
+
import { validateLocalFontFunctionCall } from "next/dist/compiled/@next/font/dist/local/validate-local-font-function-call.js";
|
|
143
|
+
import loaderUtils2 from "next/dist/compiled/loader-utils3/index.js";
|
|
144
|
+
import { dedent } from "ts-dedent";
|
|
145
|
+
var getPlaceholderFontUrl = (refId) => `__%%import.meta.ROLLUP_FILE_URL_${refId}%%__`;
|
|
146
|
+
getPlaceholderFontUrl.regexp = /__%%import\.meta\.ROLLUP_FILE_URL_(.*?)%%__/g;
|
|
147
|
+
async function getFontFaceDeclarations2(options) {
|
|
148
|
+
let localFontSrc = options.props.metaSrc, {
|
|
149
|
+
weight,
|
|
150
|
+
style,
|
|
151
|
+
variable,
|
|
152
|
+
declarations = []
|
|
153
|
+
} = validateLocalFontFunctionCall("", options.props), id = `font-${loaderUtils2.getHashDigest(
|
|
154
|
+
Buffer.from(JSON.stringify(localFontSrc)),
|
|
155
|
+
"md5",
|
|
156
|
+
"hex",
|
|
157
|
+
6
|
|
158
|
+
)}`, fontDeclarations = declarations.map(({ prop, value }) => `${prop}: ${value};`).join(`
|
|
159
|
+
`);
|
|
160
|
+
return {
|
|
161
|
+
id,
|
|
162
|
+
fontFamily: id,
|
|
163
|
+
fontFaceCSS: localFontSrc ? "fontReferenceId" in localFontSrc ? dedent`@font-face {
|
|
164
|
+
font-family: ${id};
|
|
165
|
+
src: url(${localFontSrc.fontReferenceId ? getPlaceholderFontUrl(localFontSrc.fontReferenceId) : `/@fs/${localFontSrc.fontPath}`});
|
|
166
|
+
${weight ? `font-weight: ${weight};` : ""}
|
|
167
|
+
${style ? `font-style: ${style};` : ""}
|
|
168
|
+
${fontDeclarations}
|
|
169
|
+
}` : localFontSrc.map((font) => dedent`@font-face {
|
|
170
|
+
font-family: ${id};
|
|
171
|
+
src: url(${font.path.fontReferenceId ? getPlaceholderFontUrl(font.path.fontReferenceId) : `/@fs/${font.path.fontPath}`});
|
|
172
|
+
${font.weight ? `font-weight: ${font.weight};` : ""}
|
|
173
|
+
${font.style ? `font-style: ${font.style};` : ""}
|
|
174
|
+
${fontDeclarations}
|
|
175
|
+
}`).join("") : "",
|
|
176
|
+
weights: weight ? [weight] : [],
|
|
177
|
+
styles: style ? [style] : [],
|
|
178
|
+
variable
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// src/nextjs-vite-plugin/utils/base64-url.ts
|
|
183
|
+
function encodeBase64Url(str) {
|
|
184
|
+
return Buffer.from(str).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// src/nextjs-vite-plugin/plugins/next-font/utils/get-css-meta.ts
|
|
188
|
+
function getCSSMeta(options) {
|
|
189
|
+
let className = getClassName(options), style = getStylesObj(options), variableClassName = `__variable_${className}`, classNamesCSS = `
|
|
190
|
+
.${className} {
|
|
191
|
+
font-family: ${options.fontFamily};
|
|
192
|
+
${isNextCSSPropertyValid(options.styles) ? `font-style: ${options.styles[0]};` : ""}
|
|
193
|
+
${isNextCSSPropertyValid(options.weights) && !options.weights[0]?.includes(" ") ? `font-weight: ${options.weights[0]};` : ""}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
${options.variable ? `.${variableClassName} { ${options.variable}: '${options.fontFamily}'; }` : ""}
|
|
197
|
+
`, fontFaceCSS = `${changeFontDisplayToSwap(options.fontFaceCSS)}`;
|
|
198
|
+
return {
|
|
199
|
+
className,
|
|
200
|
+
fontFaceCSS,
|
|
201
|
+
classNamesCSS,
|
|
202
|
+
style,
|
|
203
|
+
...options.variable ? { variableClassName } : {}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function getClassName({ styles, weights, fontFamily }) {
|
|
207
|
+
let font = fontFamily.replaceAll(" ", "-").toLowerCase(), style = isNextCSSPropertyValid(styles) ? styles[0] : null, weight = isNextCSSPropertyValid(weights) ? weights[0]?.replaceAll(" ", "-") : null;
|
|
208
|
+
return `${font}${style ? `-${style}` : ""}${weight ? `-${weight}` : ""}`;
|
|
209
|
+
}
|
|
210
|
+
function getStylesObj({ styles, weights, fontFamily }) {
|
|
211
|
+
return {
|
|
212
|
+
fontFamily,
|
|
213
|
+
...isNextCSSPropertyValid(styles) ? { fontStyle: styles[0] } : {},
|
|
214
|
+
...isNextCSSPropertyValid(weights) ? { fontWeight: weights[0] } : {}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function isNextCSSPropertyValid(prop) {
|
|
218
|
+
return prop.length === 1 && prop[0] !== "variable";
|
|
219
|
+
}
|
|
220
|
+
function changeFontDisplayToSwap(css) {
|
|
221
|
+
return css.replaceAll("font-display: optional;", "font-display: block;");
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// src/nextjs-vite-plugin/plugins/next-font/utils/set-font-declarations-in-head.ts
|
|
225
|
+
import { dedent as dedent2 } from "ts-dedent";
|
|
226
|
+
function setFontDeclarationsInHead({ id, fontFaceCSS, classNamesCSS }) {
|
|
227
|
+
let regex = new RegExp(getPlaceholderFontUrl.regexp), fontPaths = fontFaceCSS.matchAll(regex), fontPathsImportUrls = [];
|
|
228
|
+
if (fontPaths)
|
|
229
|
+
for (let match of fontFaceCSS.matchAll(regex))
|
|
230
|
+
fontPathsImportUrls.push({
|
|
231
|
+
id: match[1],
|
|
232
|
+
path: match[0].replaceAll(/__%%|%%__/g, "")
|
|
233
|
+
});
|
|
234
|
+
return dedent2`
|
|
235
|
+
const fontPaths = [${fontPathsImportUrls.map((fontPath) => `{id: '${fontPath.id}', path: ${fontPath.path}}`).join(", ")}];
|
|
236
|
+
if (!document.getElementById('font-face-${id}')) {
|
|
237
|
+
let fontDeclarations = \`${fontFaceCSS}\`;
|
|
238
|
+
fontPaths.forEach((fontPath, i) => {
|
|
239
|
+
fontDeclarations = fontDeclarations.replace('__%%import.meta.ROLLUP_FILE_URL_' + fontPath.id + '%%__', fontPath.path.toString());
|
|
240
|
+
});
|
|
241
|
+
const style = document.createElement('style');
|
|
242
|
+
style.setAttribute('id', 'font-face-${id}');
|
|
243
|
+
style.innerHTML = fontDeclarations;
|
|
244
|
+
document.head.appendChild(style);
|
|
245
|
+
|
|
246
|
+
const classNamesCSS = \`${classNamesCSS}\`;
|
|
247
|
+
const classNamesStyle = document.createElement('style');
|
|
248
|
+
classNamesStyle.setAttribute('id', 'classnames-${id}');
|
|
249
|
+
classNamesStyle.innerHTML = classNamesCSS;
|
|
250
|
+
document.head.appendChild(classNamesStyle);
|
|
251
|
+
}
|
|
252
|
+
`;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/nextjs-vite-plugin/plugins/next-font/plugin.ts
|
|
256
|
+
var includePattern = /next(\\|\/|\\\\).*(\\|\/|\\\\)target\.css\?.*$/, virtualFontPrefix = "\0virtual:next-font:";
|
|
257
|
+
function vitePluginNextFont() {
|
|
258
|
+
let devMode = !0;
|
|
259
|
+
return {
|
|
260
|
+
name: "vite-plugin-storybook-nextjs-font",
|
|
261
|
+
enforce: "pre",
|
|
262
|
+
async config(config, env) {
|
|
263
|
+
return devMode = env.mode !== "production", {};
|
|
264
|
+
},
|
|
265
|
+
async resolveId(source, importer) {
|
|
266
|
+
let cwd = process.cwd();
|
|
267
|
+
if (!includePattern.test(source) || !importer)
|
|
268
|
+
return null;
|
|
269
|
+
let [sourceWithoutQuery, rawQuery] = source.split("?"), queryParams = JSON.parse(rawQuery), fontOptions = {
|
|
270
|
+
filename: queryParams.path ?? "",
|
|
271
|
+
fontFamily: queryParams.import ?? "",
|
|
272
|
+
props: queryParams.arguments?.[0] ?? {},
|
|
273
|
+
source: importer
|
|
274
|
+
};
|
|
275
|
+
if (fontOptions.source.endsWith("html"))
|
|
276
|
+
return null;
|
|
277
|
+
let fontFaceDeclaration, pathSep = path2.sep;
|
|
278
|
+
if (sourceWithoutQuery.endsWith(["next", "font", "google", "target.css"].join(pathSep)) && (fontFaceDeclaration = await getFontFaceDeclarations(fontOptions)), sourceWithoutQuery.endsWith(["next", "font", "local", "target.css"].join(pathSep))) {
|
|
279
|
+
let importerDirPath = path2.dirname(fontOptions.filename), emitFont = async (importerRelativeFontPath) => {
|
|
280
|
+
let fontExtension = path2.extname(importerRelativeFontPath), fontBaseName = path2.basename(importerRelativeFontPath, fontExtension), fontPath = path2.join(importerDirPath, importerRelativeFontPath);
|
|
281
|
+
if (devMode)
|
|
282
|
+
return {
|
|
283
|
+
fontPath: path2.join(cwd, fontPath),
|
|
284
|
+
fontReferenceId: void 0
|
|
285
|
+
};
|
|
286
|
+
try {
|
|
287
|
+
let fontData = await fs.readFile(fontPath);
|
|
288
|
+
return { fontReferenceId: this.emitFile({
|
|
289
|
+
name: `${fontBaseName}${fontExtension}`,
|
|
290
|
+
type: "asset",
|
|
291
|
+
source: fontData
|
|
292
|
+
}), fontPath };
|
|
293
|
+
} catch (err) {
|
|
294
|
+
console.error(`Could not read font file ${fontPath}:`, err);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
}, loaderOptions = {
|
|
298
|
+
...fontOptions
|
|
299
|
+
};
|
|
300
|
+
if (loaderOptions)
|
|
301
|
+
if (typeof fontOptions.props.src == "string") {
|
|
302
|
+
let font = await emitFont(fontOptions.props.src);
|
|
303
|
+
loaderOptions.props.metaSrc = font;
|
|
304
|
+
} else
|
|
305
|
+
loaderOptions.props.metaSrc = (await Promise.all(
|
|
306
|
+
(fontOptions.props.src ?? []).map(async (fontSrc) => {
|
|
307
|
+
let font = await emitFont(fontSrc.path);
|
|
308
|
+
if (font)
|
|
309
|
+
return {
|
|
310
|
+
...fontSrc,
|
|
311
|
+
path: font
|
|
312
|
+
};
|
|
313
|
+
})
|
|
314
|
+
)).filter((font) => font !== void 0);
|
|
315
|
+
fontFaceDeclaration = await getFontFaceDeclarations2(loaderOptions);
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
id: `${virtualFontPrefix}${encodeBase64Url(rawQuery)}`,
|
|
319
|
+
meta: {
|
|
320
|
+
fontFaceDeclaration
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
},
|
|
324
|
+
load(id) {
|
|
325
|
+
if (!id.startsWith(virtualFontPrefix))
|
|
326
|
+
return;
|
|
327
|
+
let fontFaceDeclaration = this.getModuleInfo(id)?.meta?.fontFaceDeclaration;
|
|
328
|
+
if (typeof fontFaceDeclaration < "u") {
|
|
329
|
+
let cssMeta = getCSSMeta(fontFaceDeclaration);
|
|
330
|
+
return `
|
|
331
|
+
${setFontDeclarationsInHead({
|
|
332
|
+
fontFaceCSS: cssMeta.fontFaceCSS,
|
|
333
|
+
id: fontFaceDeclaration.id,
|
|
334
|
+
classNamesCSS: cssMeta.classNamesCSS
|
|
335
|
+
})}
|
|
336
|
+
|
|
337
|
+
export default {
|
|
338
|
+
className: "${cssMeta.className}",
|
|
339
|
+
style: ${JSON.stringify(cssMeta.style)}
|
|
340
|
+
${cssMeta.variableClassName ? `, variable: "${cssMeta.variableClassName}"` : ""}
|
|
341
|
+
}
|
|
342
|
+
`;
|
|
343
|
+
}
|
|
344
|
+
return "export default {}";
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// src/nextjs-vite-plugin/plugins/next-swc/plugin.ts
|
|
350
|
+
import nextLoadJsConfig from "next/dist/build/load-jsconfig.js";
|
|
351
|
+
import { transform } from "next/dist/build/swc/index.js";
|
|
352
|
+
import { resolve as resolve2 } from "pathe";
|
|
353
|
+
import { createFilter } from "vite";
|
|
354
|
+
|
|
355
|
+
// src/nextjs-vite-plugin/utils/swc/transform.ts
|
|
356
|
+
import path3 from "pathe";
|
|
357
|
+
|
|
358
|
+
// src/nextjs-vite-plugin/utils/swc/options.ts
|
|
359
|
+
import { getParserOptions } from "next/dist/build/swc/options.js";
|
|
360
|
+
import { createRequire } from "node:module";
|
|
361
|
+
|
|
362
|
+
// src/nextjs-vite-plugin/utils/swc/styles.ts
|
|
363
|
+
function getStyledComponentsOptions(styledComponentsConfig, development) {
|
|
364
|
+
return styledComponentsConfig ? typeof styledComponentsConfig == "object" ? {
|
|
365
|
+
...styledComponentsConfig,
|
|
366
|
+
displayName: styledComponentsConfig.displayName ?? !!development
|
|
367
|
+
} : {
|
|
368
|
+
displayName: !!development
|
|
369
|
+
} : null;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// src/nextjs-vite-plugin/utils/swc/options.ts
|
|
373
|
+
var require2 = createRequire(import.meta.url), regeneratorRuntimePath = require2.resolve("next/dist/compiled/regenerator-runtime");
|
|
374
|
+
function getBaseSWCOptions({
|
|
375
|
+
filename,
|
|
376
|
+
development,
|
|
377
|
+
hasReactRefresh,
|
|
378
|
+
globalWindow,
|
|
379
|
+
esm,
|
|
380
|
+
swcPlugins,
|
|
381
|
+
compiler,
|
|
382
|
+
resolvedBaseUrl,
|
|
383
|
+
jsConfig,
|
|
384
|
+
swcCacheDir
|
|
385
|
+
}) {
|
|
386
|
+
let parserConfig = getParserOptions({ filename, jsConfig }), paths = jsConfig?.compilerOptions?.paths, enableDecorators = !!jsConfig?.compilerOptions?.experimentalDecorators, emitDecoratorMetadata = !!jsConfig?.compilerOptions?.emitDecoratorMetadata, useDefineForClassFields = !!jsConfig?.compilerOptions?.useDefineForClassFields, plugins = (swcPlugins ?? []).filter(Array.isArray).map(([name, options]) => [require2.resolve(name), options]);
|
|
387
|
+
return {
|
|
388
|
+
jsc: {
|
|
389
|
+
...resolvedBaseUrl && paths ? {
|
|
390
|
+
baseUrl: resolvedBaseUrl.baseUrl,
|
|
391
|
+
paths
|
|
392
|
+
} : {},
|
|
393
|
+
externalHelpers: !1,
|
|
394
|
+
parser: parserConfig,
|
|
395
|
+
experimental: {
|
|
396
|
+
keepImportAttributes: !0,
|
|
397
|
+
emitAssertForImportAttributes: !0,
|
|
398
|
+
plugins,
|
|
399
|
+
cacheRoot: swcCacheDir
|
|
400
|
+
},
|
|
401
|
+
transform: {
|
|
402
|
+
legacyDecorator: enableDecorators,
|
|
403
|
+
decoratorMetadata: emitDecoratorMetadata,
|
|
404
|
+
useDefineForClassFields,
|
|
405
|
+
react: {
|
|
406
|
+
importSource: jsConfig?.compilerOptions?.jsxImportSource ?? "react",
|
|
407
|
+
runtime: "automatic",
|
|
408
|
+
pragmaFrag: "React.Fragment",
|
|
409
|
+
throwIfNamespace: !0,
|
|
410
|
+
development: !!development,
|
|
411
|
+
useBuiltins: !0,
|
|
412
|
+
refresh: !!hasReactRefresh
|
|
413
|
+
},
|
|
414
|
+
optimizer: {
|
|
415
|
+
simplify: !1,
|
|
416
|
+
// TODO: Figuring out for what globals are exactly used for
|
|
417
|
+
globals: {
|
|
418
|
+
typeofs: {
|
|
419
|
+
window: globalWindow ? "object" : "undefined"
|
|
420
|
+
},
|
|
421
|
+
envs: {
|
|
422
|
+
NODE_ENV: development ? '"development"' : '"production"'
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
regenerator: {
|
|
427
|
+
importPath: regeneratorRuntimePath
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
sourceMaps: !0,
|
|
432
|
+
removeConsole: compiler?.removeConsole,
|
|
433
|
+
reactRemoveProperties: !1,
|
|
434
|
+
relay: compiler?.relay,
|
|
435
|
+
// Always transform styled-jsx and error when `client-only` condition is triggered
|
|
436
|
+
styledJsx: {},
|
|
437
|
+
// Disable css-in-js libs (without client-only integration) transform on server layer for server components
|
|
438
|
+
styledComponents: getStyledComponentsOptions(compiler?.styledComponents, development),
|
|
439
|
+
serverComponents: void 0,
|
|
440
|
+
serverActions: void 0,
|
|
441
|
+
// For app router we prefer to bundle ESM,
|
|
442
|
+
// On server side of pages router we prefer CJS.
|
|
443
|
+
preferEsm: esm
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// src/nextjs-vite-plugin/utils/swc/transform.ts
|
|
448
|
+
var getVitestSWCTransformConfig = async ({
|
|
449
|
+
filename,
|
|
450
|
+
inputSourceMap,
|
|
451
|
+
isServerEnvironment,
|
|
452
|
+
loadedJSConfig,
|
|
453
|
+
nextDirectories,
|
|
454
|
+
nextConfig,
|
|
455
|
+
rootDir,
|
|
456
|
+
isDev,
|
|
457
|
+
isEsmProject
|
|
458
|
+
}) => {
|
|
459
|
+
let { compilerOptions, ...restJSConfig } = loadedJSConfig.jsConfig ?? {}, { paths, ...restCompilerOptions } = compilerOptions ?? {}, baseOptions = getBaseSWCOptions({
|
|
460
|
+
filename,
|
|
461
|
+
development: isDev,
|
|
462
|
+
hasReactRefresh: !1,
|
|
463
|
+
globalWindow: !isServerEnvironment,
|
|
464
|
+
jsConfig: {
|
|
465
|
+
...restJSConfig,
|
|
466
|
+
compilerOptions: {
|
|
467
|
+
...restCompilerOptions
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
resolvedBaseUrl: loadedJSConfig.resolvedBaseUrl,
|
|
471
|
+
swcPlugins: nextConfig.experimental.swcPlugins,
|
|
472
|
+
compiler: nextConfig?.compiler,
|
|
473
|
+
esm: isEsmProject,
|
|
474
|
+
swcCacheDir: path3.join(rootDir, nextConfig.distDir ?? ".next", "cache", "swc")
|
|
475
|
+
}), useCjsModules = shouldOutputCommonJs(filename), isPageFile = nextDirectories.pagesDir ? filename.startsWith(nextDirectories.pagesDir) : !1;
|
|
476
|
+
return {
|
|
477
|
+
...baseOptions,
|
|
478
|
+
fontLoaders: {
|
|
479
|
+
fontLoaders: ["next/font/local", "next/font/google"],
|
|
480
|
+
relativeFilePathFromRoot: path3.relative(rootDir, filename)
|
|
481
|
+
},
|
|
482
|
+
cjsRequireOptimizer: {
|
|
483
|
+
packages: {
|
|
484
|
+
"next/server": {
|
|
485
|
+
transforms: {
|
|
486
|
+
NextRequest: "next/dist/server/web/spec-extension/request",
|
|
487
|
+
NextResponse: "next/dist/server/web/spec-extension/response",
|
|
488
|
+
ImageResponse: "next/dist/server/web/spec-extension/image-response",
|
|
489
|
+
userAgentFromString: "next/dist/server/web/spec-extension/user-agent",
|
|
490
|
+
userAgent: "next/dist/server/web/spec-extension/user-agent"
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
...isServerEnvironment ? {
|
|
496
|
+
env: {
|
|
497
|
+
targets: {
|
|
498
|
+
// Targets the current version of Node.js
|
|
499
|
+
node: process.versions.node
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
} : {
|
|
503
|
+
env: {
|
|
504
|
+
targets: await getSupportedBrowsers(rootDir, isDev),
|
|
505
|
+
bugfixes: !0
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
module: {
|
|
509
|
+
type: isEsmProject && !useCjsModules ? "es6" : "commonjs"
|
|
510
|
+
},
|
|
511
|
+
disableNextSsg: !isPageFile,
|
|
512
|
+
isPageFile,
|
|
513
|
+
pagesDir: nextDirectories.pagesDir,
|
|
514
|
+
appDir: nextDirectories.appDir,
|
|
515
|
+
isDevelopment: isDev,
|
|
516
|
+
isServerCompiler: isServerEnvironment,
|
|
517
|
+
inputSourceMap: inputSourceMap && typeof inputSourceMap == "object" ? JSON.stringify(inputSourceMap) : void 0,
|
|
518
|
+
sourceFileName: filename,
|
|
519
|
+
filename
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
async function getSupportedBrowsers(projectRoot, isDevelopment) {
|
|
523
|
+
try {
|
|
524
|
+
return (await import(
|
|
525
|
+
// @ts-expect-error - Correct import since Next.js v16.2
|
|
526
|
+
"next/dist/build/get-supported-browsers.js"
|
|
527
|
+
)).getSupportedBrowsers(projectRoot, isDevelopment);
|
|
528
|
+
} catch {
|
|
529
|
+
return (await import("next/dist/build/utils.js")).getSupportedBrowsers(
|
|
530
|
+
projectRoot,
|
|
531
|
+
isDevelopment
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// src/nextjs-vite-plugin/utils/typescript.ts
|
|
537
|
+
var isDefined = (value) => value !== void 0;
|
|
538
|
+
|
|
539
|
+
// src/nextjs-vite-plugin/plugins/next-swc/plugin.ts
|
|
540
|
+
var excluded = /[\\/]((cache[\\/][^\\/]+\.zip[\\/])|virtual:)[\\/]/, included = /\.((c|m)?(j|t)sx?)$/, loadJsConfig = (
|
|
541
|
+
// biome-ignore lint/suspicious/noExplicitAny: CJS support
|
|
542
|
+
nextLoadJsConfig.default || nextLoadJsConfig
|
|
543
|
+
);
|
|
544
|
+
function vitePluginNextSwc(rootDir, nextConfigResolver) {
|
|
545
|
+
let loadedJSConfig, nextDirectories, isServerEnvironment, isDev, isEsmProject, filter = createFilter(included, excluded), resolvedDir = resolve2(rootDir);
|
|
546
|
+
return {
|
|
547
|
+
name: "vite-plugin-storybook-nextjs-swc",
|
|
548
|
+
enforce: "pre",
|
|
549
|
+
async config(config, env) {
|
|
550
|
+
let nextConfig = await nextConfigResolver.promise;
|
|
551
|
+
nextDirectories = findNextDirectories(resolvedDir), loadedJSConfig = await loadJsConfig(resolvedDir, nextConfig), isDev = env.mode !== "production", isEsmProject = !0, await loadSWCBindingsEagerly(nextConfig);
|
|
552
|
+
let serverWatchIgnored = config.server?.watch?.ignored, isServerWatchIgnoredArray = Array.isArray(serverWatchIgnored);
|
|
553
|
+
return isServerEnvironment = !1, isVitestEnv && (isServerEnvironment = config.test?.environment === "node" || config.test?.environment === "edge-runtime" || config.test?.browser?.enabled !== !0), {
|
|
554
|
+
// esbuild: {
|
|
555
|
+
// // We will use Next.js custom SWC transpiler instead of Vite's build-in esbuild
|
|
556
|
+
// exclude: [/node_modules/, /.m?(t|j)sx?/],
|
|
557
|
+
// },
|
|
558
|
+
server: {
|
|
559
|
+
watch: {
|
|
560
|
+
ignored: [
|
|
561
|
+
...isServerWatchIgnoredArray ? serverWatchIgnored : [serverWatchIgnored],
|
|
562
|
+
"/.next/"
|
|
563
|
+
].filter(isDefined)
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
},
|
|
568
|
+
async transform(code, id) {
|
|
569
|
+
if (id.includes("/node_modules/") || !filter(id))
|
|
570
|
+
return;
|
|
571
|
+
let inputSourceMap = this.getCombinedSourcemap();
|
|
572
|
+
return await transform(
|
|
573
|
+
code,
|
|
574
|
+
await getVitestSWCTransformConfig({
|
|
575
|
+
filename: id,
|
|
576
|
+
inputSourceMap,
|
|
577
|
+
isServerEnvironment,
|
|
578
|
+
loadedJSConfig,
|
|
579
|
+
nextConfig: await nextConfigResolver.promise,
|
|
580
|
+
nextDirectories,
|
|
581
|
+
rootDir,
|
|
582
|
+
isDev,
|
|
583
|
+
isEsmProject
|
|
584
|
+
})
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// src/nextjs-vite-plugin/polyfills/promise-with-resolvers.ts
|
|
591
|
+
typeof Promise.withResolvers > "u" && (Promise.withResolvers = () => {
|
|
592
|
+
let resolve4, reject;
|
|
593
|
+
return { promise: new Promise((res, rej) => {
|
|
594
|
+
resolve4 = res, reject = rej;
|
|
595
|
+
}), resolve: resolve4, reject };
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
// src/nextjs-vite-plugin/index.ts
|
|
599
|
+
import nextLoadJsConfig2 from "next/dist/build/load-jsconfig.js";
|
|
600
|
+
import {
|
|
601
|
+
PHASE_DEVELOPMENT_SERVER,
|
|
602
|
+
PHASE_PRODUCTION_BUILD,
|
|
603
|
+
PHASE_TEST
|
|
604
|
+
} from "next/dist/shared/lib/constants.js";
|
|
605
|
+
|
|
606
|
+
// src/nextjs-vite-plugin/plugins/next-dynamic/plugin.ts
|
|
607
|
+
import MagicString from "magic-string";
|
|
608
|
+
var vitePluginNextDynamic = () => ({
|
|
609
|
+
name: "vite-plugin-storybook-nextjs-dynamic",
|
|
610
|
+
transform(code, id) {
|
|
611
|
+
let dynamicImportRegex = /dynamic\(\s*async\s*\(\s*\)\s*=>\s*\{\s*typeof\s*require\.resolveWeak\s*!==\s*"undefined"\s*&&\s*require\.resolveWeak\(([^)]+)\);\s*\}/g;
|
|
612
|
+
if (dynamicImportRegex.test(code)) {
|
|
613
|
+
let s = new MagicString(code);
|
|
614
|
+
dynamicImportRegex.lastIndex = 0;
|
|
615
|
+
let match = dynamicImportRegex.exec(code);
|
|
616
|
+
for (; match !== null; ) {
|
|
617
|
+
let [fullMatch, importPath] = match, newImport = `dynamic(() => import(${importPath})`;
|
|
618
|
+
s.overwrite(match.index, match.index + fullMatch.length, newImport), match = dynamicImportRegex.exec(code);
|
|
619
|
+
}
|
|
620
|
+
return {
|
|
621
|
+
code: s.toString(),
|
|
622
|
+
map: s.generateMap({ hires: !0 })
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
return null;
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
// src/nextjs-vite-plugin/plugins/next-image/plugin.ts
|
|
630
|
+
import { createHash } from "node:crypto";
|
|
631
|
+
import fs2 from "node:fs";
|
|
632
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
633
|
+
import { createFilter as createFilter2 } from "@rollup/pluginutils";
|
|
634
|
+
import path4 from "pathe";
|
|
635
|
+
import probeSync from "probe-image-size/sync.js";
|
|
636
|
+
import { dedent as dedent3 } from "ts-dedent";
|
|
637
|
+
var warnedMessages = /* @__PURE__ */ new Set(), warnOnce = (message) => {
|
|
638
|
+
warnedMessages.has(message) || (console.warn(`[@aussieljk/forkbook/internal/nextjs-vite-plugin] ${message}`), warnedMessages.add(message));
|
|
639
|
+
}, includePattern2 = /\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/, excludeImporterPattern = /\.(css|scss|sass)$/, virtualImagePrefix = "\0virtual:next-image:";
|
|
640
|
+
var virtualNextImage = "virtual:next/image", virtualNextLegacyImage = "virtual:next/legacy/image", SHORT_HASH_LEN = 8, require3 = createRequire2(import.meta.url);
|
|
641
|
+
function vitePluginNextImage(nextConfigResolver, options = {}) {
|
|
642
|
+
let isBrowser = !isVitestEnv, hasVitePluginSvgr = !1, postfixRE = /[?#].*$/s, filter = createFilter2(
|
|
643
|
+
options.includeFiles ?? [
|
|
644
|
+
"**/*.{png,jpg,jpeg,gif,webp,avif,ico,bmp,svg}",
|
|
645
|
+
"**/*.{png,jpg,jpeg,gif,webp,avif,ico,bmp,svg}?*",
|
|
646
|
+
"**/*.{png,jpg,jpeg,gif,webp,avif,ico,bmp,svg}#*"
|
|
647
|
+
],
|
|
648
|
+
options.excludeFiles
|
|
649
|
+
), imagePathByHash = /* @__PURE__ */ new Map();
|
|
650
|
+
function registerImagePath(imagePath) {
|
|
651
|
+
let full = createHash("sha256").update(imagePath).digest("hex"), short = full.slice(0, SHORT_HASH_LEN), existing = imagePathByHash.get(short);
|
|
652
|
+
return existing === imagePath ? short : existing === void 0 ? (imagePathByHash.set(short, imagePath), short) : (imagePathByHash.set(full, imagePath), full);
|
|
653
|
+
}
|
|
654
|
+
return {
|
|
655
|
+
name: "vite-plugin-storybook-nextjs-image",
|
|
656
|
+
enforce: "pre",
|
|
657
|
+
async configResolved(config) {
|
|
658
|
+
hasVitePluginSvgr = !!config.plugins?.some(
|
|
659
|
+
(plugin) => plugin && typeof plugin == "object" && "name" in plugin && (plugin.name === "vite-plugin-svgr" || plugin.name.includes("svgr"))
|
|
660
|
+
);
|
|
661
|
+
},
|
|
662
|
+
async config(config, env) {
|
|
663
|
+
return config.test?.browser?.enabled === !0 && (isBrowser = !0), {
|
|
664
|
+
resolve: {
|
|
665
|
+
alias: getAlias(isBrowser ? "browser" : "node")
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
},
|
|
669
|
+
async resolveId(id, importer) {
|
|
670
|
+
let [source, queryA] = id.split("?");
|
|
671
|
+
if (queryA === "ignore")
|
|
672
|
+
return null;
|
|
673
|
+
let isSvg = /\.svg$/.test(source);
|
|
674
|
+
if (isSvg && hasVitePluginSvgr && queryA === "react")
|
|
675
|
+
return null;
|
|
676
|
+
if (isSvg && hasVitePluginSvgr && !options.includeFiles && !options.excludeFiles && queryA !== void 0 && warnOnce(
|
|
677
|
+
dedent3`Detected vite-plugin-svgr but you are not passing image include or exclude patterns to the nextjs-vite plugin. This may cause a conflict between the two plugins and issues with SVG files.
|
|
678
|
+
|
|
679
|
+
For more info and recommended configuration, see: https://github.com/storybookjs/storybook/blob/next/code/lib/vite-plugin-storybook-nextjs/README.md#faq-includingexcluding-images`
|
|
680
|
+
), includePattern2.test(source) && !excludeImporterPattern.test(importer ?? "") && !importer?.startsWith(virtualImagePrefix)) {
|
|
681
|
+
let isAbsolute = path4.isAbsolute(source), importerPath = importer?.split("?")[0], imagePath = source;
|
|
682
|
+
if (importerPath && !isAbsolute)
|
|
683
|
+
if (source.startsWith("."))
|
|
684
|
+
imagePath = path4.join(path4.dirname(importerPath), source);
|
|
685
|
+
else {
|
|
686
|
+
let resolvedByVite = await this.resolve(source, importer, {
|
|
687
|
+
skipSelf: !0
|
|
688
|
+
});
|
|
689
|
+
if (resolvedByVite?.id)
|
|
690
|
+
imagePath = resolvedByVite.id.split("?")[0];
|
|
691
|
+
else
|
|
692
|
+
try {
|
|
693
|
+
imagePath = require3.resolve(source, {
|
|
694
|
+
paths: [path4.dirname(importerPath)]
|
|
695
|
+
});
|
|
696
|
+
} catch {
|
|
697
|
+
return null;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
let pathForFilter = imagePath.replace(postfixRE, "");
|
|
701
|
+
return filter(pathForFilter) ? `${virtualImagePrefix}${registerImagePath(imagePath)}` : null;
|
|
702
|
+
}
|
|
703
|
+
return id === "next/image" && importer !== virtualNextImage ? virtualNextImage : id === "next/legacy/image" && importer !== virtualNextLegacyImage ? virtualNextLegacyImage : null;
|
|
704
|
+
},
|
|
705
|
+
async load(id) {
|
|
706
|
+
let aliasEnv = isBrowser ? "browser" : "node";
|
|
707
|
+
if (virtualNextImage === id)
|
|
708
|
+
return (await fs2.promises.readFile(
|
|
709
|
+
require3.resolve(`${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/image`)
|
|
710
|
+
)).toString("utf-8");
|
|
711
|
+
if (virtualNextLegacyImage === id)
|
|
712
|
+
return (await fs2.promises.readFile(
|
|
713
|
+
require3.resolve(`${VITEST_PLUGIN_NAME}/${aliasEnv}/mocks/legacy-image`)
|
|
714
|
+
)).toString("utf-8");
|
|
715
|
+
if (id.startsWith(virtualImagePrefix)) {
|
|
716
|
+
let imagePath = imagePathByHash.get(id.slice(virtualImagePrefix.length));
|
|
717
|
+
if (imagePath === void 0)
|
|
718
|
+
return null;
|
|
719
|
+
let nextConfig = await nextConfigResolver.promise;
|
|
720
|
+
try {
|
|
721
|
+
if (nextConfig.images?.disableStaticImages)
|
|
722
|
+
return dedent3`
|
|
723
|
+
import image from "${imagePath}?ignore";
|
|
724
|
+
export default image;
|
|
725
|
+
`;
|
|
726
|
+
let imageData = await fs2.promises.readFile(imagePath), size = probeSync(imageData);
|
|
727
|
+
if (!size)
|
|
728
|
+
throw new Error("Unsupported or corrupt image file");
|
|
729
|
+
let { width, height } = size;
|
|
730
|
+
return dedent3`
|
|
731
|
+
import src from "${imagePath}?ignore";
|
|
732
|
+
export default {
|
|
733
|
+
src,
|
|
734
|
+
height: ${height},
|
|
735
|
+
width: ${width},
|
|
736
|
+
blurDataURL: src
|
|
737
|
+
};
|
|
738
|
+
`;
|
|
739
|
+
} catch (err) {
|
|
740
|
+
console.error(`Could not read image file ${imagePath}:`, err);
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
// src/nextjs-vite-plugin/utils/next-config.ts
|
|
750
|
+
import { normalizeConfig } from "next/dist/server/config-shared.js";
|
|
751
|
+
import nextServerConfig from "next/dist/server/config.js";
|
|
752
|
+
var loadConfig = (
|
|
753
|
+
// biome-ignore lint/suspicious/noExplicitAny: CJS support
|
|
754
|
+
nextServerConfig.default || nextServerConfig
|
|
755
|
+
), TURBOPACK_RUST_REACT_COMPILER_ERROR = "`experimental.turbopackRustReactCompiler` is only supported with Turbopack.";
|
|
756
|
+
async function loadNextConfig(phase, dir) {
|
|
757
|
+
let nextConfig;
|
|
758
|
+
try {
|
|
759
|
+
nextConfig = await loadConfig(phase, dir);
|
|
760
|
+
} catch (error) {
|
|
761
|
+
if (!isTurbopackRustReactCompilerError(error))
|
|
762
|
+
throw error;
|
|
763
|
+
return loadNormalizedNextConfig(phase, dir);
|
|
764
|
+
}
|
|
765
|
+
return isResolvedNextConfig(nextConfig) ? nextConfig : loadNormalizedNextConfig(phase, dir, nextConfig);
|
|
766
|
+
}
|
|
767
|
+
async function loadNormalizedNextConfig(phase, dir, cachedRawConfigModule) {
|
|
768
|
+
let rawConfigModule = cachedRawConfigModule ?? await loadConfig(phase, dir, { rawConfig: !0 }), rawConfig = interopDefault(rawConfigModule), normalizedConfig = await normalizeConfig(phase, rawConfig), { turbopackRustReactCompiler: _turbopackRustReactCompiler, ...experimental } = normalizedConfig.experimental ?? {};
|
|
769
|
+
return loadConfig(phase, dir, {
|
|
770
|
+
customConfig: {
|
|
771
|
+
...normalizedConfig,
|
|
772
|
+
experimental
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
function isResolvedNextConfig(config) {
|
|
777
|
+
return typeof config.configFileName == "string";
|
|
778
|
+
}
|
|
779
|
+
function isTurbopackRustReactCompilerError(error) {
|
|
780
|
+
return error instanceof Error && error.message.startsWith(TURBOPACK_RUST_REACT_COMPILER_ERROR);
|
|
781
|
+
}
|
|
782
|
+
function interopDefault(module) {
|
|
783
|
+
return typeof module == "object" && module !== null && "default" in module ? module.default ?? module : module;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// src/nextjs-vite-plugin/index.ts
|
|
787
|
+
var require4 = createRequire3(import.meta.url), compiledReactDir = dirname(require4.resolve("next/dist/compiled/react")), compiledReactDomDir = dirname(require4.resolve("next/dist/compiled/react-dom")), loadJsConfig2 = (
|
|
788
|
+
// biome-ignore lint/suspicious/noExplicitAny: CJS support
|
|
789
|
+
nextLoadJsConfig2.default || nextLoadJsConfig2
|
|
790
|
+
);
|
|
791
|
+
function VitePlugin({ dir = process.cwd(), image } = {}) {
|
|
792
|
+
let resolvedDir = resolve3(dir), isVite8orNewer = getViteMajorVersion() >= 8, nextConfigResolver = Promise.withResolvers(), nodeEnv = process.env.NODE_ENV;
|
|
793
|
+
return loadNextConfig(nodeEnv === "development" ? PHASE_DEVELOPMENT_SERVER : nodeEnv === "test" ? PHASE_TEST : PHASE_PRODUCTION_BUILD, resolvedDir).then(nextConfigResolver.resolve, nextConfigResolver.reject), [
|
|
794
|
+
isVite8orNewer ? null : nextConfigResolver.promise.then(async (nextConfig) => {
|
|
795
|
+
let loadedJSConfig = await loadJsConfig2(resolvedDir, nextConfig), { enforce, ...tsconfigPathConfig } = tsconfigPaths({
|
|
796
|
+
root: resolvedDir,
|
|
797
|
+
...loadedJSConfig.jsConfigPath ? { projects: [loadedJSConfig.jsConfigPath] } : {}
|
|
798
|
+
});
|
|
799
|
+
return {
|
|
800
|
+
...tsconfigPathConfig
|
|
801
|
+
};
|
|
802
|
+
}),
|
|
803
|
+
{
|
|
804
|
+
name: "@aussieljk/forkbook/internal/nextjs-vite-plugin",
|
|
805
|
+
enforce: "pre",
|
|
806
|
+
async config(config) {
|
|
807
|
+
let isNext16orNewer = getNextjsMajorVersion() >= 16, nextConfig = await nextConfigResolver.promise, executionEnvironment = getExecutionEnvironment(config), resolveConfig = {
|
|
808
|
+
...isVite8orNewer ? { tsconfigPaths: !0 } : {},
|
|
809
|
+
...!isVitestEnv && {
|
|
810
|
+
alias: [
|
|
811
|
+
{
|
|
812
|
+
find: /^react$/,
|
|
813
|
+
replacement: require4.resolve("next/dist/compiled/react")
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
find: /^react\/jsx-runtime$/,
|
|
817
|
+
replacement: require4.resolve("next/dist/compiled/react/jsx-runtime")
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
find: /^react\/jsx-dev-runtime$/,
|
|
821
|
+
replacement: require4.resolve("next/dist/compiled/react/jsx-dev-runtime")
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
find: /^react-dom$/,
|
|
825
|
+
replacement: require4.resolve("next/dist/compiled/react-dom")
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
find: /^react-dom\/server$/,
|
|
829
|
+
replacement: require4.resolve("next/dist/compiled/react-dom/server.browser.js")
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
find: /^react-dom\/test-utils$/,
|
|
833
|
+
replacement: require4.resolve("next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js")
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
find: /^react-dom\/client$/,
|
|
837
|
+
replacement: require4.resolve("next/dist/compiled/react-dom/client.js")
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
find: /^react-dom\/cjs\/react-dom\.development\.js$/,
|
|
841
|
+
replacement: require4.resolve("next/dist/compiled/react-dom/cjs/react-dom.development.js")
|
|
842
|
+
}
|
|
843
|
+
]
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
return {
|
|
847
|
+
...Object.keys(resolveConfig).length > 0 ? { resolve: resolveConfig } : {},
|
|
848
|
+
optimizeDeps: {
|
|
849
|
+
include: [
|
|
850
|
+
"next/dist/shared/lib/app-router-context.shared-runtime",
|
|
851
|
+
"next/dist/shared/lib/head-manager-context.shared-runtime",
|
|
852
|
+
"next/dist/shared/lib/hooks-client-context.shared-runtime",
|
|
853
|
+
"next/dist/shared/lib/router-context.shared-runtime",
|
|
854
|
+
"next/dist/client/components/redirect-boundary",
|
|
855
|
+
"next/dist/client/head-manager",
|
|
856
|
+
"next/dist/client/components/is-next-router-error",
|
|
857
|
+
"next/dist/shared/lib/segment",
|
|
858
|
+
"next/dist/shared/lib/app-router-context.shared-runtime.js",
|
|
859
|
+
"next/dist/shared/lib/head-manager-context.shared-runtime.js",
|
|
860
|
+
"next/dist/shared/lib/hooks-client-context.shared-runtime.js",
|
|
861
|
+
"next/dist/shared/lib/router-context.shared-runtime.js",
|
|
862
|
+
"next/dist/client/components/redirect-boundary.js",
|
|
863
|
+
"next/dist/client/head-manager.js",
|
|
864
|
+
"next/dist/client/components/is-next-router-error.js",
|
|
865
|
+
"next/dist/shared/lib/segment.js",
|
|
866
|
+
"styled-jsx",
|
|
867
|
+
"styled-jsx/style",
|
|
868
|
+
"sb-original/image-context",
|
|
869
|
+
"sb-original/default-loader",
|
|
870
|
+
"next/dist/compiled/react",
|
|
871
|
+
"next/image",
|
|
872
|
+
"next/legacy/image",
|
|
873
|
+
"react/jsx-dev-runtime",
|
|
874
|
+
// Required for pnpm setups, since styled-jsx is a transitive dependency of Next.js and not directly listed.
|
|
875
|
+
// Refer to this pnpm issue for more details:
|
|
876
|
+
// https://github.com/vitejs/vite/issues/16293
|
|
877
|
+
"next > styled-jsx/style",
|
|
878
|
+
...isNext16orNewer ? [] : ["next/config"],
|
|
879
|
+
// Next.js 16 ships internal re-export chains that Vite's esbuild
|
|
880
|
+
// pre-bundler fails to resolve in dev mode, causing missing exports
|
|
881
|
+
// like ServerInsertedHTMLContext and RedirectStatusCode. Forcing
|
|
882
|
+
// these modules to be pre-bundled fixes the resolution.
|
|
883
|
+
// See: https://github.com/storybookjs/storybook/issues/34688
|
|
884
|
+
...isNext16orNewer ? ["next/navigation", "next/dist/client/components/redirect-error"] : []
|
|
885
|
+
]
|
|
886
|
+
},
|
|
887
|
+
test: {
|
|
888
|
+
alias: {
|
|
889
|
+
"next/dist/compiled/react": compiledReactDir,
|
|
890
|
+
"next/dist/compiled/react-dom": compiledReactDomDir,
|
|
891
|
+
"react/jsx-dev-runtime": require4.resolve("next/dist/compiled/react/jsx-dev-runtime.js"),
|
|
892
|
+
"react/jsx-runtime": require4.resolve("next/dist/compiled/react/jsx-runtime.js"),
|
|
893
|
+
react: require4.resolve("next/dist/compiled/react"),
|
|
894
|
+
"react-dom/server": require4.resolve(
|
|
895
|
+
executionEnvironment === "node" ? "next/dist/compiled/react-dom/server.js" : "next/dist/compiled/react-dom/server.browser.js"
|
|
896
|
+
),
|
|
897
|
+
"react-dom/test-utils": require4.resolve("next/dist/compiled/react-dom/cjs/react-dom-test-utils.production.js"),
|
|
898
|
+
"react-dom/cjs/react-dom.development.js": require4.resolve("next/dist/compiled/react-dom/cjs/react-dom.development.js"),
|
|
899
|
+
"react-dom/client": require4.resolve("next/dist/compiled/react-dom/client.js"),
|
|
900
|
+
"react-dom": require4.resolve("next/dist/compiled/react-dom")
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
},
|
|
905
|
+
configResolved(config) {
|
|
906
|
+
isVitestEnv && !config.test?.browser?.enabled && (config.test.setupFiles = [
|
|
907
|
+
require4.resolve("./mocks/storybook.global.js"),
|
|
908
|
+
...config.test?.setupFiles ?? []
|
|
909
|
+
]);
|
|
910
|
+
}
|
|
911
|
+
},
|
|
912
|
+
vitePluginNextFont(),
|
|
913
|
+
vitePluginNextSwc(dir, nextConfigResolver),
|
|
914
|
+
vitePluginNextEnv(dir, nextConfigResolver),
|
|
915
|
+
vitePluginNextImage(nextConfigResolver, image),
|
|
916
|
+
vitePluginNextMocks(),
|
|
917
|
+
vitePluginNextDynamic()
|
|
918
|
+
];
|
|
919
|
+
}
|
|
920
|
+
var nextjs_vite_plugin_default = VitePlugin;
|
|
921
|
+
export {
|
|
922
|
+
nextjs_vite_plugin_default as default
|
|
923
|
+
};
|